Re: gsn_polymarker error

From: Michael Notaro <mnotaro_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 24 2011 - 08:39:03 MDT

Katie,

str_get_field will give you string values for latp and lonp.

Then you tried to give those string values to gsn_polymarker
for lat / lons. But gsn_polymarker will want float.

Try using stringtofloat to convert latp and lonp to float values
and then provide those float values to gsn_polymarker.

See you next week!

Michael

On Jun 24, 2011, at 8:55 AM, Katie Holman wrote:

> Dear All,
>
> I am trying to write a script that plots a polymarker at specific observation locations. I have lat/lon data for each station. I have been trying to implement various forms of the gsn_polymarker example code, with the same resulting error. The error and script are shown below. Does anyone have any idea what could be causing this?
>
> Thank you,
> Katie
>
> ;; TERMINAL OUTPUT (including ERROR message)
>
> Variable: latp (subsection)
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) 46.82
>
> Variable: lonp (subsection)
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) -87.75
>
> fatal:Argument type mismatch on argument (2) of (gsn_polymarker) can not coerce
> fatal:Execute: Error occurred at or near line 61 in file plot_station_locations.ncl
>
> ;; CODE
>
> wks = gsn_open_wks("ps","test_poly")
>
> res = True
> res@mpMinLatF = 40.
> res@mpMaxLatF = 52.
> res@mpMinLonF = -95.
> res@mpMaxLonF = -80.
>
> res@gsnDraw = False
> res@gsnFrame = False
>
> map = gsn_csm_map(wks,res) ; (I have also tried plotting a contour map of a different variable, which produced the same error)
>
> data = asciiread("/Volumes/Data/kdholman/glerl_materials/sup_watershed/station_ids.txt",-1,"string");
> delimiter = ",";
> nfields = str_fields_count(data(0),delimiter);
>
> latp = str_get_field(data,2,delimiter);
> lonp = str_get_field(data,3,delimiter);
>
> print(latp(10))
> print(lonp(10))
>
> resp = True
> resp@gsMarkerIndex = 16;
> resp@gsMarkerSizeF = 5.0 ; (I've tried a smaller value, 0.5)
>
>
> gsn_polymarker(wks,map,lonp(10),latp(10),resp) ; This would be line 61
>
> draw(map)
> frame(wks)
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 24 08:39:14 2011

This archive was generated by hypermail 2.1.8 : Thu Jun 30 2011 - 12:54:44 MDT