[ncl-talk] overlay

Mary Haley haley at ucar.edu
Thu Nov 15 10:52:35 MST 2018


Ehsan,

Please include ncl-talk when you have followup questions about ncl-talk,
unless we specifically ask to take the conversation offline.

[1] If you are attaching shapefile outlines, in general you don't also want
to be drawing NCL's map outlines.  So, you shouldn't need to set
mpOutlineBoundarySets or mpDataSetName.

If you do need to set these for some reason, then you need to set these
resources for when you call one of the gsn map functions, like gsn_csm_map
or gsn_csm_contour_map.

[2] To just fill in the RH2 values above 80, you can give gsn_csm_contour
one contour level and then provide two colors to indicate what color you
want for everything less than that level, and what color you want for
everything greater than or equal to it.

Something like this:

 rh_res at cnFillOn             = True
 rh_res at cnLevelSelectionMode = "ExplicitLevels"
 rh_res at cnLevels             = 80.
 rh_res at cnFillColors         = (/"transparent","navyblue"/)
 rh_res at cnLineLabelsOn       = False
 rh_res at lbLabelBarOn         = False

Note that this will fill in everything where RH2 >= to 80 (not RH 2 > 80).
If you really need to do this for RH2 > 80, then you can use a slightly
bigger value for the contour level.

Another way to do this is to use the "where" function:

rh2 at _FillValue = -999
rh2 = where(rh2.gt.80,rh2,rh2 at _FillValue)

When you do this, however, you may notice that the RH2 contours are now
blocky looking, because NCL can't give you smooth contours at locations
that go up against a bunch of missing values. Also you will now get a
warning:

warning:ContourPlotSetValues: Data values out of range of levels set by
EXPLICITLEVELS mode

because NCL is not finding any values below 80, and it's just warning you
about this.

I've attached a sample script that shows RH2 (filled in navy blue) and the
difference between using "where" and not.

--Mary








On Wed, Nov 14, 2018 at 11:11 PM, Ehsan Taghizadeh <
ehsantaghizadeh at yahoo.com> wrote:

> Dear Mary
> Thank you very much for your helpful reply. I used "wrf_gsn_5.ncl" from
> https://www.ncl.ucar.edu/Applications/wrfgsn.shtml
> and added shapefiles to "map".
> I need two more helps now, and I'll be thankful if I could have any
> suggestion again:
>
> 1- where should I add boundaries
> @mpOutlineBoundarySets = "National"
> @mpDataSetName            = "Earth..4"   ; 1 through 4
>
> I've tried to add them to "res_map", but it seems doesn't work!
>
> 2- I've used "2m Relative Humidity" and contoured it. How could I fill it
> just for RH>80% (just one color)
>
> If it helps I could attach the script. However I've attached one sample of
> output.
>
> Sincerely
> Ehsan
> On Wednesday, November 14, 2018, 8:51:23 PM GMT+3:30, Mary Haley <
> haley at ucar.edu> wrote:
>
>
> Ehsan,
>
> Please see example wrf_gsn_5.ncl and wrf_nogsn_5.ncl at
>
> https://www.ncl.ucar.edu/Applications/wrfgsn.shtml
>
> It shows you how to overlay several WRF plots on top of each other, using
> WRF plotting functions, and gsn_csm plotting functions.
>
> Adding shapefile outlines should be done to the map plot, and I believe
> there's an example on the same page.
>
> --Mary
>
>
> On Wed, Nov 14, 2018 at 12:49 AM, Ehsan Taghizadeh <
> ehsantaghizadeh at yahoo.com> wrote:
>
> Hi,
> I have some basic problems about overlaying different quantities of WRF,
> for a few months and unfortunately, until now I couldn't solve it and I'll
> be thankful if I could have any help for this.
> I saw "https://www.ncl.ucar.edu/ Training/Tutorials/WRF_Users_
> Workshop/WRF_NCL.shtml
> <https://www.ncl.ucar.edu/Training/Tutorials/WRF_Users_Workshop/WRF_NCL.shtml>",
> (wrf_demo_plot_tc_gsn_ shapefiles.ncl
> <https://www.ncl.ucar.edu/Training/Tutorials/WRF_Users_Workshop/Scripts/wrf_demo_plot_tc_gsn_shapefiles.ncl>).
> It is near to what if want. I just want to add some quantities to it and
> overlay on it"
> uv10 = wrf_user_getvar(f0,"uvmet10", it);  u at 10 m, mass point
> rh2 = wrf_user_getvar(f,"rh2",0);        2m Relative Humidity (%)
>
> I mean overlay of "uv10" as vector and "rh2" as contour, on "terrain" and
> "shapefiles".
> I've written some scripts and I could send it. I want to use
> "gsn_csm_countour", "gsn_csm_vector", and "overlay" for related quantities.
> I hear from Mary Haley "I recommend that people use the
> gsn_csm_contour_map function for plotting WRF data when they need to add a
> lot of customization to the plot", for that reason I pointed "gsn".
>
> I'll be thankful for any help. As I said above I have this problem for a
> few months, before August, when I tried to plot a cross-section of WRF
> quantities with overlaying them. For now, I just want vector and contour,
> not a cross-section.
>
> Sincerely
> Ehsan
>
> ______________________________ _________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181115/493ae40a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrf_demo_plot_tc_uv_rh_gsn_shapefiles_where.png
Type: image/png
Size: 355558 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181115/493ae40a/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrf_demo_plot_tc_uv_rh_gsn_shapefiles.ncl
Type: application/octet-stream
Size: 3620 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181115/493ae40a/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrf_demo_plot_tc_uv_rh_gsn_shapefiles.png
Type: image/png
Size: 376346 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181115/493ae40a/attachment-0003.png>


More information about the ncl-talk mailing list