[ncl-talk] Zooming Functions Clarification

Mary Haley haley at ucar.edu
Thu Apr 14 12:41:24 MDT 2016


​Hi Brad,

There are a few problems with the script in general.

First, as Will pointed out, you are trying to set map resources when you
create a contour plot. This is why you are getting errors.

But, I do see that later you are calling wrf_map_overlays, which is where
you want to apply the map resources​. However, with the wrf_xxxx plotting
scripts, you have to be careful about zooming in on the data when it's
being done over a map.  The wrf_map_overlays procedure assumes that you are
using the map projection that's provided on the WRF output file, and hence
it doesn't really know anything about the lat/lon coordinates of your data.

If you then try to zoom in on your WRF data without telling NCL what part
of your data actually corresponds to the area you are zooming in on, then
your results are likely going to be incorrect.

wrf_map_overlays recognizes a special "ZoomIn" resource that allows you to
do map zooming. Please see the "olr.ncl" example at:

http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/SPECIAL/olr.htm

The scripts on the "WRF debug" page also show how to use ZoomIn:

http://www.ncl.ucar.edu/Applications/wrfdebug.shtml

If you don't want to use the wrf_contour/wrf_map_overlays plotting scripts,
then you can plot your WRF data with gsn_csm_contour_map.  We have some
examples of this, and also show how to zoom in on your data.  See
wrf_gsn_3.ncl at:

http://www.ncl.ucar.edu/Applications/wrfgsn.shtml

--Mary


On Wed, Apr 13, 2016 at 9:47 PM, Will Hobbs <will.hobbs at utas.edu.au> wrote:

> Brad
>
> I'm not a WRF user so any suggestion here is just a guess. However, have
> you tried setting the resources trYMinF, trYMaxF etc instead of mpMaxLatF
> etc.
>
> I would guess that wrf_contour() is not a map plotting function, so it
> wouldn't recognise the mp resources. As long as the array that you're
> plotting has lat/lon coordinate dimensions the bounds set by the 'tr'
> resources should work fine.
>
> Hope that helps
>
> Will
>
>
> From: <Illston>, "Bradley G." <illston at ou.edu>
> Date: Thursday, 14 April 2016 1:16 PM
> To: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
> Subject: [ncl-talk] Zooming Functions Clarification
>
> NCL Users,
>
>
>
> I am one to try and figure my problems on their own, but I am a bit
> stumped after working on this for a few days. I am trying to zoom my map in
> to a set of bounding latitudes and longitudes in my domain to no avail. I
> kept trying various iterations utilizing ZoomIn or mpMinLatF/mpMinLonF/etc.
> I am not sure when you should use one and when you would use the other.
> Below is my latest script that works, but not zoomed in. When I run it, I
> get the following warnings:
>
>
>
> warning:mpLimitMode is not a valid resource in
> /tair_24hr_2011_2008091502_contour at this time
>
> warning:mpMinLonF is not a valid resource in
> /tair_24hr_2011_2008091502_contour at this time
>
> warning:mpMaxLonF is not a valid resource in
> /tair_24hr_2011_2008091502_contour at this time
>
> warning:mpMinLatF is not a valid resource in
> /tair_24hr_2011_2008091502_contour at this time
>
> warning:mpMaxLatF is not a valid resource in
> /tair_24hr_2011_2008091502_contour at this time
>
>
>
> Am I mixing various gsn functions that is causing a confusion? Is there a
> preferred one for plotting basic WRF output (in NetCDF format) to a PNG
> file? Any thoughts? Thank you so much.
>
>
>
> Cheers,
>
> Brad Illston
>
>
>
> 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"
>
>
>
> begin
>
>
>
> ;---Define colormap. First is background color, second is foreground color
>
>   colors = (/(/255, 255, 255/),(/0, 0, 0/),(/255, 255, 255/),(/088, 164,
> 074/),(/047,124,062/),(/055, 072,
> 114/),(/095,129,183/),(/094,165,212/),(/116,196,205/),(/135,099,162/),(/128,076,144/)/)
> / 255.
>
>
>
> ;---Open WRF output file
>
>   a = addfile(wrf_filename,"r")
>
>
>
>   print("  NetCDF file = "+wrf_filename)
>
>   print("  Output image = "+output_png)
>
>
>
> ;---Read temperature at first time step
>
>   tc = wrf_user_getvar(a,"T2",0)
>
>   tc at long_name = "2m Air Temperature"
>
>   tc at units = "C"
>
>   tc=tc-273.15
>
>   wks = gsn_open_wks("png",output_png)
>
>   gsn_define_colormap(wks,"WhiteBlueGreenYellowRed")                ;
> choose colormap
>
> ; gsn_define_colormap(wks,colors)
>
>
>
> ;---Resources for filled contour plot
>
>   res                      = True
>
>
>
>   res at cnFillOn             = True
>
>   res at cnLinesOn            = False
>
>   res at gsnMaximize          = True
>
>
>
>   res at tiMainString         = run_length + " Run (" + year + ") - " +
> run_date + " " + end_time + " UTC"
>
>   res at Footer               = False
>
>   res at FieldTitle           = "2m Air Temperature"
>
>   res at lbTitleOn            = True
>
>   res at lbTitleString        = ""
>
>  res at NoHeaderFooter       = True            ; Switch headers and footers
> off
>
>
>
>   res at cnLevelSelectionMode = "ExplicitLevels"
>
>   res at cnLevels             =
> (/10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25/)
>
> ; res at ContourParameters = (/10,25,1/)      ; Contour levels
>
>
>
>   res at mpLimitMode            = "LatLon"
>
>   res at mpMinLatF              =   35
>
>   res at mpMinLonF              =  -98
>
>   res at mpMaxLatF              =   36
>
>   res at mpMaxLonF              =  -97
>
>
>
>   contour = wrf_contour(a,wks,tc,res)        ; Create contour plot
>
>
>
>   pltres                      = True         ; Basic overlay plot options
>
>   pltres at PanelPlot            = True         ; Tells wrf_map_overlays not
> to remove overlays
>
>
>
>   mpres                       = True         ; Set map options
>
>   mpres at mpOutlineOn           = True         ; Turn on map outlines
>
>   mpres at mpFillOn              = False        ; Turn off map fill
>
>   mpres at mpDataBaseVersion     = "Ncarg4_1"
>
>   mpres at mpDataSetName         = "Earth..2"   ; For counties
>
>   mpres at mpOutlineBoundarySets = "GeophysicalAndUSStates"
>
>   mpres at mpOutlineSpecifiers   = (/"Land", "Oklahoma:counties"/)
>
>   mpres at tiMainString          = run_length + " Run (" + year + ") - " +
> run_date + " " + end_time + " UTC"
>
>   mpres at gsnMaximize           = True
>
>
>
> ;---Create the contours over the WRF map (nothing will be drawn yet).
>
>   plot = wrf_map_overlays(a,wks,contour,pltres,mpres)
>
>
>
> end
>
>
>
> University of Tasmania Electronic Communications Policy (December, 2014).
> This email is confidential, and is for the intended recipient only.
> Access, disclosure, copying, distribution, or reliance on any of it by
> anyone outside the intended recipient organisation is prohibited and may be
> a criminal offence. Please delete if obtained in error and email
> confirmation to the sender. The views expressed in this email are not
> necessarily the views of the University of Tasmania, unless clearly
> intended otherwise.
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160414/c5f96d53/attachment.html 


More information about the ncl-talk mailing list