[Thread Prev][Thread Next][Index]

Re: [ferret_users] More specific question on time series overlay wrt Grid Transformation and Definition

Hi Ag,
You can overlay time series plots even if the time axes are not the same. For instance, try this quick script.  monthly_navy_winds is one of the datasets that comes with the Ferret distribution. The time axis of variable uwnd from monthly_navy_winds has units of days, and a time origin of 14-Jan-1980; the time axis I define has units of months and a time origin of 15-jan-1901.
yes? use monthly_navy_winds
yes? let var1 = uwnd[x=300,y=1]

yes? define axis/t=1-jan-1982:1-jan-1991:1/units=months tmonth
 *** NOTE: /UNIT=MONTHS is ambiguous ... using 1/12 of 365.2425 days

yes? let var2 = 2*cos(t[gt=tmonth])

yes? plot var1,var2
For your script, I would suggest you plot each of your time series separately. Define each variable, don't regrid to the same time axis, but just create each on the time axis that makes sense for it.  Then look at the individual plots and see if they look correct.  Are the commands to read from your ascii file really skipping the first block and reading the second set of data? You could do this:

PLOT new_var_11

ag wrote:
Dear Ferret User Group:

OK ...after a more thorough search....I understand that in order to place (overlay) a second time series, I need to re-grid the second variable to the time grid that is specified by the first time axis...here are the commands I am using to do so and I am still getting only one plot in the figure. Any pointers are greatly appreciated.

!For first data block  in ASCII file...($3 is the variable I want to plot specified by Column name)

DEFINE axis/T/T0=1-jan-2001/UNIT=DAYS ttaxis_days_1=tstep_1[L=1:`nntime_1`]    !nntime_1 is read from file
LET dummy_1   = t[GT=ttaxis_days_1]
LET new_var_1 = RESHAPE($3,dummy_1)

list new_var_1  ! Prints out the correct values

DEFINE GRID/T=ttaxis_days_1 gttaxis_1
LET dummy_11  = t[GT=gttaxis_1]
LET new_var_11 = RESHAPE($3,dummy_11)

! For Second Data Block in ASCII file
! Read File for Station = S2 and DataProduct/Dataset =D1
! Move Back to beginning of ASCII File


!...SKIP the first data block and read second one etc!

DEFINE axis/T/T0=1-jan-2001/UNIT=DAYS ttaxis_days_2=tstep_2[L=1:`nntime_2`]  !nntime_2 is also read from file and is NE nntime_1
LET dummy_2   = t[GT=ttaxis_days_2]
LET new_var_2 = RESHAPE($3,dummy_2)

! Now re-gridding second Time Series Variable new_var_2 to time axis ttaxis_days_1 (defined above)

DEFINE GRID/T=ttaxis_days_1 gttaxis_2
LET dummy_21  = t[G=gttaxis_2]
LET new_var_21 = RESHAPE($3,dummy_21)

list new_var_11, new_var_21

! Unfortunately, the above diagnostic shows identical values for new_var_11 and new_var_21...this is should not be the case

! Make the Time Series Plots as unconnected symbols with different colors

PLOT /NOLAB/THICKNESS=3/SIZE=0.2/SET new_var_11, new_var_21[g=gttaxis_1, gt=@asn]
PPL pen 1,2                   ! set pen 1 color to 2 (red)
PPL line 1,19,3               ! set line 1 to symbol #19, unconnected
PPL pen 2,3                   ! set pen 2 color to 3 (green)
PPL line 2,17,3               ! set line 2 to symbol #17, unconnected

! creat gif file
! Create a GIF file in local directory
SPAWN chmod ugo+rw "$2"


Thanks to any insights.

[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement