[ncl-talk] Explicit YL tickmarks and labels not working with gsn_contour

Tabish Ansari tabishumaransari at gmail.com
Fri Feb 21 12:49:32 MST 2020


Hi

I am plotting a time series of vertical profiles of temperature using
gsn_contour, and want to explicitly label the Y-axis with pressure levels
(1000hPa up to 600hPa) but the Y-axis tickmarks and labels disappear on
setting it to explicit mode. Could you please point out what am I doing
wrong here?

Here's the script:






























































































*load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"load
"$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl";load
"/data1/tabish/nclscripts/cd_inv_string.ncl"load
"$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"load
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"load
"$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"begina =
addfile("/ichec/work/ngear013c/ERA5_t_1000-600hPa_27-30Jun2011.nc","r");READ
4D TEMPERATURE DATA FROM NC FILE. IT IS IN SHORT DATAYPE WITH SCALE FACTOR
AND OFFSET AS METADATAt = a->tprintVarSummary(t);READING MACE HEAD GRID
VERTICAL PROFILE FOR ALL TIMES AND CONVERTING TO FLOAT ALONG WITH SCALING
AND OFFSET USING SHORT2FLT FUNCTIONmh =
 short2flt(t(:,:,{53.3247},{360.0-9.9033})); mace head gridic =
 short2flt(t(:,:,{65},{360.0-30.0})); icelandic bloom source gridib =
 short2flt(t(:,:,{57},{360.0-26.0})); a grid in between the source and
receptorprint("TIME SERIES OF VERTICAL TEMPERATURE PROFILES AT THE 3 GRIDS
EXTRACTED SUCCESSFULLY!") printVarSummary(mh)mh_reorder =
mh(level|:,time|:)ic_reorder = ic(level|:,time|:)ib_reorder =
ib(level|:,time|:)mh_reverse = mh_reorder(::-1,:)         ; reverses 0th
dimension i.e. vert levelsic_reverse = ic_reorder(::-1,:)         ;
reverses 0th dimension i.e. vert levelsib_reverse = ib_reorder(::-1,:)
    ; reverses 0th dimension i.e. vert levelswks =
gsn_open_wks("x11","temperature_vertprofile_timeseries")    ; open a
workstationgsn_define_colormap(wks,"BlAqGrYeOrReVi200")  res = True
res at vpHeightF            = 0.20       ; height  res at gsnDraw             =
False           ; don't draw  res at gsnFrame            = False           ;
don't advance frame;MAKE EXPLICIT TICKMARKS FOR Y-AXIS TO SHOW PRESSURE
LEVELS  res at tmYLOn = True  res at tmYLMode          = "Explicit"    ; Define
own tick mark labels.  res at tmYROn = False  res at tmXTOn = False
res at tmYLValues        =
(/1000,975,950,925,900,875,850,825,800,775,750,700,650,600/)             ;
location of explicit labels  res at tmYLLabelsOn   = True  res at tmYLLabels
 =
(/"1000","975","950","925","900","875","850","825","800","775","750","700","650","600"/);--------------------------------------------------;
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.;--------------------------------------------------  restick
    = True  restick at ttmFormat = "%D/%N/%Y"  restick at ttmMajorStride= 24
restick at ttmMinorStride= 6  timearr = ispan (0,95,1)  timearr at units = "hours
since 2011-06-27 00:00:00"  time_axis_labels(timearr,res,restick)
res at trXMaxF=max(timearr)  res at tmXBLabelFontHeightF = 0.01
res at gsnSpreadColors          = True             ; use full range of colors
res at cnFillOn                 = True             ; turns on color fill
res at cnLevelSelectionMode     = "ManualLevels"   ; set levels manually
res at cnMinLevelValF           = 260  res at cnMaxLevelValF           = 280.
res at cnLevelSpacingF          = 2  res at cnLinesOn                = False
res at cnLineLabelsOn           = False  res at cnInfoLabelOn            =
Falseres at tiMainString             = ""plot1    =
gsn_contour(wks,mh_reverse,res)res at tiMainString             = ""plot2    =
gsn_contour(wks,ic_reverse,res)res at tiMainString             = ""plot3    =
gsn_contour(wks,ib_reverse,res);************************************************;
create panel;************************************************resP =
TrueresP at gsnPanelMainString = "Temperature profile evolution over 4
days"resP at gsnPanelYWhiteSpacePercent = 0.0resP at gsnPanelLabelBar    = True
             ; add common colorbarresP at lbLabelFontHeightF  = 0.007
      ; make labels
smallergsn_panel(wks,(/plot1,plot2,plot3/),(/3,1/),resP)             ; now
draw as one plotend*


Thanks a lot in advance!

Tabish



*Tabish U Ansari*

*Postdoctoral Researcher *

*Centre for Climate and Air Pollution Studies (C-CAPS)*
*School of Physics, NUI-Galway**, Ireland*
*ResearchGate: https://www.researchgate.net/profile/Tabish_Ansari
<https://www.researchgate.net/profile/Tabish_Ansari>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200221/032fb552/attachment.html>


More information about the ncl-talk mailing list