Re: plotting station location

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Mar 05 2012 - 14:01:25 MST

Basit,

What you are trying to do is not valid: you have called gsn_csm_map, overlaid some markers, and then tried to pass the marker ids to wrf_map_overlays. This won't work because wrf_map_overlays only accepts contour or vector plots as input graphical objects.

I think what you want to try is this (untested):

First, don't create plot_Stn as you have it below. You are just going to call wrf_map_overlays with this:

. . .

;---A trick so wrf_map_overlays doesn't remove the contours when done.
  pltres@PanelPlot = True
  plot = wrf_map_overlays(a,wks,contour_terC, pltres, mpres)

  gsres = True
  gsres@gsMarkerIndex = 16 ; Use filled dots for markers.
  gsres@gsMarkerColor = "Black"
  gsres@gsMarkerThicknessF = 0.9

  plot_Stn = gsn_add_polymarker(wks,plot,lon,lat, gsres)

  draw(plot)
  frame(wks)

--Mary

On Mar 4, 2012, at 10:49 PM, BasitAli Khan wrote:

> Hi folks,
>
> I am trying to plot station locations with polymarkers (by using gsn_add_polymarker function) on a map which is overlaid with terrain . I am using wrf_map_overlays function to overly terrain and polymarkers on the map however, wrf_map_overlays function somehow do not accept both overlays and I get the following error which does not give any clue as why I am getting this particular error. Note : 217 is the line number of wrf_map_overlays function.
>
> fatal:Execute: Error occurred at or near line 3830 in file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
> fatal:Execute: Error occurred at or near line 217 in file my-terrain2.ncl
>
>
> I am copying the script and would greatly appreciate if somebody could advise some solution to this problem
>
> Thanks
> Basit
>
>
>
> ---------------------------------------------
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
>
> begin
> a = addfile("/Volumes/gera1/khanb/data_store/sims_wrf/sb_sims/wrf_124/wrfout_d01_2006-05-16_00_wrf_124a.nc","r")
>
> ; We generate plots, but what kind do we prefer?
> type = "x11"
> wks = gsn_open_wks(type,"U10V10W05Ter_wrf102_hcs")
>
> ; Set some basic resources
> res = True
> res@MainTitle = "REAL-TIME WRF"
>
> pltres = True
> mpres = True
>
>
> ; Set some basic resources
>
>
>
> xLat = a->XLAT(0,:,0)
> xLong = a->XLONG(0,0,:)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> height = wrf_user_getvar(a,"height",0)
> terrain = wrf_user_getvar(a,"ter",0)
>
> ;;;;;;;;;;;;;;;; HIGHRES RANGS/GSHHS COASTLINE PLOT RESOURCES ;;;;;;;;;;;;;;;;;;;;;;;;
>
> wrf_mapres_c(a, mpres, 0)
>
> mpres@gsnMaximize = True
> mpres@mpOutlineOn = True
> mpres@mpFillOn = False
> mpres@mpGridLineColor = "Gray"
> mpres@mpGridLineThicknessF = 0.5
> mpres@mpGridpacingF = 3
> mpres@gsnDraw = False ; don't draw the plots
> mpres@gsnFrame = False ; don't advance the frame
> mpres@tmYROn = False
> mpres@tmXTOn = False
> mpres@mpGeophysicalLineColor= "Black"
> mpres@mpLimbLineColor = "Blue"
> mpres@mpGeophysicalLineThicknessF = 1.6
> mpres@mpDataBaseVersion = "HighRes" ; Use the high-res database
> mpres@mpDataResolution = "FinestResolution"
> mpres@pmTickMarkDisplayMode = "Always" ; Turn on map tickmarks.
> map = gsn_csm_map(wks,mpres)
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> gsn_define_colormap(wks,"OceanLakeLandSnow")
>
>
> opts = res
> opts@cnHighLabelsOn = False
> opts@cnLowLabelsOn = False
> opts@cnConstFLabelPerimOn = False
> opts@cnConstFLabelOn = False
> opts@cnInfoLabelPerimOn = False
>
> opts@cnLevelSelectionMode = "ExplicitLevels"
>
> opts@cnLevels = (/0.001, 3, 6, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 160, 180, \
> 200, 230, 260, 290, 320, 350, 380, 410, 440, 470, 500, 530, 560, 590, 620, 650, \ \
> 680, 710, 740, 770, 800, 840, 880, 920, 960, 1000, 1150, 1200, 1250, 1300, 1350, \
> 1400, 1450, 1500, 1550, 1600, 1650, 1700, 1750, 1800, 1850, 1900, 1950, 2000, \
> 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300/)
>
> ; Set some contouring resources.
>
> opts@gsnMaximize = True ; Maximize plot in frame
>
> opts@cnInfoLabelOn = False ; Turn off annotations
>
> ; Set contour resources
> opts@cnLinesOn = False
> opts@cnLineLabelsOn = False
> opts@cnInfoLabelOn = False
>
> opts@cnFillOn = True
> opts@cnFillMode = "AreaFill" ; This is the default.
> opts@lbOrientation = "Horizontal"
>
> ; Set contour levels.
> contour_terC = wrf_contour(a,wks,terrain,opts)
> delete(opts)
>
> ; plot Markers at station locations
>
> lat = (/33.883,33.367,34.983, 31.617, 35.583, 35.733, 34.050, 33.933, 33.567, 30.933/) ; Latitudes of station locations
> lon = (/-5.533,-7.583, -3.017, -8.032 , -5.333 ,-5.900, -6.767, -4.983, -7.667, -6.900/) ; longitudes of station locations
> stn_elev = (/560, 206, 175, 466, 10, 21, 79, 579, 57, 1140/) ; elevation asl of station
> stn_names = (/"Meknes","Nouasseur","Arwi","Marrakech","Tetouan","Tanger-AER","Rabat-Sale","Fes-Sais","Casablanca","Ouarzazate"/)
>
> gsres = True
> gsres@gsMarkerIndex = 16 ; Use filled dots for markers.
> gsres@gsMarkerColor = "Black"
> gsres@gsMarkerThicknessF = 0.9
> gsres@PanelPlot = True
> gsres@FramePlot = False
>
> nStn = dimsizes(lat)
>
> plot_Stn = gsn_add_polymarker(wks,map,lon(0:nStn-1),lat(0:nStn-1), gsres)
>
> ; draw(map)
>
>
> ; MAKE PLOTS
> plot = wrf_map_overlays(a,wks,(/contour_terC, plot_Stn/), pltres, mpres)
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
>
> frame(wks)
>
> end
>
>
>
>
>
>
>
>
>
>
>
> ---
> Basit A. Khan, Ph.D.
> Postdoctoral Research Fellow
> Division of Physical Sciences & Engineering
> Office# 3204, Level 3, Building 1,
> King Abdullah University of Science & Technology
> 4700 King Abdullah Blvd, Box 2753, Thuwal 23955 –6900,
> Kingdom of Saudi Arabia.
>
> Office: +966(0)2 808 0276, Mobile: +966(0)5 0860 3617
> E-mail: basitali.khan@kaust.edu.sa
> Skype name: basit.a.khan
> _______________________________________________
> 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 Mon Mar 5 14:01:33 2012

This archive was generated by hypermail 2.1.8 : Mon Mar 05 2012 - 14:12:07 MST