Re: Using gsn_polymarker to plot transect

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 03 2013 - 16:04:33 MDT

Hi Sean,
I think you have your lat/lon inputs flipped. Change this:
gsn_polymarker(wks,plot,lat(k,j),lon(k,j),resp)
to this:
gsn_polymarker(wks,plot,lon(k,j),lat(k,j),resp)*
*Adam*

*
On 04/03/2013 04:00 PM, Sean Egan wrote:
> 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
> <http://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 <mailto:res@gsnMaximize> = False
> res@gsnDraw <mailto:res@gsnDraw> = False
> res@gsnFrame <mailto:res@gsnFrame> = False
> res@tfDoNDCOverlay <mailto:res@tfDoNDCOverlay> = True
> res@cnFillOn <mailto:res@cnFillOn> = True
> res@cnLinesOn <mailto:res@cnLinesOn> = True
> res@lbLabelBarOn <mailto:res@lbLabelBarOn> = False
> res@pmTickMarkDisplayMode <mailto:res@pmTickMarkDisplayMode> = "Always"
> res@tiMainOn <mailto:res@tiMainOn> = False
> res@mpProjection <mailto:res@mpProjection> = "LambertConformal"
> res@mpLimitMode <mailto:res@mpLimitMode> = "Corners"
> res@mpLeftCornerLatF <mailto:res@mpLeftCornerLatF> = lat(0,0)
> res@mpLeftCornerLonF <mailto:res@mpLeftCornerLonF> = lon(0,0)
> res@mpRightCornerLatF <mailto:res@mpRightCornerLatF> = lat(nlat-1,nlon-1)
> res@mpRightCornerLonF <mailto:res@mpRightCornerLonF> = lon(nlat-1,nlon-1)
> res@mpLambertParallel1F <mailto:res@mpLambertParallel1F> = a@TRUELAT1
> <mailto:a@TRUELAT1>
> res@mpLambertParallel2F <mailto:res@mpLambertParallel2F> = a@TRUELAT2
> <mailto:a@TRUELAT2>
> res@mpLambertMeridianF <mailto:res@mpLambertMeridianF> = a@STAND_LON
> <mailto:a@STAND_LON>
> res@mpDataBaseVersion <mailto:res@mpDataBaseVersion> = "MediumRes"
> res@mpOutlineBoundarySets <mailto:res@mpOutlineBoundarySets> =
> "GeophysicalAndUSStates"
> res@mpFillOn <mailto:res@mpFillOn> = False
> res@mpOutlineOn <mailto:res@mpOutlineOn> = True
> resp = True
> resp@gsMarkerIndex=16 <mailto:resp@gsMarkerIndex=16>
> resp@gsMarkerSizeF=4.0 <mailto:resp@gsMarkerSizeF=4.0>
> colors = (/"red"/)
> resp@gsMarkerColor=colors <mailto: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

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli

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

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