[Thread Prev][Thread Next][Index]

Fw: Re: Re: change T-axis




Hi, Jaison
 
when i run the example script as you provided, i'm informed the following message:
yes? go example
 **ERROR: invalid command: use RETURN= shape,size,grid,title,bad,t0,units,dset,
                dsetnum,dsetpath,dsettitle,*size,*start,*end,*units,*axis,nc_sca
le,nc_offset,user_scale,user_offset
          u,r=CALENDAR
define symbol t_cal   = `u,r=CALENDAR`
Command file, command group, or REPEAT execution aborted
--------------
The latter method you mensioned is ok, but i think i need the former method.
--------------------------------------------------------------------------
My specific script is as below:  i want to calculate correlation coefficient between two varibles with different length. When i run the following script i got the error  message:
 **ERROR: inconsistent sizes of data regions: T axis
          STDS has 179 points (L=001:179)
          expression has 167 points (L=013:179)
PPL %LABEL/nouser 7.8,0.14,-1,0,0.16 @ASR=`corr,p=-2`
Command file, command group, or REPEAT execution aborted
----------------------my script--------------------------------------------
cancel mode verify
cancel region
cancel data/all
cancel var/all
!
  define axis/t=16-apr-1945:16-oct-1992/npoints=191 t1           !seasonal mean
  define grid/t=t1 g1
  file/var=coral/grid=g1 d:\p12\seasonal\sst4503-9211s.asc
 
  define axis/t=16-apr-1948:16-oct-1992/npoints=179 t3         ! shorter 3 years than SST
  define grid/t=t3 g3
  file/var=wspd/grid=g3 d:\p12\seasonal\wspd10004803-9211s.asc
 
  set window/size=1/aspect=1.294
  def view/xlim=0.15,0.85/ylim=0.84,1.000 v11
  def view/xlim=0.15,0.85/ylim=0.68,0.840 v21
  def view/xlim=0.15,0.85/ylim=0.52,0.680 v31
  def view/xlim=0.15,0.85/ylim=0.36,0.520 v41
  def view/xlim=0.15,0.85/ylim=0.20,0.360 v51
  def view/xlim=0.15,0.85/ylim=0.04,0.200 v61
  def sym margin1=0.4,0.4,0.2,0.2
 
  def sym line1=@ASdark line: 1000hpa Wind speed anomay(m/s)
  def sym line1_pos=2.4,1.84,-1,0,0.16
  def sym line2=@ASgreen line: SSTa(^oC)
  def sym line2_pos=2.4,0.14,-1,0,0.16
  def sym rr_pos=7.8,0.14,-1,0,0.16
  def sym title_pos=1.25,-0.8,-1,0,0.16
  def sym title=Seasonal time series during period 1948-1992. 
  go bold
 
 ! set mode metafile d:\sum.plt
 
  let ccoral=coral[d=1,l=13:191]  ! remove 1945-47,from 4803-9211,n=179
  list/l=1:191 ccoral
 
  set view v11
  let cave=ccoral[l=1:179@ave] 
  let cdif=ccoral[l=1:179]-cave
  let cdif2=cdif*cdif
  let csum=cdif2[l=1:179@sum]
  let sc=(csum/178)^0.5
  let stdc=cdif/sc
  let save=wspd[d=2,l=1:179@ave]
  let sdif=wspd[d=2,l=1:179]-save
  let sdif2=sdif*sdif
  let ssum=sdif2[l=1:179@sum]
  let ss=(ssum/178)^0.5
  let stds=sdif/ss
  let a=stdc*stds
  let aa=a[l=1:179@sum]
  let corr=aa/178.
  go margins ($margin1)
  GO wspd_left  wspd[d=2,l=1:179] "wind speed"
  GO coral_right ccoral[l=1:179] "-1.2,1.2,0.3" "SSTa" 0.12 ",,,+1,,(f4.1)"
  label/nouser ($rr_pos) @ASR=`corr,p=-2`
  let zero=0
  let xlev=if(l eq 1)then `($XAXIS_MIN)` else `($XAXIS_MAX)`
  let ylev=zero+l-l
  plot/o/nolab/line=4/vs/l=1:2 xlev,ylev
  label/nouser ($line1_pos) ($line1)
  label/nouser ($line2_pos) ($line2)
 
  set view v21                                     ! calculate correlation of summer seasons
  let scoral=ccoral[l=2:179:4]              ! extract summer seasons
  let wwspd=wspd[d=2,l=2:179:4]      ! extract summer seasons
  let cave=scoral[l=1:45@ave]
  let cdif=scoral-cave
  let cdif2=cdif*cdif
  let csum=cdif2[l=1:45@sum]
  let sc=(csum/44)^0.5
  let stdc=cdif/sc
  let save=wwspd[l=1:45@ave]
  let sdif=wwspd-save
  let sdif2=sdif*sdif
  let ssum=sdif2[l=1:45@sum]
  let ss=(ssum/44)^0.5
  let stds=sdif/ss
  let a=stdc*stds
  let aa=a[l=1:45@sum]
  let corr=aa/44.
  go margins ($margin1)
  GO wspd_left  wspd[d=2,l=2:179:4] "Summer wind speed"
  GO coral_right ccoral[l=2:179:4] "-1.2,1.2,0.3" "Summer SSTa" 0.12 ",,,+1,,(f4.1)"
  label/nouser ($rr_pos) @ASR=`corr,p=-2`
   frame/file=Rsumwspd1000sst.gif
  ! cancel mode metafile
