[GRASS-dev] r.mapcalc: using text labels as file names in equations

Markus Neteler neteler at osgeo.org
Mon Oct 3 12:13:24 EDT 2011


Hi,

I have to do computations on raster map combinations: one map contains the
month of interest as pixel value, a set of 12 monthly maps the related values.

My task is to find pixelwise the average temperature of the, say,
warmest month of
a year which's number is stored in the first map called "warmest_month"
along with a text label:
1 jan_tmean
2 feb_tmean
...

I would then need to use these text labels (alias map names) in a r.mapcalc
function which is already working for numerical labels (see pH values in
the manual, accessible with @mapname).

Suggestion: new "?" operator, to allow for this:

r.mapcalc "snow_zone = if(?warmest_month < 3.0, 1, null() )"

This would not read "warmest_month" (1...12) but "jan_tmean" etc instead
and use the label as map name to the numerical extract values from there.

Would it be possible to extend r.mapcalc in this direction?

Markus


More information about the grass-dev mailing list