[GRASS-user] Exporting set of raster cells with different values as one layer
mlennert at club.worldonline.be
Fri Oct 26 00:55:05 PDT 2018
Am 26. Oktober 2018 09:08:11 MESZ schrieb Kalindu Perera <kkc199408 at gmail.com>:
>Thanks a lot Moritz....!!!!!!!!
>Can you just send me one example command?..I'm not sure I understood it
>the way that you explained
Please do read the r.mapcalc manual, but here's an example:
r.mapcalc "category_range = if(spread_time_observed >= 1 && spread_time_observed <= 90
, 1, null())"
If there are no values below 1 in spread_time_observed, then this can be simplified to
r.mapcalc "category_range = if(spread_time_observed <= 90
, 1, null())"
The result of each command is a map with pixel values of 1 where the condition is met and null where not.
>Thanks again for the quick reply
>On Fri, 26 Oct 2018 at 11:46, Moritz Lennert
><mlennert at club.worldonline.be>
>> Am 26. Oktober 2018 06:42:44 MESZ schrieb Kalindu Perera <
>> kkc199408 at gmail.com>:
>> >Dear all,
>> >I'm doing wildfire simulations in the Grass. I need to calculate the
>> >of only the wildfire spread from the simulation. For that, I need to
>> >only the wildfire spread as a separate layer. But the drawback is
>> >values of the cells in the spread is different from point to point.
>> >has a range. As an example, the values of cells inside the spread
>> >ranging from 1-90. The other cells in the map show values more than
>> >Can I write a mapcalc command for a range like this to output these
>> >as one layer?
>> >@Nikos has sent me this mapcalc command and from that, we can take
>> >cells with one value as a layer.
>> >r.mapcalc "category_3 = if(spread_time_observed == 3, 3, null())"
>> >instead of that one value(3) in this can we input a range as
>> >and get all those cells with different values as one layer?
>> You can use >/< and the && (logical AND) to select all pixels within
>> range in r.mapcalc.
>> But you could also use r.reclass or r.recode.
More information about the grass-user