GPT Binning MIN_MAX error with NaN

Hello, I attempted to generate a monthly maximum map from many daily maps. I used the Binning tool, but the output are all NaN. I checked the data, notice some days have all NaN pixels (such blank daily maps exist in the Binning list). The Binning AVG works fine to give average and sigma maps, only MIN_MAX aggregator gives NaN.

A even tricky part is, the NaN in daily maps comes from its “valid-pixel expression” (“daily_count>0” in my case from previous calculation); this “valid-pixel expression” will carry in BandMath operation, and no place to remove. Although Binning Operator has an “intermediate source bands” option which obviously works the same as BandMath, this option cannot solve the NaN issue in the result month max map.

I have read some existing relevant posts, such as here and here but still not able to solve the problem.

Any help is appreciated!

Chui,

If you are using multiple bands at once you should put a condition not to use NaN values (or theirs expresio…) for BandMaths.

Here is a SNAP GPT expression in a graph for raster_count ommiting anything below 0.0005 (or smth.) (dual band iterative):

${band_00} <= 0.0005 ? 0.0+ ${band_count} : 1.0+${band_count}

The best thing to do is to create or give us the graphs so we can give you a direct expression to use.

Petr

Thank you Petr for the reply.

I used condition the same way as in your reply. The question is, {band_00}has the property “valid-pixel expression” set as band_count>0. In the result of your condition expression, this “valid-pixel expression” (band_count>0) will carry to the result, with no place to remove it in BandMath (and further in Binning’s Intermediate source bands).
Therefore, the resultant band will have many NaN values, due to the carried “valid-pixel expression” : " band_count>0".

I previously also attempted to provide a graph, but I cannot find the Binning operator in Graph. I attached a screenshot of Binning to show my problem.

My task is quite simple: how to build a Max monthly map, from a series of daily maps with NaN in some days (caused by their “valid-pixel expression”: daily_count>0)?


In the following screenshot, left dialog is the property of a daily map, middle is the property of the resultant map after BandMath with a condition, right dialog is the setting in Binning.
As you can see, in the middle dialog, the “valid-pixel expression” carries from left dialog in daily map. the same problem in further Binning, where I will receive NaN in my monthly Max map.

@marpet Also, it would be better to have GPT Binning check the input layers, and avoid NaN during the MIN-MAX aggregation. Currently I feel it directly gives “NaN” for both MIN and MAX in the output when there is a NaN. (I may be wrong)
The “AVG” aggregator seems not have this issue, it will give average directly excluding the NaN.

I haven’t followed the complete discussion, but I can say that this is a known issue and already solved (SNAP-846). It will be included in the next release.

You can use the Binning operator in a graph and also from the command line, but it is not usable from the Graph Builder GUI. You need to create the XML file by hand.

Thank you Marco. I will wait for the new version 6 release in that case.

Yes, I know I can add Binning XMl files to the graph, but I mainly using gpt, so did not bother to build a graph.