5 day precipitation

Ben Burford benb at RESTEC.OR.JP
Tue Feb 7 07:16:40 EST 2006


Hello All,

Ifm trying to implement a script.  I studied functions and looked in the
archives for help, but so far its over my head as a beginner, Ifm not
even sure if Grads can do this.

I have an 8 year (t=1,2922) global gridded daily precipitation data set.
For each grid cell I want to go through the time series and check each
five day period (2918 possible consecutive 5 day periods, each time
increment one day and check a 5 day period) to see if the total of the
precipitation for the five days is greater than a certain level, if it is
I want to increment a counter.  The result will be a single value (total
count) for each grid cell (global grid of a single value per grid cell).

The value that I want to check the five day total against is g10% of the
annual average rainfallh (tenpanave) which Ifm calculating as follows
(add up all the daily values for 8 years, divide by 8 to get the annual
average, then take 10% of that):
tenpanave = 0.1*((sum(prec,t=1,t=2922))/8)

A flow chart for the script might look like:
* Calculate g10% of the annual average rainfallh (tenpanave)
tenpanave = 0.1*((sum(prec,t=1,t=2922))/8)

* calculate the precipitation over 5 days (5dayprec), if that 5 day total
is greater than or equal to ten percent of the annual average
precipitation (tenpanave) then increment the counter for that grid cell.
Perform this process for all grid cells, over the full time period of 2922
days (x from 1 to 2918).
x=1
5dayprec=sum(prec,t=x,t=x+4)
if 5dayprec is greater than or equal to tenpanave then count=count+1
x=x+1
if x=2919 then quit, else go up three steps and calculate the next 5 day
window (5dayp)

* Display results (shows the count for each grid cell)
d count

As I say, I don't know if this can be done with Grads.  Any help would be
greatly appreciated.

Thank you,

Ben



More information about the gradsusr mailing list