Re: plotting point symbol markers at select grid locations - with attachment

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 02 2013 - 17:22:59 MDT

Hi Claudia,
I think you are getting the error message because you are passing
latitude/longitude strings into gsn_add_polymarker when you are reading
1D latitude/longitude arrays in.

Change this:

jet_lon = str_get_field(data,22,delim)
jet_lat = str_get_field(data,23,delim)

to this:

jet_lon = stringtodouble(str_get_field(data,22,delim))
jet_lat = stringtodouble(str_get_field(data,23,delim))

If that does not solve the problem please let ncl-talk know.
Adam

On 03/18/2013 06:27 PM, Claudia Walters wrote:
> I am trying to plot symbol markers on a series of NARR grid cells based on their latitude/longitude coordinates, but I am getting an error message about an argument type mismatch. When I manually create 1-dimensional arrays for lat and lon, my script works, but when I read in two 1-dim arrays for lat, lon, I get an error message. Eventually, I would like to be able to vary the size of the symbol based on the jet speed. The attached data file only contains a portion of the original file (277x349 grid).
>
> Thanks,
> Claudia
>
>
>
> 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
>
> ;***********************************************************************
> ; read in data file
> ;***********************************************************************
> flnm = "2009032400ll.txt"
> head = readAsciiHead(flnm,1)
>
> data = asciiread(flnm,-1,"string")
> delim = " "
> nfields = str_fields_count(data, delim)
>
> jet_i = str_get_field(data,1,delim)
> jet_j = str_get_field(data,2,delim)
> jet_lon = str_get_field(data,22,delim)
> jet_lat = str_get_field(data,23,delim)
> u_wnd = str_get_field(data,9,delim)
> v_wnd = str_get_field(data,10,delim)
>
> dimi = dimsizes(jet_i)
> dimj = dimsizes(jet_j)
>
>
> ;***********************************************************************
> ; set parameters for plots
> ;***********************************************************************
>
> wks = gsn_open_wks ("x11", "narr")
> gsn_define_colormap (wks,"gui_default")
>
> res = True
> res@cnFillOn = True
> res@cnFillOpacityF = 0.3
> res@cnLinesOn = True
> res@cnMonoLineColor = False
> res@gsnSpreadColors = True
> res@gsnSpreadColorStart = 4
> res@gsnSpreadColorEnd = -1
> res@mpGridAndLimbOn = False
> res@pmTickMarkDisplayMode = "Always" ;
> res@tmXTOn = False
> res@gsnAddCyclic = False
> res@gsnDraw = False
> res@gsnFrame = False
> res@mpLimitMode = "LatLon"
> res@mpMinLatF = 25.
> res@mpMaxLatF = 50.
> res@mpMinLonF = -125.
> res@mpMaxLonF = -75.
> res@mpDataSetName = "Earth..4"
> res@mpDataBaseVersion = "Ncarg4_1"
> res@mpOutlineBoundarySets = "USStates"
> res@mpOutlineSpecifiers = "Canada"
> res@mpOutlineSpecifiers = "Mexico"
> res@tfDoNDCOverlay = True
> res@mpProjection = "LambertConformal"
> res@mpLambertParallel1F = lat2d@mpLambertParallel1F
> res@mpLambertParallel2F = lat2d@mpLambertParallel2F
> res@mpLambertMeridianF = -100
> res@gsnCenterString = " "
> res@gsnLeftString = "NARR LLJ locations"
>
> ;***********************************************************************
> ; set plotting parameters for points, plot points
> ;***********************************************************************
> polyres = True
> polyres@gsMarkerIndex = 16
> polyres@gsMarkerSizeF = 5.
>
> ;plot = gsn_csm_contour_map(wks,msl,res)
>
> points = new(dimi,graphic)
>
> do i=0,dimi-1
> points(i) = gsn_add_polymarker(wks,plot,jet_lon(i),jet_lat(i),polyres)
> 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 Tue Apr 2 17:23:09 2013

This archive was generated by hypermail 2.1.8 : Tue Apr 02 2013 - 21:23:48 MDT