I am looking to calculate the statistic (mean, max, min, count, etc) of a raster file using its mask channels.
after some search I think “StatisticsOp” is the tool. the SNAP does not let me save the statistic operation as a xml/graph, while I also did not find an complete example in this forum. could any one give me an example of how to run it?
I have attached the graph I made based on the help file, but not work. gpt -e ./StatisticGraph.xml -Ssource=$outfile_bndry -Pout_stats='test.rst'
what is the difference between: sourceProducts and sourceProductPaths ? when input the raster files? should I only choose one of them for the input?
if I want to use a mask condition, rather than a shapefile, should I set the condition in <validPixelExpression> ?
You are actually very close to running the StatisticsOp. The error message states that you can only set EITHER a source band name OR a band maths expression must be provided. If you remove one of these, your graph should work.
sourceProducts and sourceProductPaths serve the same purpose in a different way. The difference is that sourceProducts expects a source product argument (given by you correctly via -Ssource=$outfile_bndry ), while sourceProductPaths expects a parameter (which you would set with -Psource=$outfile_bndry ). sourceProductPaths is quite handy if you want to compute statistics for multiple products, as you can set a pattern ( e.g, -Psource=$*_bndry ) ). For your case where you only have one product you can safely not set the sourceProductPaths parameter.
And yes, for masking you can use the validPixelExpression.