The code you found is actually referring to other forms of aggregators, so you cannot use them here.
You have two options: The first is to create a xml graph, define your aggregators there (see binningGraphExample.xml (1.5 KB) for a nonsense example ) and use this to run the operator.
The other option is to create the AggregatorConfigs in Python. The configs are
A have tried using aggregators from python, but I can’t create classes you mentioned. A can get just aggregator class itself.
After:
bin = jpy.get_type(‘org.esa.snap.binning.aggregators.AggregatorAverage.Config’)
I get:
ValueError: Java class ‘org.esa.snap.binning.aggregators.AggregatorAverage.Config’ not found
This works fine:
bin = jpy.get_type(‘org.esa.snap.binning.aggregators.AggregatorAverage’)
But I can not initialize the new object:
bin()
RuntimeError: no matching Java method overloads found
I have looked at a java documentation of AggregatorAverage class, but I have no experiences with Java. In that class, if I understand right, there are two constructors. Each of them has as first input parameter VariableContext varCtx . But it looks like that the VariableContext class has no constructor.
Anyway, I have tried set rest of parameters (String varName, double weightCoeff), but with the same error.
bin(varName=‘radiance_1’, weightCoeff=0.0)
RuntimeError: no matching Java method overloads found
parameters.put(‘outputFile’, ‘level-3_py.dim’)
parameters.put(‘numRows’, 13360) # to have about 1.5km spatial resolution
parameters.put(‘aggregators’, aggregators)
result = snappy.GPF.createProduct(‘Binning’, parameters, product)
Maybe some more questions. It is possible to set target format? By default it’s ‘BEAM-DIMAP’, even if I set another extension, it adds a ‘.dim’. If I want another format, I need to save result. But the ‘BEAM-DIMAP’ is already created.
And it’s possible to set spatial resolution in km, not in pixels, like in SNAP Desktop?