[ncl-talk] Time Labels -

Rick Brownrigg brownrig at ucar.edu
Thu Sep 26 11:53:20 MDT 2019


Hi,

I am confused by your question/issue:  the plot shows two time labels, 9/22
12:00  and 9/23 6:00, which would appear to be a 12 hour interval labelling
-- I don't understand your comment "...the output takes 1 hour interval
rather than 3 hour interval."

Rick


On Thu, Sep 26, 2019 at 9:19 AM Prasad Kunjeer via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Sir,
>
> I am trying to plot a simple graph from a WRF output. The X axis of the
> plot is time  and i want to print the time table for the same. I am using
> the function 'time_axis_labels'. I have attached the script:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ; This file still has to be loaded manually
> load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
>
>     srcDirName  = "/home/prasad/res/"
>     srcFileName = "newdo3.nc"
>     srcFilePath =  srcDirName + srcFileName
> ;---Retrieve either one level, or all levels. Use '-1' for all.
>     sfile = addfile(srcFilePath,"r")
>
>     ua   = wrf_user_getvar(sfile,"ua",-1)    ; On mass grid
>     va   = wrf_user_getvar(sfile,"va",-1)
>     printVarSummary(ua)                      ;
> (Time,bottom_top,south_north,west_east)
>     printVarSummary(va)                      ;
> (Time,bottom_top,south_north,west_east)
>
>     Times        = sfile->Times
>     Time_0       = wrf_times_c(Times, 0)
>
>     printVarSummary(Times)
>     printVarSummary(Time_0)
>     print(Time_0)
>
>     wks = gsn_open_wks("png","time_labels") ; send graphics to PNG file
> ;--------------------------------------------------
> ; The time_axis_label function adds additional
> ; resources to "res" to produce nicely-formatted
> ; time labels on X axis. This function only works
> ; if you have a time "units" recognized by the
> ; cd_calendar function.
> ;--------------------------------------------------
>   pltres = True
>   restime           = True
>   restick           = True
>   restick at ttmFormat = "%N/%D %H:%M"
>   time_axis_labels(Time_0,restime,restick)
>
>   contour_vor  = wrf_contour(sfile,wks,ua(:,:,100,100),restime)
>   plot = wrf_overlays(sfile,wks,(/contour_vor/),pltres)
>
>
> The WRF file contains the 25 time steps at 3 hour interval. I have
> attached the output of printvarSummary and print of the time varibale.
>
> Variable: Time_0
> Type: double
> Total Size: 200 bytes
>             25 values
> Number of Dimensions: 1
> Dimensions and sizes: [Time | 25]
> Coordinates:
>             Time: [   0..  72]
> Number Of Attributes: 4
>   units : hours since 2018-09-22 12:00:00
>   calendar : standard
>   long_name : Time
>   description : Time
>
> Variable: Time_0
> Type: double
> Total Size: 200 bytes
>             25 values
> Number of Dimensions: 1
> Dimensions and sizes: [Time | 25]
> Coordinates:
>             Time: [   0..  72]
> Number Of Attributes: 4
>   units : hours since 2018-09-22 12:00:00
>   calendar : standard
>   long_name : Time
>   description : Time
> (0)   0
> (1)   3
> (2)   6
> (3)   9
> (4)  12 etc.
>
> But when I plot the figure, the output takes 1 hour interval rather than 3
> hour interval.
>
> Please guide in correcting the output of graph
>
> Regards
> प्रसाद कुंजीर / Prasad Kunjeer
> वैज्ञानिक - सी / Scientist - C
> केन्द्रीय जल और विद्युत अनुसंधान शाला / Central Water and Power Research
> Station
> पुणे 411 024/ Pune 411 024
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190926/4910784c/attachment.html>


More information about the ncl-talk mailing list