[GRASS-user] Issue with r.mapcalc module
wenzeslaus at gmail.com
Thu Sep 6 19:51:39 PDT 2018
On Thu, Sep 6, 2018 at 7:55 AM Micha Silver <tsvibar at gmail.com> wrote:
> You need quotes around the expression:
> On 06/09/2018 13:47, Vidura Dantanarayana wrote:
> Hi all,
> I need to create a raster file with the
> if(fuel_class==4,3,if(fuel_class==8,15)) expression. I used the following
> command but it result a parse error.
> r.mapcalc --overwrite expression=1hr_moisture =
> r.mapcalc --overwrite expression="1hr_moisture =
> Also, what happens if feul_class is not 4 and not 8??
> What could be the reason for the error?
Not sure, perhaps more info would be in the whole error message, but here
are some tips:
1. Check if the input raster map exists.
2. Do not start the raster map name with a number.
3. Use space after comma and around operators (best practice).
Here is the same expression but with the suggestions and null() for the
case Mica mentioned (note that I didn't actually tested that):
r.mapcalc --overwrite expression="moisture_1hr = if(fuel_class == 4, 3,
if(fuel_class == 8, 15, null()))"
> Vidura Dantanarayana.
> grass-user mailing listgrass-user at lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/grass-user
> Micha Silver
> Ben Gurion Univ.
> Sde Boker, Remote Sensing Lab
> grass-user mailing list
> grass-user at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the grass-user