[Thread Prev][Thread Next][Index]
RE: [ferret_users] working with data of a month over the years
Hi Ansley and Jaison,
Thank You for your help.
I used this method to have the January and July data:
let day = l[gt=precip]
let jan = if (mod(day,360) le 30) and (mod(day,360) ge 1) then 1 else 0
let jul = if (mod(day,360) le 210) and (mod(day,360) ge 181) then 1 else 0
let precip2a = precip * jan
let precip2u = precip * jul
I checked writing out the 30 years for one point and I got 0 for every
December 30th and February 1th data either.
Jaison,I did not get the point of this line:
let t_jan_base = T[gt=var] - t[gt=var,t=01-JAN-1971] + 1 ! step 2
But the script worked fine changed to this one:
let t_jan_base = T[gt=var] + 1 ! step 2
And I used the compresssl function, thanks for that.
Peter
!---------------example starts here-------------------------------
\cancel mode verify
! Description : Example script for extracting January data from a daily
! 30-year time series on 360-day calendar.
!
!-----------------------------------------------------------------
!--create a dummy variable : 360_DAY calendar, daily, 30-years
define axis/t=01-JAN-1971:30-DEC-2000:1/units=days/calendar=360_DAY\
/t0=30-JAN-1971 t30yr
let var = SIN(t[gt=t30yr]/500)
!---This method will result in wrong answer
let year_days = MOD(t[gt=var],360)
let daily_mask = IF year_days LE 30 THEN 1
let var_jan_all= var * daily_mask
let var_jan = COMPRESSL(var_jan_all)
let jan_pts = var_jan[l=@NGD]
list jan_pts
!---The accurate method....
! 1. assume that time units are days
! 2. remove the effects of T0 on T-values
! 3. account for 30-DEC (or multiples of 360)
let t_jan_base = T[gt=var] - t[gt=var,t=01-JAN-1971] + 1 ! step 2
let year_days = MOD(t_jan_base,360)
let daily_mask = IF year_days GE 1 AND year_days LE 30 THEN 1 ! step 3
let var_jan_all= var * daily_mask
let var_jan = COMPRESSL(var_jan_all)
let jan_pts = var_jan[l=@NGD]
list jan_pts
!list/l=1:35 daily_mask
!list/l=325:365 daily_mask
!list/l=715:755 daily_mask
!list/l=3595:3635 daily_mask
!---------------example ends here-------------------------------
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Privacy Policy | Disclaimer | Accessibility Statement