-------------------------------------------------
-------------------------------------------------
Regarding to my specific work, what should i to do to achieve my goal? Thanks for your patience to read my long e-mail.
 
 

Hi Gao Rongzhen,
                  You need to assign a new time axis for that variable.
You can assign a new time axis in two ways: 1) define a new time axis
and use regridding utilities (like @ASN), 2) use RESHAPE function to 
change the grid of a the variable to that of a second variable. I think
the second method will be more flexible. Please refer user manual ( @ASN:
Ch4 Sec2.4.1.  Regridding transformations , RESHAPE:Ch3 Sec2.3.23.  
RESHAPE )
for details. Here is an example using monthly_navy_winds dataset with 
neccessary details. If you need any mode clarification please let me know.
 
With Regards 
 
Jaison
 
!--------example.jnl---------------------
 
     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=TUNITS`    ! time units (days/hours...)
     define symbol t_zero  = `u,r=T0`        ! Ref. time 
     define symbol t_cal   = `u,r=CALENDAR`  ! calendar type
 
! 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
!           yes? 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:20 u
    list/x=60/y=10/l=1:20 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----------------------------
 
 
 
On Wed, 5 Jan 2005, [gb2312] ¸ßÈÙÕä wrote:
 
>  Hi, all
>  
>  I have a time series with length N=191. 
>  And now, i want to select part of the data from N=13 to 191 to form a new variable. 
>  By,  let ccoral=coral[d=1,l=13:191] 
>  Now,  list/l=1:20 ccoral 
>  The information shown on the screen is as below:
>  ------------------------------------------------------------
>  VARIABLE : CORAL[D=sst4503-9211s.asc,L=13:191]
>  SUBSET   : 8 points (TIME)
>  13:  0.4100
>  14: -0.0900
>  15: -0.8500
>  16: -0.2800
>  17: -0.2700
>  18:  0.0500
>  19: -0.2800
>  20:  0.3300
>  ------------------------------------------------------------
>  My problem is the defination of T-axis of the new variable.
>  What i wanted is the first value of ccoral starts from L=1 not from L=13, and the last value ends with L=179 not with L=191. Is there a way by Ferret to change the T-axis of the new  variable ccoral? 
>  
>  Thanks in advance.
>  
>  Gao Rongzhen
>  
 
-- 
___________________________________________________
 
    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
___________________________________________________
 



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement