[GRASS-user] Computing continuous dry spell from strds
Sajid Pareeth
spareeth at gmail.com
Fri Oct 13 02:36:45 PDT 2023
Dear all
I have a temporal database of daily gridded rainfall for the last 40 years.
I want to find:
1. Number of times (count) the rainfall was 0 for 'atleast' *continuous *10
days in each year, in 5 years etc.
2. Max number of continuous (> 10days) dry days (rainfall=0) per year, per
5 years etc. In this I want to exclude continuous dry spells less than 10
days.
I am trying to use the `t.rast.algebra` following the example given here
<https://grasswiki.osgeo.org/wiki/Temporal_data_processing#How_to_count_consecutive_days_that_meet_a_certain_condition.3F>
.
# Create weekly mask to which we will add 1 or 0 according to
temperature in the days within it (each map in this week mask will
have a value of 7)
t.rast.aggregate input=temperature_daily output=weekly_mask
basename=mask_week granularity="1 weeks" method=count
# Calculate consecutive days with negative temperatures
t.rast.algebra base=neg_temp_days expression="consecutive_days =
weekly_mask {+,contains,l} if(temperature_daily < 0 &&
temperature_daily[-1] < 0 || temperature_daily[1] < 0 &&
temperature_daily < 0, 1, 0)"
The example works, but the above code counts every consecutive day in a
week even if there is a break in between.
I also didn't understand why the consecutive days are added to the total
number of days (+7) in the week in 'mask_week' strds.
I tried modifying the aggregate expression, but could not make it work to
my requirement as stated above.
Could anyone give a hint on how to go about this.
Many thanks in advance,
Best Regards
Sajid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20231013/3200eacd/attachment.htm>
More information about the grass-user
mailing list