[ncl-talk] Issue with Latitude-Time Plot

Adam Phillips asphilli at ucar.edu
Wed Aug 29 23:18:04 MDT 2018


Hi Amit,
I see the problem. If you want to correctly control the tickmarks and their
labels, the range of coordinate variables of sdemo (time and lat) need to
match the range of the inputs to tmXBValues (and tmYLValues).
Your time varies between [9159840..9334080].

Thus the following should work:
 res at tmXBMode = "Explicit"
 res at tmXBValues = sdemo&time(0::5)    ; label every 5th time
 res at tmXBLabels = ispan(1,115,5)
 res at tmXBMinorValues = sdemo&time   ; minor tickmarks at every time

The above takes into account that your times might not be equally spaced.
If your times are not equally spaced, and you want the times to be equally
spaced from 1-115, you could do the following:
delete(sdemo&time)
sdemo&time = ispan(1,115,1)
 res at tmXBMode = "Explicit"
res at tmXBValues = sdemo&time(0::5)    ; label every 5th time
res at tmXBLabels = ispan(1,115,5)
res at tmXBMinorValues =  ispan(1,115,1)

Hopefully that solves the issue. If not, let ncl-talk know.
Adam


On Wed, Aug 29, 2018 at 10:28 PM Amit Kumar <amitkumar.777 at hotmail.com>
wrote:

