[ncl-talk] Polymarker on lon/lat grid

Vandhna Nair n.vandhna at gmail.com
Wed Oct 15 16:16:14 MDT 2014


Hi,

I have used gsn-coordinates to successfully draw a lon/lat grid over an
island.

However, when I am trying to mark a station location using gsn_polymarker,
the marker is placed elsewhere. I get the same result using
gsn_add_polymarker. There is no error message, script runs well - it's just
that the resultant image is not what I was trying to get.
Could you please let me know why this is happening, and how the problem can
be fixed?

My script is copied below, and the resultant image (plus data file) are
attached.

(NCL 6.1.0 on Ubuntu 12.0.4)

;--------------------------------------------------
; mapgrid_CCAM.ncl
;--------------------------------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin

  inFile="pr_Fiji_1980.nc" ; Read netCDF file

  a = addfile(inFile,"r")
  prc  = a->rnd(0,:,:)

  lat = a->lat
  lon = a->lon

  lon1 = 177.26
  lat1 = -17.45

;---Start the graphics.
  wks = gsn_open_wks("eps","Fijigrid")           ; open an eps file

  res               = True                        ; plot mods desired

  res at gsnDraw       = False                       ; don't draw yet
  res at gsnFrame      = False                       ; don't advance frame
  res at tiMainString  = "CCAM 8 km grid"            ; Title

  res at mpMinLonF            =  177.1               ; set maximum and minimum
lon lat values
  res at mpMaxLonF            =  178.9
  res at mpMinLatF            =  -18.4
  res at mpMaxLatF            =  -17.10

  mres = True                                      ; set marker resources
  mres at gsMarkerIndex = 16
  mres at gsMarkerColor = "red"

  res at pmTickMarkDisplayMode = "Always"            ;add tickmark labels

;---Create map (don't draw it yet)
  map = gsn_csm_map_ce(wks,res)

;---Add marker
  gsn_polymarker(wks,map,lon1,lat1,mres)

;---Call function to attach lat/lon lines.

  pres                   = True
  pres at gsnCoordsAsLines  = True        ; Default is points
  gsn_coordinates(wks,map,prc,pres)

end


Thanks,
Vandhna K.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141016/91f2bca8/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fijigrid.eps
Type: application/postscript
Size: 81376 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141016/91f2bca8/attachment-0001.eps 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr_Fiji_1980.nc
Type: application/x-netcdf
Size: 493264 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141016/91f2bca8/attachment-0001.nc 


More information about the ncl-talk mailing list