[Thread Prev][Thread Next][Index]

Re: Re: Re: change T-axis



Hi, Jaison, both the example script and mine work.  Now for the reference of other users I made a summary shown as below.
 
There are two variables with different length, and what i want to do is to make them in equal length. Now there are two kind of method to get it.
 
! vars : variable1, N=191 seasons 16-apr-1945:16-oct-1992
!          variable2, N=179 seasons 16-apr-1948:16-oct-1992
!
----------------------------------Method 1:----------------------------------
    define axis/t=16-apr-1948:16-oct-1992/npoints=179 t48to92             
    define grid/t=t48to92 gfile                                           
 
    file/skip=12/grid=gfile/var=variable1 d:\*.asc    !   data for 1945-1947 is skipped from variable1 
    file/var=variable2/grid=gfile  d:\*.asc
----------------------------------Method 2::----------------------------------
     set data monthly_navy_winds  ! dataset available with Ferret
     let l_lo =  13     ! low  value for L  
     let l_hi = 120     ! high value for L
     let u = uwnd[d=1,l=`l_lo`:`l_hi`]  ! extract the subset data
! now extract the time values corresponding to the subset; needed
! only if the original variable is on a calendar time axis
     let t_data = T[gt=uwnd,l=`l_lo`:`l_hi`]
! get other details about the original time axis
     define symbol t_units = `u,r=TUNIT`    ! time units (days/hours...)
     define symbol t_zero  = `u,r=T0`       ! Ref. time
     define symbol t_cal = GREGORIAN  ! JULIAN is also fine          !Ferret 5.5
!    define symbol t_cal   = `u,r=CALENDAR`  ! calendar type           ! higher version
 
! define a destination time axis with these details
 
  define axis/t/T0="($t_zero)"/units=($t_units)/CALENDAR=($t_cal)/from_data tsub=t_data
 
! suppose your original variable is not on a "CALENDAR" time
! axis, then just after extracting the subset, define an abstract "T"
! axis like
! define axis/t=1:`l_hi-l_lo+1`:1 tsub
! and use this in the following sequence of commands
  
! create a new variable "t_stamp"  on the destination grid with XYT grid
!                           put + Z[gz=u]*0 if needed
    let t_stamp = X[gx=u]*0 + Y[gy=u]*0 + T[gt=tsub]  ! destination grid
    let u_t = RESHAPE(u,t_stamp)   ! put variable on the destination grid
! comparison
    list/x=60/y=10/l=1:15 u
    list/x=60/y=10/l=1:3 u_t
    plot/x=60/y=10 u_t, u
 
! now you can use u_t ; for u_t "/L=1" ==> first point on time axis
 
!---------end of example.jnl  written by Jaison----------------------------
Hi Gao Rongzhen,
 
1. Regarding example
----------------------
 
   Which version of Ferret are you using ?
  `u,r=CALENDAR` will work only with the recent versions (5.6/5.7)
of Ferret. Otherwise use ncdump to see the calendar type; look for
the attribute "calendar=.....", if there is no attribute like that
then it is GREGORIAN, so in Ferret do like this
 
       define symbol t_cal = GREGORIAN  ! JULIAN is also fine
 
2. Regarding your script
------------------------
 
   Without the datasets it is difficult to check your script. Anyway
what seems to me is that:
 
     - both of the datasets are in ascii form, so it is really easy
       to read only the required points (from the bigger dataset)
       rather than reading whole and sub-sizing it in ferret. use
       "SKIP" to skip the first few seasons from the file 
       "sst4503-9211s.asc". Skip the first 12 values from this file
       and read in both the variables to a common grid ..like
       (hope your data is in a single column)
 
       define axis/t=16-apr-1948:16-oct-1992/npoints=179 t48to92
       define grid/t=t48to92 gfile
 
       file/skip=12/grid=gfile/var=coral d:\p12\seasonal\sst4503-9211s.asc
       file/var=wspd/grid=gfile  d:\p12\seasonal\wspd10004803-9211s.asc
 
  Have a trial with the attached jnl file (coral.jnl modified version 
of the script you had send me).
 
With Regards 
 
Jaison
 
-- 
___________________________________________________
 
    Jaison Kurian                           
    Centre for Atmospheric and Oceanic Sciences
    Indian Institute of Science
    B A N G A L O R E   560 012
    Ph: +91-80-3942505
        +91-80-3600450
    Fax:+91-80-3600865
___________________________________________________
 

Attachment: face-2.gif
Description: GIF image


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement