snap-contrib / snapista

SNAP GPT thin layer for Python

Home Page:https://snap-contrib.github.io/snapista/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How is it possible to define aggregators for the Binning Operator?

mdelgadoblasco opened this issue · comments

I am trying to use snapista to build a graph using the Binning Operator, which needs to define aggregators and variables, but I cannot find the way to define aggregators using the aggregatorConfigs and variables using variableConfigs

Could you please provide some guidance with that or illustrate it with one example?

Thanks in advance

@mdelgadoblasco can you drop the XML with your typical binning operator scenario?

@mdelgadoblasco these are missing in the current version of snapista. We'll add them as well as the other classes required for the Binning Operator

@mdelgadoblasco the binning branch contains a partial implementation that covers the basic Binning operator scenario. I need more info from BC to get closer to a full coverage

@fabricebrito ! Thanks for the fast resolution. I will give a try in the following days.
As requested previously (not sure it is still needed), here a piece of the xml needed for the parameter defintion of the binning operator

<parameters>
    <sourceProductPaths/>
    <sourceProductFormat>Sen3</sourceProductFormat>
    <timeFilterMethod>NONE</timeFilterMethod>
    <numRows>2160</numRows>
    <superSampling>1</superSampling>
    <maxDistanceOnEarth>-1</maxDistanceOnEarth>
    <maskExpr>true</maskExpr>
    <variables>
        <variable>
            <name>variable_0</name>
            <expr>cloud_in==false?LST:NaN</expr>
            <validExpr>cloud_in_visible==false</validExpr>
        </variable>
    </variables>
    <aggregators>
        <aggregator>
            <type>AVG</type>
            <varName>LST</varName>
            <weightCoeff>1.0</weightCoeff>
            <outputCounts>false</outputCounts>
            <outputSums>false</outputSums>
        </aggregator>
        <aggregator>
            <type>MIN_MAX</type>
            <varName>LST</varName>
        </aggregator>
    </aggregators>
    <outputFile>C:\Users\jdelgado\Downloads\level-3.tif</outputFile>
    <metadataAggregatorName>NAME</metadataAggregatorName>
    <planetaryGridClass>org.esa.snap.binning.support.SEAGrid</planetaryGridClass>
</parameters>

@fabricebrito , is the fix composed only by python scripts? or do I need to do anything else?
In the sense, adding the binning folder you have created to my already install snapista, would it work? Or do I need to reinstall it?

you need to update snapista with conda update -n <env> snapista

Thanks @fabricebrito !
I think the binning with the aggregators are now fine.

Best

Thanks! Closing.