[ncl-talk] overlay

Ehsan Taghizadeh ehsantaghizadeh at yahoo.com
Mon Nov 19 12:18:42 MST 2018


 Dear MaryYou are right,rh_res at mpOutlineOn                     = False       ; Turn off NCL's map outlines
works correctly.May I ask why "Reference Vector" doesn't be placed correctly and just top border of it could be seen on bottomleft of the plot (the attached plot on my email on Nov 17)?
SincerelyEhsan
    On Saturday, November 17, 2018, 10:39:51 PM GMT+3:30, Mary Haley <haley at ucar.edu> wrote:  
 
 I think the reason you're not getting any outlines is because you've explicitly turned them off with this line:

 rh_res at mpOutlineOn                     = False       ; Turn off NCL's map outlines                                                            

Set this resource to True and see what happens.

--Mary



On Fri, Nov 16, 2018 at 2:13 PM Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:

 Dear MaryYour script is nearly what I want. However in my case I still don't have country boundaries. I've attached the script and its output. I didn't attach shapefiles, because of its size > 1.5 megabytes. Should I send it via ftp? However I think the difference of my case and your script is that I just want "overlay(rh_plot,uv_plot)". Also I define adding shapefiles via function (I had got it from ncl_talk).
SincerelyEhsan
    On Friday, November 16, 2018, 9:03:21 PM GMT+3:30, Mary Haley <haley at ucar.edu> wrote:  
 
 Sorry, I forgot to mention that if you want to get contour lines for RH2, but you also want to fill in particular areas, then you need to use gsn_contour_shade.  The script and image I just sent you has an example of this.
For information and examples on gsn_contour_shade, see coneff_13.ncl at:
http://www.ncl.ucar.edu/Applications/coneff.shtml#ex13

--Mary

On Fri, Nov 16, 2018 at 10:29 AM Mary Haley <haley at ucar.edu> wrote:

Ehsan,
Part of the problem may be that wrf_map_resources sets a bunch of resources that sets your map outlines to gray, and makes them half as thick, making them hard to see.
I've modified the same script I sent you before, but changed some resources to make the map outlines really thick and white, so you could see them better. I commented out the shapefile outlines.
If you continue to have problems, I will need to see your script. 
For more information about map outlines, go to 
http://www.ncl.ucar.edu/Applications/mapoutlines.shtml

and look at mapoutlines_7.ncl.  It shows how to get different levels of map outlines in your map.
I suggest looking at the WRF/GSN examples page more closely, as it has examples on how to customize the map outlines. In particular, look at example wrf_gsn_6.ncl:
http://www.ncl.ucar.edu/Applications/wrfgsn.shtml

--Mary


On Fri, Nov 16, 2018 at 5:25 AM Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:

 Dear Mary
I've changed a little your script, as I just want "2m RH" and "10 u,v". I've also added my shape files. However I had my two main problems, yet.1- I couldn't have countries boundaries, in spite of adding following lines:
rh_res = wrf_map_resources(f,rh_res)    ; Required for setting native WRF map projection(instead of: tc_res = wrf_map_resources(f,tc_res))
;---Boundaries (3 following lines Don't work???) rh_res at mpDataSetName            = "Earth..4"   ; 1 through 4 rh_res at mpNationalLineColor      = "black" ; "mpCountyLineColor" doesn't work rh_res at mpNationalLineThicknessF = 2.5     ; "mpCountyLineThicknessF" doesn't work

2- I want to draw "RH" contours for all values, and fill it just for RH>=80%.
Attached file is output of edited script.
 
SincerelyEhsan
    On Thursday, November 15, 2018, 9:23:21 PM GMT+3:30, Mary Haley <haley at ucar.edu> wrote:  
 
 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 = -999rh2 = 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 MaryThank you very much for your helpful reply. I used "wrf_gsn_5.ncl" fromhttps://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 at 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.
SincerelyEhsan    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", (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.
SincerelyEhsan
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk



  

  _______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk


  _______________________________________________
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/20181119/d6787cac/attachment.html>


More information about the ncl-talk mailing list