[Thread Prev][Thread Next][Index]

Re: [ferret_users] daily cumul to daily value



Le 26/02/2015 10:28, Delclaux Francois a écrit :
HI,
I have a file containing daily cumulative data. For exemple, if pi is daily precipitation:
day 1:  p1
day 2 : p1 + p2
day 3 : p1+ p2 +p3
...
day i : p1 + p2 + ... + pi-1 + pi
...
day 365 : p1 + p2 + ... + p365    = yearly precipitation

Now, I would like to calculate pi the daily precipitation, i.e.
day 1 : p1
day 2 : p2
day 3 : p3
...
day i : pi
...
day 365: p365

So, for each day, I have to substract the pi-1 value to the pi value.
Is it possible to do that with Ferret ?

Thanks in advance for any help

Hi,

You need to calculate a backward difference.
Using the transform SHF will do the job like this

yes? let rsum={2, 4, 6, 7, 8, 12, 12, 15}
yes? let inst=rsum-rsum[i=@shf:-1]
yes? list inst
             VARIABLE : RSUM-RSUM[I=@SHF:-1]
             SUBSET   : 8 points (X)
 1   / 1:   ....
 2   / 2:  2.000
 3   / 3:  2.000
 4   / 4:  1.000
 5   / 5:  1.000
 6   / 6:  4.000
 7   / 7:  0.000
 8   / 8:  3.000

Regards
Patrick

--
LSCE/IPSL, Laboratoire CEA-CNRS-UVSQ
Data Analysis and Visualization Engineer
ICMC - IPSL Climate Modelling Centre
--



[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement