[GRASS-user] Do not report cells where thousands of maps have no data

Moritz Lennert mlennert at club.worldonline.be
Sat Sep 28 05:01:41 PDT 2019


On 27/09/19 17:39, Nikos Alexandris wrote:
> GRASS GIS' `r.stats` modules does this:
> ```
> r.stats input=$(g.list rast pattern=cru*.*1 separator=comma) -n -x -N
> ```
> 
> However, it won't do it for thousands of maps. Too many maps will hit
> the '[Argument list too long]' error which is triggered by the ARG_MAX
> constant.  Is there a work-around?

- use xargs
- use r.series with the -n flag and 'file' parameter

> 
> Else, I see no option but to set on a Python script that will loop over
> thousands of maps and will identify pixels for which all maps have a
> valid value.  Any recommendations (like best to user xarray or numpy or
> rasterio or else...)?

I think r.series -n will give you what you want: any none null pixel in 
the output will have a value in all maps.

Moritz


More information about the grass-user mailing list