[ncl-talk] WRF Time labels - repost

Prasad Kunjeer pskunjeer at gmail.com
Thu Oct 3 03:16:46 MDT 2019


SIr,

The outputs of:


*printVarSummary(restime) is*











*Variable: restimeType: logicalTotal Size: 4 bytes            1
valuesNumber of Dimensions: 1Dimensions and sizes: [1]Coordinates: Number
Of Attributes: 4  tmXBMode : Explicit  tmXBValues : (    0,   18,   36,
54,   72 )  tmXBMinorValues : <ARRAY of 25 elements>  tmXBLabels : ( 09/22
12:00, 09/23 06:00, 09/24 00:00, 09/24 18:00, 09/25 12:00 )*


*printVarSummary(ua(:,:,100,100)) is *













*Type: floatTotal Size: 3200 bytes            800 valuesNumber of
Dimensions: 2Dimensions and sizes: [Time | 25] x [bottom_top |
32]Coordinates: Number Of Attributes: 6  FieldType : 104  MemoryOrder :
XYZ  description : x-wind component  units : m s-1  stagger :   coordinates
: XLONG XLAT*

In restime it is showing labels from  09/22 12:00, 09/23 06:00, 09/24
00:00, 09/24 18:00, 09/25 12:00 but during plotting it is not showing the
same.

Regards
प्रसाद कुंजीर/ Prasad Kunjeer
वैज्ञानिक - सी / Scientist - C
केन्द्रीय जल और विद्युत अनुसंधान शाला / Central Water and Power Research
Station
पुणे 411 024/ Pune 411 024


On Wed, Oct 2, 2019 at 11:09 PM Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Prasad,
> Can you send ncl-talk the output from the following printVarSummary call:
> time_axis_labels(Time_0,restime,restick)
> *printVarSummary(restime)*
> *printVarSummary(ua(:,:,100,100))*
> contour_vor  = wrf_contour(sfile,wks,ua(:,:,100,100),restime)
> Adam
>
>
> On Wed, Oct 2, 2019 at 9:43 AM Prasad Kunjeer via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Sorry I just forgot to attach the file.
>>
>> On Wed, Oct 2, 2019, 9:04 PM Prasad Kunjeer <pskunjeer at gmail.com> 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.
>>>
>>> The time interval for WRF file is 3 hour and there are 25 time steps.
>>> The first time steps is 22/09/2018 1200. The time should start from
>>> 22/09/2018 and end at 25/09/2018 with 25 time steps (22/09/2018 1200,
>>> 22/09/2018 1500 etc upto 25/09/2018  1200).  But the graph ends at
>>> 23/09/2018 1200 which correspond to 25 time steps at 1 hour interval. I
>>> want graph to end at 25/09/2018 1200.
>>>
>>> Please guide in correcting the output of graph
>>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191003/a5e53674/attachment.html>


More information about the ncl-talk mailing list