[ncl-talk] X axis tick mark with Explicit Mode

Adam Phillips asphilli at ucar.edu
Wed Sep 11 10:14:28 MDT 2019


Hi Prasad,
Whenever you are trying to set explicit tickmarks and they disappear, then
it is likely that the domain of your set tm??Values is outside the
corresponding range of the data coordinate variable (in this case the
latitudes of your slice1 array). Try commenting out the resources that
start with res at tmXB*, and labels should appear (although they likely will
not be what you want). Once you see the range of the default tick mark
labels, that indicates what the range should be for your res at tmXBValues
resource.

If the above does not help please respond to ncl-talk with the output from
printVarSummary(slice1)
Adam





On Wed, Sep 11, 2019 at 12:30 AM Prasad Kunjeer via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Sir,
> I am using the following script to plot U wind from WRF output file. I am
> able to plot the figure, but the X-axis tick marks are not appearing. The
> script is follow
>
> 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/wrf/WRF_contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
>
> begin
>
>     fName = "/home/emsuser/Build_WRF/wrfprd/results/do3/t/do3.nc"
>     f = addfile(fName, "r")
>
>     U1           = f->U
>     U            = wrf_user_unstagger(U1,U1 at stagger)
>     lat          = f->XLAT(0,:,0)
>     lon          = f->XLONG(0,0,:)
>     znu          = f->ZNU(0,:) ; eta levels
>     lev          = znu*1000 ; [996.9073..5.045747]
>     Time         = chartostring( f->Times(:,:) )
>
>     U!1 = "lev"
>     lev at units= "hPa"
>     U!0 = "Time"
>     U!2 = "lat"
>     lat at units = "degree_north"
>     U!3 = "lon"
>     lon at units = "degree_east"
>
>     U&lev = lev
>     U&Time = Time
>     U&lat = lat
>     U&lon = lon
>
>     wgt   = (/ 1., 3., 4., 3., 1./)                  ; wgts for temporal
> smooth
>     wgt   = wgt/sum(wgt)                             ; normalize
>
>     lat2d          = f->XLAT(0,:,:)
>     lon2d          = f->XLONG(0,:,:)
>
>     slice         = U(lev|:,Time|:,lat|:,lon|:)      ; trick to copy meta
> data
>     slice1        = U(lev|:,Time|1,lat|84:234,lon|175)
>     printVarSummary(slice1)
>
>
>     wks = gsn_open_wks("png" ,"WRF_U_Wind_New_1")       ; open workstation
>
> ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ; Create resources for cross section(s)
> ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>    resx = True
>    resx at gsnMaximize          = True
>    resx at cnFillOn             = True            ; turn on color fill
>    resx at cnLinesOn            = False           ; turn lines on/off
>   ; True is default
>    resx at cnLineLabelsOn       = False           ; turn line labels on/off
>   ; True is default
>    resx at cnFillPalette        = "ncl_default"
>
>    nLabels                   = 8               ; arbitrary
>    resx at tmXBMode             = "Explicit"
>    resx at tmXBLabels           = new(nLabels,"string")
>    resx at tmXBValues           := toint(fspan(84,234,nLabels))
>    do i=0,nLabels-1
>        x = lon2d(resx at tmXBValues(i),176)
>        y = lat2d(resx at tmXBValues(i),176)
>        resx at tmXBLabels(i) = sprintf("%5.1f", y)+"~C~"+sprintf("%5.1f", x)
>        print(resx at tmXBLabels(i))
>    end do
>
>    plot  = gsn_csm_pres_hgt(wks, slice1, resx)
>
> end
>
> I have attached the plot for ready reference. Any help is highly
> appreciated.
>
> 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



-- 
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/20190911/689dfdbc/attachment.html>


More information about the ncl-talk mailing list