[Thread Prev][Thread Next][Index]

RE: [ferret_users] working with data of a month over the years



Hi Peter,
           If you got the correct answer with the method you mentioned,
your T0-will be 01-JAN-yyyy. If it was a different date (say 25-DEC-yyyy),
you must have got wrong results. The correction step i suggested in my
previous mail is to take care of this T0 effect. For more details, please
see the attached jnl file (extract_jan_daily.jnl).

   It will be very helpfull (for later explorations!!!) if you write scripts
in a general way, such that this sort of pitfalls are taken care off. That is
the only motivation behind applying a correction like this, rather than 
checking the T0 and adjusting the values manually...

Please let me know if you have any questions,

Cheers........

Jaison

On Sat, 05 Jan 2008 14:23:21 +0100, Peter Szabo wrote
> 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-------------------------------
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Attachment: extract_jan_daily.jnl
Description: Binary data


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement