[GRASS-dev] matplotlib example script
Glynn Clements
glynn at gclements.plus.com
Fri Jul 25 22:01:55 EDT 2008
Yann Chemin wrote:
> this happens because the data has NAN (see r.info output):
> Range of data: min = nan max = nan
>
> Is there a way to discard NAN in a.min() and a.max() calculations?
> Or is there a NAN-resistant mode in matplotlib?
NaN should never appear in GRASS rasters. When it does, it's a bug in
the module which created the map (do you know which module was
responsible in this case?).
One of the things which is on my to-do list for 7.x is to change
G_is_[fd]_null_value() to treat *all* NaN values as null (currently,
it checks for a specific bit pattern, which is just one possible NaN
value).
Once that is done, then r.stats' -n flag will prevent NaNs from making
it into the output.
In the meantime, you can clean up maps which contain NaNs with e.g.:
r.mapcalc 'newmap = if(oldmap == oldmap,oldmap,null())'
or, with recent versions of r.null:
r.null map setnull=nan
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list