[ncl-talk] Specify latitude ticks

David Hebert david.hebert at nrlssc.navy.mil
Tue May 26 10:36:31 MDT 2015


I'm running  NCAR Command Language Version 6.2.1 on a Linux environment

In the attached plot I would like to display the Longitude on the Left 
and Bottom, and Latitude on the right. The plot only seems to show the 
longitude values and I can't find how to specify latitude.

Thank you for any suggestions. The NCL script that generated this is 
also attached.

David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot.png
Type: image/png
Size: 312650 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150526/87cf14be/attachment-0001.png 
-------------- next part --------------
; plot aice from history netcdf file
;===========================================================
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"
;===========================================================


begin

  ; --- set plot output type
  ptype = "png"
  ; ptype = "eps"
  
  ; --- set plot resources
  res             = True
  res at gsnDraw     = True
  res at gsnFrame    = True
  res at gsnMaximize = True
  res at gsnPaperOrientation = "portrait"

  res at mpProjection      = "Stereographic"
  res at gsnAddCyclic      = False
  
  ; res at mpGridAndLimbDrawOrder = "PreDraw"
  res at mpGridAndLimbOn   = True              ; turn on lat/lon lines
  res at mpPerimOn         = False             ; turn off box around plot
  res at pmTickMarkDisplayMode = "Always"      ; turn on ticks
  
  ; res at tmYROn = False
  ; res at tmXTOn = False
 
  ; res at pmTickMarkDisplayMode  = "Conditional"           ; turn on fancy tickmarks
  res at mpGridSpacingF = 10.
  ; res at mpGridLonSpacingF = 15.
  ; res at mpGridLatSpacingF = 10.

  res at mpDataBaseVersion    = "MediumRes"
  res at mpDataSetName        = "Earth..4"
  res at mpOutlineSpecifiers  = (/"Eurasia:States","North America:States"/)
  ; res at mpOutlineBoundarySets = "USStates"
  
  res at cnFillOn         = True                ; fill contours
  res at cnFillMode       = "RasterFill"        ; turn raster on   
  res at cnRasterSmoothingOn = True             ; smooth raster
  res at cnLinesOn        = False               ; turn off the contour lines
  res at cnLineLabelsOn   = False               ; turn off line labels 
  res at cnFillDrawOrder  = "Predraw"           ; draw contours first, then continents
  res at trGridType       = "TriangularMesh"

  res at cnLevelSelectionMode = "ManualLevels"  ; set manual contour levels
  res at gsnSpreadColors      = True            ; use full color range
  res at cnMinLevelValF       = 0.              ; set min contour level
  res at cnMaxLevelValF       = 100.            ; set max contour level
  ; res at cnLevelSpacingF      = 1.              ; set contour spacing
  res at cnLevelSpacingF      = 0.5              ; set contour spacing
  res at gsnSpreadColorStart  =  2              ; start at color 2
  res at gsnSpreadColorEnd    = -2              ; don't use added bw

  res at lbLabelBarOn         = True 
  ; res at lbTitleString        = "degC"
  res at lbLabelStride        = 20               ; set labelbar strides
  res at lbOrientation        = "vertical"
  ; res at lbOrientation        = "horizontal"
  res at lbBoxLinesOn         = False            ; turn off label bar box lines
  res at lbTitleFontHeightF   = 0.015
  res at gsnLeftString        = ""               ; remove long_name title
  res at gsnRightString       = ""               ; remove units title

  ; make filename
  cice_file = "003_cice_inst.2014-05-01-00000.nc"

  ; --- read data
  print("reading " + cice_file)
  f = addfile(cice_file,"r")
  
  ; read data
  aice = f->aice(0,:,:)  ; ice concentration (fraction, 0-1)
  tlat = f->TLAT(:,:)    ; lats
  tlon = f->TLON(:,:)    ; lons
    
  aice = 100.0 * aice                      ; scale by 100 to make percent  
  aice = mask(aice, (aice.le.0.0), False)  ; mask where less than 0
  aice at lat2d = tlat                        ; assign 2d lat
  aice at lon2d = tlon                        ; assign 2d lon
  
  ; get grid size of data
  dims2 = dimsizes(tlat)
  nj2 = dims2(0)
  ni2 = dims2(1)

  ; set map limits based on tlat,tlon
  res at mpLimitMode        = "Corners"
  res at mpLeftCornerLatF   = tlat(0,0)
  res at mpLeftCornerLonF   = tlon(0,0)
  res at mpRightCornerLatF  = tlat(nj2-1,ni2-1)
  res at mpRightCornerLonF  = tlon(nj2-1,ni2-1)
  
  res at mpRelativeCenterLon         = True                 ; set a center lon
  res at mpCenterLonF                = 210.0
  res at mpRelativeCenterLat         = True	         ; set a center lat
  res at mpCenterLatF                = 90.0      ; center lat
  ; res at tfDoNDCOverlay              = True                 ; do not transform data

  ; --- make the plot
  plotName = "myplot"
  print("plotting " + plotName + "." + ptype)
  
  cmap = "WhiteBlueGreenYellowRed"
  wks = gsn_open_wks(ptype,plotName)
  gsn_define_colormap(wks,cmap)       ; use colormap defined above
  
  res at mpLandFillColor  = "burlywood"
  res at tiMainString = "Ice Concentration"
  
  plot = gsn_csm_contour_map(wks,aice,res)
  
end


More information about the ncl-talk mailing list