[GRASS-user] Using r.mapcalc to transform '*' values to a float

Glynn Clements glynn at gclements.plus.com
Tue Oct 7 18:35:14 EDT 2008


Thomas Adams wrote:

> I have a GRASS location that spans the entire U.S. I plan on 
> re-projecting raster maps into the location from a GRASS location with a 
> much smaller domain. When I do this, the values outside of the projected 
> map region have a value '*' when I query the new raster outside of my 
> area of interest using the GRASS GUI. What I need to do, ultimately, is 
> to use r.out.ascii to write out an ascii grid that covers the full U.S. 
> region regardless of the extent of the actual data. However, before I do 
> this I want to use r.mapcalc to convert the '*' values (are they 
> 'null'?) to 9.999e+20, which is a the missing value for the software 
> that needs to ingest the ascii file output from GRASS. How do I treat 
> the '*' values in r.mapcalc?

The '*' values are nulls.

You can convert them with r.mapcalc with:

	r.mapcalc 'newmap = if(isnull(oldmap),9.999e+20,oldmap)'

Or you can modify the existing map in place with:

	r.null themap null=9.999e+20

Or you can leave them as null but replace them in the export process
with:

	r.out.ascii themap null=9.999e+20

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list