Re: gsn_add_text problem; simple mistake I can't find?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue May 27 2014 - 15:30:31 MDT

Hi Mike,

Since this is a map plot, you have to use longitude values for the "X" argument of gsn_add_text, and latitude values for the "Y" argument.

You are calling gsn_add_text with:

> text = gsn_add_text(wks,plot,"Minto Flats South Fire",100,110,txres)

The "100" is a valid longitude value, but "110" is not a valid latitude value. You need to change the 110 to be between -90 and 90.

--Mary

On May 27, 2014, at 2:44 PM, James Madden <jmmadden@alaska.edu> wrote:

> Hello everyone,
>
> I am trying to add text to my WRF terrain plot, and I am just not sure where the error is. The rest of my polyline and polymarker additions appear, but not the text. Is it a stupid mistake that I didn't catch? The text line in the code appears to be similar to the examples.
>
> The text part is near the end of the code. I would greatly appreciate any assistance.
>
> Thank you much, the code is below.
>
>
> ; Script to plot terrain height from WRFout file
>
> 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/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
>
> begin
> a = addfile("/import/c/w/jmmadden/WRFruns/wrfout_d01_2009-06-28_00:00:00"+".nc","r")
>
> ; We generate plots, but what kind do we prefer?
> type = "x11"
> wks = gsn_open_wks(type,"terrain with stations and scan")
> gsn_define_colormap(wks,"topo_15lev") ;BlAqGrYeOrReVi200")
>
> ; LOAD CALIPSO LATITUDE AND LONGITUDE DATA
> ; PICK A CALIPSO FLY-BY DAY AND TIME, UNCOMMENT YOUR SELECTION
>
> cday1 = "CAL_LID_L1-ValStage1-V3-01.2009-07-07T12-22-31ZD.hdf_Subset.hdf"
> cday2 = "CAL_LID_L1-ValStage1-V3-01.2009-07-27T11-56-14ZD.hdf_Subset.hdf"
>
> b = addfile("/import/archive/u1/uaf/jmmadden/WILDFIRE2009/CALIPSOdata/SUBSETS/" + cday1,"r")
>
> c = addfile("/import/archive/u1/uaf/jmmadden/WILDFIRE2009/CALIPSOdata/SUBSETS/" + cday2,"r")
>
>
> ; Identify Geolocation arrays
> lat1d = b->Latitude(fakeDim0|:,fakeDim1|0)
> lon1d = b->Longitude(fakeDim2|:,fakeDim3|0)
>
> ; Identify Geolocation arrays
> lat1d1 = c->Latitude(fakeDim0|:,fakeDim1|0)
> lon1d1 = c->Longitude(fakeDim2|:,fakeDim3|0)
>
> ;---Create arrays with RAWS lat/lon locations
> rlat = (/65.02, 65.585, 66.267, 63.867, 65.189,\
> 65.017, 66.591, 63.983, 64.837, 66.57,\
> 64.238, 67.033, 66.742, 63.949, 66.093,\
> 66.091, 65.424, 63.893, 66.043, 64.7,\
> 66.833, 64.022, 64.685, 64.8, 65.938,\
> 64.590, 64.719, 63.753, 64.404, 66.798, 64.315, 63.838/)
>
> rlon = (/-146.228, -144.364, -146.517, -145.833, -147.500,\
> -148.583, -144.341, -145.65, -147.615, -145.251,\
> -145.270, -143.283, -148.677, -145.619, -152.17,\
> -143.367, -148.722, -152.311, -147.971, -147.017,\
> -154.333, -146.252, -153.94, -147.617, -149.855,\
> -146.140, -146.504, -143.817, -148.462, -146.716, -151.083, -144.350/)
>
> ;---Create arrays with ASOS lat/lon locations
> alat = (/66.54, 64.974, 64.683,\
> 64.804, 66.567, 63.994,\
> 66.0, 63.886, 64.55, 65.175,\
> 64.838/)
>
> alon = (/-151.31, -147.51, -147.083,\
> -147.876, -145.267, -145.721,\
> -153.70, -152.302, -149.072, -152.107,\
> -147.614/)
>
> ;---Create arrays with SNOTEL SITES lat/lon locations
> slat = (/65.483, 66.567, 66.75, 63.95, 65.117,\
> 65.083, 65.25, 64.85, 65.367, 65.1/)
> slon = (/-145.417, -145.25, -150.667, -145.4, -146.733,\
> -145.867, -146.15, -146.217, -146.6, -144.933/)
>
> ;---Create arrays with DOT lat/lon locations
> dlat = (/63.81, 64.316, 64.708, 64.218/)
> dlon = (/-148.965, -146.692, -148.632, -149.277/)
>
>
> ;---Attach markers to map.
> ;---RAWS Markers
> mres = True
> mres@gsMarkerSizeF = 15. ; Make it larger
> mres@gsMarkerIndex = 7 ; Triangle
> mres@gsMarkerThicknessF = 3
> mres@gsMarkerColor = "red"
> mres@tfPolyDrawOrder = "Draw"
>
>
> ;----ASOS Markers
> nres = True
> nres@gsMarkerSizeF = 15. ; Make it larger
> nres@gsMarkerIndex = 5 ; Big X
> nres@gsMarkerThicknessF = 3
> nres@gsMarkerColor = "black"
> nres@tfPolyDrawOrder = "Draw"
>
> ;----SNOTEL Markers
> ores = True
> ores@gsMarkerSizeF = 10. ; Make it larger
> ores@gsMarkerIndex = 16 ; Filled dot
> ores@gsMarkerColor = "black"
> ores@tfPolyDrawOrder = "Draw"
>
> ;----DOT Markers
> qres = True
> qres@gsMarkerSizeF = 15. ; Make it larger
> qres@gsMarkerIndex = 6 ; Square
> qres@gsMarkerThicknessF = 3
> qres@gsMarkerColor = "black"
> qres@tfPolyDrawOrder = "Draw"
>
>
> ;----CONTOUR RESOURCES
> cnres = True ; Set up some basic plot resources
> cnres@MainTitle = "TERRAIN HEIGHT"
> cnres@Footer = False
> cnres@cnFillOn = True
> cnres@gsnSpreadColors = True
> cnres@ContourParameters = (/0., 2000., 100. /)
> cnres@gsnFrame = False
> cnres@gsnDraw = False
> cnres@tfDoNDCOverlay = True
>
>
> ;----OTHER PLOT RESOURCES
> pltres = True
> pltres@PanelPlot = True
> pltres@FramePlot = False
> mpres = True
> mpres@mpOutlineOn = False
> mpres@gsnFrame = False
> mpres@gsnDraw = False
>
> ;----GET TERRAIN HEIGHT FROM FILE
> ter = wrf_user_getvar(a,"HGT",0)
>
> cnres@cnFillOn = True
> contour = wrf_contour(a,wks,ter,cnres)
>
> ; CALIPSO SCAN TRACK LINE and TEXT OPTIONS
> gres = True
> gres@gsLineThicknessF = 4.0
> gres@gsLineColor ="red"
>
> txres = True
> txres@txFontHeightF = 0.02
>
> ; ADD YOUR STATION MARKER and CALIPSO SCAN TRACKS
>
> plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)
>
> dum1 = gsn_add_polymarker(wks,plot,slon,slat,ores) ; SNOTEL Sites
> dum2 = gsn_add_polymarker(wks,plot,alon,alat,nres) ; ASOS Sites
> dum3 = gsn_add_polymarker(wks,plot,rlon,rlat,mres) ; RAWS Sites
> dum4 = gsn_add_polymarker(wks,plot,dlon,dlat,qres) ; DOT Sites
> line = gsn_add_polyline(wks,plot,lon1d,lat1d,gres) ; CALIPSO Scan Track
> line1 = gsn_add_polyline(wks,plot,lon1d1,lat1d1,gres) ; 2nd Scan Track
> text = gsn_add_text(wks,plot,"Minto Flats South Fire",100,110,txres)
>
> draw(plot)
> frame(wks)
> end
>
>
>
>
> --
> Mike Madden, M.S.
> Atmospheric Sciences
> University of Alaska - Fairbanks
> University of Missouri - Columbia
> "Buy the ticket, take the ride." -- Hunter S. Thompson
> _______________________________________________
> 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 Tue May 27 15:30:51 2014

This archive was generated by hypermail 2.1.8 : Tue May 27 2014 - 15:45:08 MDT