[GRASS-user] List rasters with valid data inside a defined computational region
Michel Wortmann
wortmann at pik-potsdam.de
Fri Oct 25 03:45:36 PDT 2013
Hi Antonio,
here is a python script snipped. this might be slow if you have many
rasters that have values in the current region, those that don't, wont
take any time though.
import grass.script as grass
def inregion():
'''Return rasters in current mapset that have non-NULL values in
current region'''
maps=grass.list_strings('rast')
mapsin = []
for r in maps:
vin=grass.read_command('r.stats',input=r,flags='n').split()
if len(vin)>0: mapsin+=[r]
return mapsin
if __name__=='__main__':
print inregion()
Regards,
Michel
On 10/25/2013 11:07 AM, António Rocha wrote:
> Dear all,
> I would like to know if there is any direct method (of a suggestion of
> an indirect method) to list raster layers with valid pixels (not null)
> in a defined computational region?
> Thank you
> Regards,
> Antonio Rocha
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
More information about the grass-user
mailing list