[Thread Prev][Thread Next][Index]

Re: Discontinuous time axis seen as continuous



Hi Patrick,
             It is a tricky business, still you can do it. Here is an
example i wrote earlier for my friend (see attachement, tax_4mon.jnl)
using the same monthly_navy_winds dataset. Also have a look at the 
sequence of mails starting with this one: 

http://ferret.pmel.noaa.gov/Ferret/Mail_Archives/fu_2004/msg00569.html

  If anything remains not explained, please let me know.

 Hope This Helps

 With Regards 

 Jaison 

On Thu, 6 Jan 2005, Patrick Brockmann wrote:

> Hi all,
> 
> Is there a way to plot only summer months from a time serie.
> 
> Let work from an usual example:
> 
> yes? use monthly_navy_winds.cdf
> ! Plot the all time serie
> yes? plot UWND[i=@ave,j=@ave]
> 
> Now I would like to plot only JUL-AUG-SEP months from years 1982 to 1992.
> JUL-1982; AUG-1982; SEP-1982; JUL-1983; AUG-1983; SEP-1983
> 
> Extract the selected months and save them into a file:
> 
> yes? save/file=extract.nc/clobber/bounds  
> UWND[i=@ave,j=@ave,l=`7+12*0`:`9+12*0`]
> yes? save/file=extract.nc/append/bounds  
> UWND[i=@ave,j=@ave,l=`7+12*1`:`9+12*1`]
> yes? save/file=extract.nc/append/bounds  
> UWND[i=@ave,j=@ave,l=`7+12*2`:`9+12*2`]
> yes? save/file=extract.nc/append/bounds  
> UWND[i=@ave,j=@ave,l=`7+12*3`:`9+12*3`]
> yes? save/file=extract.nc/append/bounds  
> UWND[i=@ave,j=@ave,l=`7+12*4`:`9+12*4`]
> 
> Have a look to the extracted file
> yes? use extract.nc
> yes? plot UWND
> 
> I get a correct plot with my selected months.
> But what could I do to remove graphically blanks between summer months ?
> I have done this using several viewports to plot each time a summer of a 
> specific year
> but it a little bit tricky. Is there a simpler solution ?
> 
> Thanks for any help on this topic
> 
> Happy new year to all
> 
> Patrick
> 

-- 
___________________________________________________

    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
___________________________________________________
\ cancel mode verify
!
! To plot data for four months (JJAS) without any breaks on time axis.
!-----------------------------------------------------------------------

! let us use monthly_navy_winds dataset (available with Ferret distribution)
!   this data starts from 16-JAN-1982 and ends at 17-DEC-1992 (monthly) : 11yrs

     set data   monthly_navy_winds   ! d=1

! get T0 & time units of the variable for later use
 
    define symbol tzero  = `uwnd[d=1],return=T0`
    define symbol tunits = `uwnd[d=1],return=TUNIT`

! get the "time values" of JJAS from 1982 to 1992 in a text file
!    since it is a monthly dataset we will use the mid-day of a month
!    for listing the "L" values

    sp rm -f dummy.dat
    REPEAT/RANGE=1982:1992/NAME=yr ( ;\
         let lindx = L[gt=uwnd,d=1,t="15-JUN-`yr`":"15-SEP-`yr`"] ;\
         let tdata = T[gt=uwnd,d=1,t="15-JUN-`yr`":"15-SEP-`yr`"] ;\
         list/nohead/quiet/file=dummy.dat/format=(2x,2(f11.3,4x))/append lindx, tdata ;\
       )

! read the time values from dummy.dat and then sample along the "L" values
!     11 yrs * 4 months = 44 "L" values

    cancel reg/all ; cancel var lindx, tdata
    
    define axis/t=1:44:1 tfile
    define grid/t=tfile  gfile    
    file/g=gfile/var=lindx, tdata dummy.dat   

    let uwnd_jjas = SAMPLEL(uwnd[d=1],lindx[d=2])   ! data for JJAS of 11 yrs
    set var/title="Seasonal(JJAS) Zonal Wind Speed"/units="M/S" uwnd_jjas

!now the uwnd_jjas's time axis will be an "abstract" one ..ie..1,2,3,..43,44.
!  If we regrid this variable to a proper calendar time axis, then while making
!  plots Ferret will display the full time axis (from JUN-1982 to SEP-1992) with
!  gaps in between for other months. So let us make the plot with this 
!  "abstract" time axis itself and then label manually for each year.
!
!  Now we have four months in a year. Please note that now the abstract time
!    is behaving like normal X/Y/Z axis..so all normal ppl commands are 
!    applicable
!              X-ax Y-ax 
    PPL AXLSZE 0.00,0.12  ! font size for axis numeric labels ( no label for X) 
    PPL AXLINT 1,1        ! which all tics should be labelled
    PPL AXNMTC 3,2        ! number of small tics between large tics on time axis

    plot/set/x=65/y=10/hlim=0:45:4 uwnd_jjas  ! note that hlim_lo NE  1 
                                              !   &       hlim_hi NE 44
    ppl xlab " "       ! to remove the time axis(ie. xaxis) label
    ppl plot

! now get proper labels for time axis

   let yaxlo       = `($PPL$YMIN1)` 
   let yoffset_yr  =  0.52   !tune this value to get year  label on position 
   let yoffset_mn  =  0.68   !tune this value to get month label on position 
   let yr_start    = 1982    !first year
   let num_yrs     = 11      !number of years
   let mnames      = TSEQUENCE({"J","J","A","S"})   ! month label "text"

   REPEAT/RANGE=1:`num_yrs`:1/NAME=yrs ( ;\  ! for 11 years
       label `(yrs-1)*4+2.0`,`yaxlo*yoffset_yr`,0,0,0.12,~`yr_start+yrs-1` ;\
       REPEAT/RANGE=1:4:1/NAME=mons ( ;\      ! for JJAS 
         define symbol mm = mnames[l=`mons`]                         ;\
         label `(yrs-1)*4+mons`,`yaxlo*yoffset_mn`,0,0,0.11, `($mm)` ;\
       ) ;\
    )
        
! restore defaults
  
     PPL AXLSZE 0.1, 0.1
     PPL AXLINT 2
     PPL AXNMTC 0

! remove unwated files

     sp rm -f dummy.dat

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement