Using gsn_polymarker to plot transect

From: Sean Egan <sdegan_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 03 2013 - 16:00:51 MDT

Hi NCL Community,

I want to plot a contour of heights from my WRF data and then plot a line
on the map at 145W. I'm using gsn_polymarker for this purpose, drawing a
polymarker when the longitude is between -145.5 and 144.5. My code is shown
below. When I try to use gsn_polymarker, the plot gets drawn, but the
polymarkers do not. I think I'm implementing it wrong, here. Does anyone
have any ideas as to how I could fix it?

Thanks!

Sean Egan

---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------

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/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
; Specify input file
  a = addfile("wrfout_d01_2008-08-15_00:00:00.nc","r") ; Open the next
file
; type = "x11"
  type = "pdf"
  wks = gsn_open_wks(type,"transect2")
  times = wrf_user_list_times(a) ; get times in the file
  ntimes = dimsizes(times) ; number of times in the file
  timesc = chartostring(a->Times)
  it = 0; select time
  print("Working on time: " + timesc(it) )
  lat = a->XLAT(it,:,:)
  lon = a->XLONG(it,:,:)
  dims = dimsizes(lat)
  nlat = dims(0)
  nlon = dims(1)
  hgt = wrf_user_getvar(a,"HGT",0)
  gsn_define_colormap(wks,"OceanLakeLandSnow")
  res = True
  res@gsnMaximize = False
  res@gsnDraw = False
  res@gsnFrame = False
  res@tfDoNDCOverlay = True
  res@cnFillOn = True
  res@cnLinesOn = True
  res@lbLabelBarOn = False
  res@pmTickMarkDisplayMode = "Always"
  res@tiMainOn = False
  res@mpProjection = "LambertConformal"
  res@mpLimitMode = "Corners"
  res@mpLeftCornerLatF = lat(0,0)
  res@mpLeftCornerLonF = lon(0,0)
  res@mpRightCornerLatF = lat(nlat-1,nlon-1)
  res@mpRightCornerLonF = lon(nlat-1,nlon-1)
  res@mpLambertParallel1F = a@TRUELAT1
  res@mpLambertParallel2F = a@TRUELAT2
  res@mpLambertMeridianF = a@STAND_LON
  res@mpDataBaseVersion = "MediumRes"
  res@mpOutlineBoundarySets = "GeophysicalAndUSStates"
  res@mpFillOn = False
  res@mpOutlineOn = True
  resp = True
  resp@gsMarkerIndex=16
  resp@gsMarkerSizeF=4.0
  colors = (/"red"/)
  resp@gsMarkerColor=colors
  plot = gsn_csm_contour_map(wks,hgt,res)
  j=0
  k=0
  l=0
  lons=dimsizes(lon)
  dum = new(600,graphic)
  do j=0,(lons(1)-1)
    do k=0,(lons(0)-1)
      if (lon(k,j).gt.-145.5) then
        if (lon(k,j).lt.-144.5) then
         * gsn_polymarker(wks,plot,lat(k,j),lon(k,j),resp)
* l=l+1
        end if
      end if
      k=k+1
    end do
  j=j+1
  end do
draw(plot)
frame(wks)
end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Apr 3 16:01:19 2013

This archive was generated by hypermail 2.1.8 : Thu Apr 04 2013 - 21:06:41 MDT