> Hi Adam,
>
>
> After using these explicit values, no tickmark is getting printed on the
> plot.
>
>
> I'm attaching my current resource list, by using this I'm getting
> tickmarks on plot, but all are major tickmarks. No minor tickmark is
> getting ploted.
>
>
>
> #***************************************************************************************************************************************#
>
> var   = a->OLR_DLY
>   dimz = dimsizes(var)
> print(dimz)
> lat   =  a->lat
>   lon   =  a->lon
>   time  =  a->time
>
>  lon100E  = ind(lon.eq.100.)                           ; subscript at 90E
>  latS      = -20.
>  latN      =  40.
>  shov      = var(lon|lon100E:lon100E,{lat|latS:latN},time|:)
>  dims      = dimsizes(shov)                   ; shov=3D array=(1,31,127)
>  print(dims)
>  sdemo     = onedtond(ndtooned(shov), (/dims(1),dims(2)/) )
>  sdemo!0   = "lat"
>  sdemo!1   = "time"
>  sdemo&lat = lat({lat|latS:latN})
>  sdemo&time= time
>
>  sdemo = smth9 (sdemo,0.5, 0.25, False)               ; 2D smoother
>
>  gtPat = 17                                           ; stiple
>  ltPat = 3                                            ; hatch
>
> ;*************************
>
> ; plotting parameters
> ;*************************
>  wks   = gsn_open_wks ("png", "Monsoon_2017_lat_time_100_13" ) ; send
> graphics to PNG file
>  res                  = True               ; plot mods desired
>  res at gsnDraw          = False              ; don't draw yet
>  res at gsnFrame         = False              ; don't advance frame yet
>  res at gsnMaximize          = True     ; maximize plot in frame
>
>  res at tiMainString     = "Daily OLR variation at 100E" ; title
>
>  res at vpXF             = 0.12               ; default is 0.2 change aspect
>  res at vpYF             = 0.8                ; default is 0.8 ration
>  res at vpHeightF        = 0.4                ; default is 0.6
>  res at vpWidthF         = 0.8                ; default is 0.6
>
>  res at cnLevelSelectionMode = "ManualLevels" ; manual levels
>  res at cnMinLevelValF       = 150.            ; min level
>  res at cnMaxLevelValF       =  330.            ; max level
>  res at cnLevelSpacingF      =  10           ; contour spacing
>
>  res at cnFillOn         = True                ; color on
>  res at lbLabelStride    = 4                   ; every other label
>  res at lbOrientation    = "Horizontal"          ; vertical label bar
>  res at pmLabelBarOrthogonalPosF = -0.04       ; move label bar closer to
> axis
>  res at cnLinesOn        = False               ; turn off contour lines
>  res at cnFillPalette    = "GMT_wysiwyg"    ; set color map
>
>   res at tmYROn = False            ; Turn off right tickmarks.
>   res at tmXTOn = False            ; Turn off top tickmarks.
>
>  res at tmXBMode = "Explicit"
>  res at tmXBValues = var&time
>  res at tmXBLabels = ispan(0,115,1)
>  res at tmXBLabelFontHeightF =  0.01
>  res at tmXBMinorValues = ispan(0,115,1)
>  res at tmXBLabelStride = 10
>
>
> ;res at tmXBMinorOn = True
>  ;res at tmXBMinorLengthF = 0.1
> ;res at tmXBLabels      = "" + res at tmXBValues
>  ;res at tmXBMinorValues = ispan(1,115,1)
>  ;res at tmXBLabels
> =(/"1","10","20","30","40","50","60","70","80","90","100","110","116"/)
>  ;res at trXMinF = 0            ; Set minimum X-axis value.
>  ;res at trXMaxF = 116            ; Set maximum X-axis value.
>
>  ;res at tmXBMode = "Explicit"
>  ;res at tmXBValues = (/1,10,20,30,40,50,60,70,80,90,100,110/)
>  ;res at tmXBLabels = res at tmXBValues
>  ;res at tmXBLabelFontHeightF =  0.01
>  ;res at tmXBMinorValues = ispan(1,114,1)
>
>  plot = gsn_csm_lat_time(wks, sdemo, res )
>
> Regards
>
> Amit
>
> ------------------------------
> *From:* Adam Phillips <asphilli at ucar.edu>
> *Sent:* Thursday, August 30, 2018 2:22 AM
> *To:* Amit Kumar
> *Cc:* Ncl-talk; Rick Brownrigg
> *Subject:* Re: [ncl-talk] Issue with Latitude-Time Plot
>
> Hi Amit,
> Can you send your complete resource list that you are using?
> Slight correction to what I sent earlier:
>  res at tmXBMode = "Explicit"
>  res at tmXBValues = (/1,10,20,30,40,50,60,70,80,90,100,110/)
>  res at tmXBLabels = res at tmXBValues
>  res at tmXBLabelFontHeightF =  0.01
>  res at tmXBMinorValues = ispan(1,114,1)
>
> Your data runs through 114 on the x-axis. If you want to set the tickmarks
> like this:
> res at tmXBValues      = (/1,10,20,30,40,50,60,70,80,90,100,110,120/)
> and draw the 120 label, you will also need to set res at trXMaxF = 120
> Adam
>
>
>
> On Tue, Aug 28, 2018 at 10:23 PM Amit Kumar <amitkumar.777 at hotmail.com>
> wrote:
>
> Hi Adam,
>
>
> Still the tickmarks are of same height (Plot attached).
>
> Also when in explicit mode I'm giving res at tmXBValues      =
> (/1,10,20,30,40,50,60,70,80,90,100,110,120/), then also it is giving me
> error that x axis data out of range, going to default.
>
>
> However, when I'm plotting for only 30 days, I'm getting the desired plot
> (attached), that too without using any tickmark resources i.e. res at tm as
> you can see in the script attached in 1st message.
>
>
> Regards
>
> Amit
>
>
> ------------------------------
> *From:* Adam Phillips <asphilli at ucar.edu>
> *Sent:* Tuesday, August 28, 2018 10:02 PM
> *To:* Amit Kumar
> *Cc:* Rick Brownrigg; Ncl-talk
> *Subject:* Re: [ncl-talk] Issue with Latitude-Time Plot
>
> Hi Amit,
> Try this:
>  res at tmXBMode = "Explicit"
>  res at tmXBValues = var&time
>  res at tmXBLabels = ispan(0,115,5)
>  res at tmXBLabelFontHeightF =  0.01
>  res at tmXBMinorValues = ispan(0,115,1)
> Adam
>
> On Tue, Aug 28, 2018 at 8:26 AM Amit Kumar <amitkumar.777 at hotmail.com>
> wrote:
>
> Dear All,
>
> When I'm following as mentioned in example 2, then no labels are getting
> printed on x axis.
>
> Regards
> Amit
>
>
>
> Get Outlook for Android <https://aka.ms/ghei36>
>
> ------------------------------
> *From:* Rick Brownrigg <brownrig at ucar.edu>
> *Sent:* Tuesday, August 28, 2018 6:23:43 PM
> *To:* Amit Kumar
> *Subject:* Re: [ncl-talk] Issue with Latitude-Time Plot
>
> You might look at "*tmXBMinorValues* " at
>
> http://ncl.ucar.edu/Document/Graphics/Resources/tm.shtml
>
> and example #2 at
>
> http://ncl.ucar.edu/Applications/tickmarks.shtml
>
> for dealing with minor tickmarks when using tmXBMode = "Explicit"
>
> On Tue, Aug 28, 2018 at 12:37 AM, Amit Kumar <amitkumar.777 at hotmail.com>
> wrote:
>
> Hi All,
>
>
> I've made following changes as suggested by Adam in the script,
>
>
>  res at tmXBMode = "Explicit"
>  res at tmXBValues = var&time
>  res at tmXBLabels = ispan(0,115,1)
>  res at tmXBLabelFontHeightF =  0.01
>  res at tmXBLabelStride = 10
>
> Now as it can be seen from the image that all the labels are major labels,
> is there a way to define all other tickmarks except for which label is
> mentioned as minor tickmarks.
>
>
> Regards
>
> Amit
>
>
> ------------------------------
> *From:* Adam Phillips <asphilli at ucar.edu>
> *Sent:* Monday, August 27, 2018 9:51 PM
> *To:* Amit Kumar
> *Cc:* Rick Brownrigg; Ncl-talk
> *Subject:* Re: [ncl-talk] Issue with Latitude-Time Plot
>
> Hi Amit,
> You can override the behavior of the bottom x-axis tick mark labels by
> setting:
> res at tmXBMode = "Explicit"
> res at tmXBValues = OLR_DAY&time
> res at tmXBLabels = ispan(1,115,1)
>
> See tickmarks example #2 here (bottom panel coding):
> http://www.ncl.ucar.edu/Applications/tickmarks.shtml#ex2
> Tick marks - University Corporation for Atmospheric Research
> <http://www.ncl.ucar.edu/Applications/tickmarks.shtml#ex2>
> www.ncl.ucar.edu
> NCL graphics examples page. Describes various tick mark resources and ways
> to manage the tick marks.
>
>
> If you have further questions please post them to ncl-talk.
> Adam
>
> On Mon, Aug 27, 2018 at 9:51 AM Amit Kumar <amitkumar.777 at hotmail.com>
> wrote:
>
> Dear Rick,
>
> Actually these 115 time stamps are for each day. I have concatenated to
> these individual days into one using cdo. I want to plot time at x axis
> which will vary from 1 to 115 indicating each day, so that the plot can be
> ploted as latitude vs time  and variation of olr can be seen over latitude
> and time . It is on the same lines as the example for sst anamoly in
> latitude vs time section in ncl examples.
>
> Regards
> Amit
>
>
>
>
> Get Outlook for Android <https://aka.ms/ghei36>
>
> ------------------------------
> *From:* Rick Brownrigg <brownrig at ucar.edu>
> *Sent:* Monday, August 27, 2018 8:47:24 PM
> *To:* Amit Kumar
> *Subject:* Re: [ncl-talk] Issue with Latitude-Time Plot
>
> Hi Amit,
>
> Offhand, given the time variable's coordinate range:
>
> Variable: time
>     Type: double
>     Total Size: 115 values
>                 920 bytes
>     Number of Dimensions: 1
>     Dimensions and sizes:       [ 115 <time | unlimited> ]
>     Chunking Info:      [ 524288 <time> ]
>     Coordinates:
>                 time: [9159840..9334080]
>
> I'd the plot looks about what I'd expect. In what way do you think the
> time values are incorrect?
>
> Rick
>
>
> On Mon, Aug 27, 2018 at 6:02 AM, Amit Kumar <amitkumar.777 at hotmail.com>
> wrote:
>
> Dear All,
>
>
> I'm trying to plot Latitude vs Time Plot. It is working fine when I've 30
> time instances, but for greater then that (i.e. 115 time steps) the plot is
> sowing different values in x-axis (time).
>
>
> I'm not able to workout why this is happening? I'm attaching the output
> and my ncl script.
>
>
>
> ==================================================================================================
>
>
>   var   = a->OLR_DLY
>   dims = dimsizes(var)
> print(dims)
> lat   =  a->lat
>   lon   =  a->lon
>   time  =  a->time
>
>  lon100E  = ind(lon.eq.100.)                           ; subscript at 90E
>  latS      = -20.
>  latN      =  40.
>  shov      = var(lon|lon100E:lon100E,{lat|latS:latN},time|:)
>  dims      = dimsizes(shov)                   ; shov=3D array=(1,31,127)
>  sdemo     = onedtond(ndtooned(shov), (/dims(1),dims(2)/) )
>  sdemo!0   = "lat"
>  sdemo!1   = "time"
>  sdemo&lat = lat({lat|latS:latN})
>  sdemo&time= time
>
>  sdemo = smth9 (sdemo,0.5, 0.25, False)               ; 2D smoother
>
>  gtPat = 17                                           ; stiple
>  ltPat = 3                                            ; hatch
> ;*************************
> ; plotting parameters
> ;*************************
>  wks   = gsn_open_wks ("png", "Monsoon_2017_lat_time_100_1" ) ; send
> graphics to PNG file
>  res                  = True               ; plot mods desired
>  res at gsnDraw          = False              ; don't draw yet
>  res at gsnFrame         = False              ; don't advance frame yet
>
>  res at tiMainString     = "Daily OLR variation at 100E" ; title
>
>  res at vpXF             = 0.12               ; default is 0.2 change aspect
>  res at vpYF             = 0.8                ; default is 0.8 ration
>  res at vpHeightF        = 0.4                ; default is 0.6
>  res at vpWidthF         = 0.8                ; default is 0.6
>
>  res at cnLevelSelectionMode = "ManualLevels" ; manual levels
>  res at cnMinLevelValF       = 150.            ; min level
>  res at cnMaxLevelValF       =  330.            ; max level
>  res at cnLevelSpacingF      =  10           ; contour spacing
>
>  res at cnFillOn         = True                ; color on
>  res at lbLabelStride    = 4                   ; every other label
>  res at lbOrientation    = "Horizontal"          ; vertical label bar
>  res at pmLabelBarOrthogonalPosF = -0.04       ; move label bar closer to
> axis
>  res at cnLinesOn        = False               ; turn off contour lines
>  res at cnFillPalette    = "GMT_wysiwyg"    ; set color map
>
>
>  plot = gsn_csm_lat_time(wks, sdemo, res )
>  ;opt  = True
>  ;opt at gsnShadeFillType = "pattern"
>  ;opt at gsnShadeLow      = ltPat
>  ;opt at gsnShadeHigh     = gtPat
>  ;plot = gsn_contour_shade(plot, -0.69, 0.25, opt)
>  ;plot = ZeroLineContour (plot)
>  draw (plot)                                ; draw the contour object
>  frame (wks)                                ; advance frame
> end
>
> ==================================================================================================
> %%%%%%%%%%%%%%%%%%%
> ################################
>
> dimensions:
>     lon = 1400
>     lat = 1400
>     time        = 115 // unlimited
>
> chunk dimensions:
>     lon = 1400
>
> variables:
>     Variable: lon
>     Type: double
>     Total Size: 1400 values
>                 11200 bytes
>     Number of Dimensions: 1
>     Dimensions and sizes:       [ 1400 <lon> ]
>     Coordinates:
>                 lon: [40..109.95]
>         Number of Attributes:        4
>             standard_name       :       longitude
>             long_name   :       longitude
>             units       :       degrees_east
>             axis        :       X
>
>     Variable: lat
>     Type: double
>     Total Size: 1400 values
>                 11200 bytes
>     Number of Dimensions: 1
>     Dimensions and sizes:       [ 1400 <lat> ]
>     Coordinates:
>                 lat: [-20..49.95]
>         Number of Attributes:        4
>             standard_name       :       latitude
>             long_name   :       latitude
>             units       :       degrees_north
>             axis        :       Y
>
>     Variable: time
>     Type: double
>     Total Size: 115 values
>                 920 bytes
>     Number of Dimensions: 1
>     Dimensions and sizes:       [ 115 <time | unlimited> ]
>     Chunking Info:      [ 524288 <time> ]
>     Coordinates:
>                 time: [9159840..9334080]
>         Number of Attributes:        4
>             standard_name       :       time
>             units       :       minutes since 2000-1-1 00:00:00
>             calendar    :       standard
>             axis        :       T
>
>     Variable: OLR_DLY
>     Type: float
>     Total Size: 225400000 values
>                 901600000 bytes
>     Number of Dimensions: 3
>     Dimensions and sizes:       [ 115 <time | unlimited> x 1400 <lat> x
> 1400 <lon> ]
>     Chunking Info:      [ 1 <time> x 1 <lat> x 1400 <lon> ]
>     Coordinates:
>                 time: [9159840..9334080]
>                 lat: [-20..49.95]
>                 lon: [40..109.95]
>         Number of Attributes:        5
>             standard_name       :       Outgoing Longwave Radiation
>             long_name   :       Out Longwave Radiation(Daily)
>             units       :       W.m-2
>             _FillValue  :       -999
>             missing_value       :       -999
>
>
> ########################################
>
> Thanks in advance.
>
> Regards
> Amit
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> _______________________________________________
> 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>
>
>
> _______________________________________________
> 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>
>
>
>
> --
> 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>
>


-- 
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/20180829/8ad0b42a/attachment.html>


More information about the ncl-talk mailing list