Re: gsn_add_polymarker

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 03 2011 - 10:59:00 MDT

Yan,

Did you mean to attach a figure? I didn't see one.

I'm having trouble understanding the problem you describe, but my guess is the issue is that wrf_map_overlays removes all the overlays after the function is over, and you only have a map with no data on it.

Before you call wrf_map_overlays, you can "fool" it into not removing the overlaid data by setting:

  pltres@PanelPlot = True

This will make wrf_map_overlays think that you want to panel this plot later, and hence it won't remove the overlaid data.

Also, instead of calling:

   draw(wks)

call:

   draw(plot)

--Mary

On Jun 2, 2011, at 5:33 PM, Yan Bao wrote:

>
> Hi,ncl group,
>
> I cannot make the marks properly drawed with any way in a terrain figure with projection of Lambert,
> , though there is no any error message when run the script. There are 3 figures in one pdf file represented,
> with the first one for contoured terrain, the second one for the marks (blank background), and the third one
> for terrain labeled with latitude and longitude overlapped with marks labeled with grid number. I want the marks
> to be drawed in a plot instead of a wks, with the map totally overlapped with latitude and longitude.
> Does any one know what I'm supposed to do it? The script I made the figure was attached, and
> it was turned out it actually didn't work for marks drawing in my case. Any of your help is appreciated.
>
>
> Thanks,
>
> Yan
>
> Script 1
> 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"
>
> a = addfile ("geo_em.d01.nc", "r")
> lat2d = a->XLAT_M(0,:,:)
> lon2d = a->XLONG_M(0,:,:)
> ter = wrf_user_getvar(a,"HGT_M",0)
> lu = wrf_user_getvar(a,"LU_INDEX",0)
>
> ;res@mpLimitMode = "Corners" ; choose range of map
> ;res@mpLeftCornerLatF = lat2d(0,0)
> ;res@mpLeftCornerLonF = lon2d(0,0)
> ;res@mpRightCornerLatF = lat2d(nlat-1,nlon-1)
> ;res@mpRightCornerLonF = lon2d(nlat-1,nlon-1)
>
> ; print((/lat2d(0,0),lon2d(0,0),lat2d(nlat-1,nlon-1),lon2d(nlat-1,nlon-1)/))
>
> ; The following 4 pieces of information are REQUIRED to properly display
> ; data on a native lambert conformal grid. This data should be specified
> ; somewhere in the model itself.
>
> ;res@mpProjection = "LambertConformal"
> ;res@mpLambertParallel1F = 30.
> ;res@mpLambertParallel2F = 60.
> ;res@mpLambertMeridianF = -119.57
>
> wks = gsn_open_wks("pdf","plt_geo_5") ; Create a plot workstation
> res = True
> opts = True ; Set some Basic Plot options
> opts@MainTitle = "GEOGRID FIELDS"
> gsn_define_colormap (wks,"gui_default") ; choose color map
>
>
> res = opts ; Use basic options for this field
> res@cnFillOn = True ; Create a color fill plot
> ; res@ContourParameters = (/ 0., 1000., 50. /) ; Set the levels
> contour = wrf_contour(a,wks,ter,res)
> pltres = True ; Set plot options
> mpres = True ; Set map options
> plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres) ; Plot the field over a map background
>
> nsta=1
> lat_cen = (/36.33/)
> lon_cen = (/-119.57/)
> st_loc=new((/nsta,2/),integer,-999)
> do ii=0,nsta-1
> st_loc(ii,:) = wrf_user_latlon_to_ij(a,lat_cen(ii), lon_cen(ii))
> end do
> ax=st_loc(0,0)
> ay=st_loc(0,1)
> print((/ax,ay/))
>
> ;Mark central point
>
> polyres = True
> ; polyres@gsMarkerIndex = 5 ; polymarker style
> ; polyres@gsMarkerSizeF = 10 ; polymarker size
> polyres@gsMarkerColor = "red" ; maker color
> ;print((/lat_sta(0),lon_sta(0),lat_sta(1),lon_sta(1)/))
> dum1 = gsn_add_polymarker(wks,plot,lon_cen(0),lat_cen(0),polyres)
> draw(wks)
>
> ;gsn_polymarker(wks,plot,lon_cen,lat_cen,polyres)
> ;draw(wks)
> 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 3 10:59:13 2011

This archive was generated by hypermail 2.1.8 : Thu Jun 09 2011 - 14:56:48 MDT