Hi Mary, <div><br></div><div>Craig was having some of the same issues I was having when I was starting specialization of plots. I remember using the wrf_map_resources function worked well when using the wrf plot functions but moving to gsn plots it didn't work well.<br><div><br></div><div>In my opinion, the wrf_map_resources function works well when first starting to try to get plots but is more of a hassle when doing a lot of plot specialization. I haven't used it in awhile and am still in the stone age of 6.1.2 so maybe it has gotten better since then. </div><div><br></div><div>I feel it just comes down to personal preference, I haven't dug into the code to see everything it sets but I have just found that setting it myself provides me better control of the plots.</div><div><br></div><div>I am rather curious why it ends up causing some issues.</div><div><br></div><div>-Alex<br><br>On Thursday, April 9, 2015, Mary Haley <<a href="mailto:haley@ucar.edu">haley@ucar.edu</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Craig and Alex,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Along the same lines here, and my apologies if this was already mentioned, but you can try the "wrf_map_resources" function, which attaches all the necessary NCL map resources to correctly plot a WRF grid natively.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">So, for example, if you opened the wrf file with:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">a = addfile("wrfoutxxxxx","r")</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Then you can set a bunch of NCL "mp" resources pertaining to the map projection on this file with:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"> res = wrf_map_resources(a,res)<br></div><div class="gmail_default"><br></div><div class="gmail_default">You still need to add:</div><div class="gmail_default"><br></div><div class="gmail_default"> res@tfDoNDCOverlay</div><div class="gmail_default"><br></div><div class="gmail_default">if you are not reading in lat/lon and setting them via lat2d/lon2d. That's redundant anyway, because when you use the WRF map projection on the file, you don't need the lat2d/lon2d.</div><div class="gmail_default"><br></div><div class="gmail_default">You can see a complete example code at:</div><div class="gmail_default"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_resources.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_resources.shtml</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 9, 2015 at 12:31 PM, Craig Tierney - NOAA Affiliate <span dir="ltr"><<a href="javascript:_e(%7B%7D,'cvml','craig.tierney@noaa.gov');" target="_blank">craig.tierney@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Alex,<div><br></div><div>Thanks for the help. This did the trick. </div><span><font color="#888888"><div><br></div><div>Craig</div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 9, 2015 at 11:44 AM, Alexander Schaefer <span dir="ltr"><<a href="javascript:_e(%7B%7D,'cvml','alexander.schaefer@mines.sdsmt.edu');" target="_blank">alexander.schaefer@mines.sdsmt.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi Craig,<br><br></div>I do a lot of specializing of my plots with my WRF data so I have strayed from using the wrf functions except getvar since it has a bunch of diagnostic variables. When I do my map projection, which is also LambertConformal I set all of the following resources as such:<br><br></div> lat = wrf_user_getvar(a,"lat", it)<br></div> lon = wrf_user_getvar(a,"lat", it)<div><div><br> pltres = True<br> projres = res<br> projres@mpProjection = "LambertConformal"<br> projres@mpRightCornerLatF = lat(0,0)<br> projres@mpRightCornerLonF = lon(0,0)<br> projres@mpLeftCornerLatF = lat(nlon-1,nlat-1)<br> projres@mpLeftCornerLonF = lon(nlon-1,nlat-1)<br> projres@mpLambertParallel1F = a@TRUELAT1<br> projres@mpLambertParallel2F = a@TRUELAT2<br> projres@mpLambertMeridianF = a@STAND_LON<br> projres@mpCenterLonF = a@CEN_LON<br> projres@mpCenterLatF = a@CEN_LAT<br> projres@mpLimitMode = "Corners"<br> projres@pmTickMarkDisplayMode = "Always"<br> projres@mpDataBaseVersion = "Ncarg4_1"<br> projres@mpDataSetName = "Earth..4"<br> projres@mpOutlineBoundarySets = "AllBoundaries" ; all boundaries<br> projres@mpNationalLineThicknessF = 1.0<br> projres@mpGeophysicalLineThicknessF = 1.0<br> projres@mpUSStateLineThicknessF = 2.0<br><br></div><div>I have altered the options so you should be able to just paste it into your script. This is a piece that I copy into all of my map scripts. <br><br></div><div>I will then usually do other resources such as contour or vector or streamlines and to keep the projection in mind instead of setting "contres", contour resources equal to true, set it equal to projres and then continue adding resources.<br><br></div><div>Hope that helps.<br><br></div><div>-Alex<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Apr 9, 2015 at 11:07 AM, Craig Tierney - NOAA Affiliate <span dir="ltr"><<a href="javascript:_e(%7B%7D,'cvml','craig.tierney@noaa.gov');" target="_blank">craig.tierney@noaa.gov</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hello,<div><br></div><div>I am trying to plot WRF data using NCL 6.1.2 without using the built-in WRF functions. The reason I am doing this is because what I really want to do is plot streamlines, and when I had problems doing that I tried to simplify what I was doing first.</div><div><br></div><div>I found the examples page for plotting WRF using the gsn functions. I started with the wrf_gsn_2.ncl example. All I did was change the WRF input file to point to mine. The output looked like the map was CylindralEquidistant (the specified mapping) but the data are in LambertConformal, so the height field is not plotted as rectangular. So you get the curved shape of my domain on the rectangular map where the lines of latitude are horizontal. This isn't want I want, but the script seems to be doing what it should for my domain.</div><div><br></div><div>What I found strange is that when I looked at the output of wrf_map_resources, that it says the Projection is LambertConformal.</div><div><br></div><div>So I tried changing the mpProjection to LambertConformal. When I did this I got something that looked more StereoGraphic. The plot was centered at the north pole.</div><div><br></div><div>When I compare the output of wrf_map_resources between this script and my script that uses wrf_map_overlays, the contents are identical.</div><div><br></div><div>So how do I get NCL to plot my data using the GSN functions in the same projection as using wrf_map_overlays?</div><div><br></div><div>Here is the script that I ran:</div><div><br></div><div><div>;----------------------------------------------------------------------</div><div>; wrf_gsn_2.ncl</div><div>;----------------------------------------------------------------------</div><div>; Concepts illustrated:</div><div>; - Using gsn_csm_contour_map to plot WRF-ARW data</div><div>;----------------------------------------------------------------------</div><div>; This example is similar to wrf_gsn_1.ncl, except more plot resources</div><div>; are set to:</div><div>; - explicitly set the contour levels</div><div>; - change the look of the map outlines</div><div>; - change the color map</div><div>; - make the labelbar vertical</div><div>;----------------------------------------------------------------------;</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</div><div><br></div><div>begin</div><div>;---Open WRF output file.</div><div> dir = "/scratch2/portfolios/BMC/winds/Craig.Tierney/theia/wrf/windswrf/trunk/conusplus-wrf-6day/201308010000/nowfp-nocu/wrf/"</div><div> filename = "wrfout_d01_2013-08-04_00:00:00"</div><div> a = addfile(dir + filename + ".nc","r")</div><div><br></div><div>;---Read terrain height and lat/lon off file.</div><div> it = 0 ; first time step</div><div> hgt = wrf_user_getvar(a,"HGT",it) ; Terrain elevation</div><div> hgt@lat2d = wrf_user_getvar(a,"XLAT",it) ; latitude/longitude</div><div> hgt@lon2d = wrf_user_getvar(a,"XLONG",it) ; required for plotting</div><div><br></div><div> wks = gsn_open_wks("png","wrf_gsn")</div><div><br></div><div>;---Set some basic plot options</div><div> res = True</div><div><br></div><div> res@gsnMaximize = True ; maximize plot in frame</div><div><br></div><div> res@tiMainString = filename</div><div><br></div><div> res@cnFillOn = True</div><div> res@cnFillPalette = "OceanLakeLandSnow"</div><div> res@cnLinesOn = False</div><div><br></div><div> res@mpProjection = "CylindricalEquidistant"</div><div>; res@mpProjection = "LambertConformal" </div><div><br></div><div>;---Zoom in on plot</div><div> res@mpMinLatF = min(hgt@lat2d)</div><div> res@mpMaxLatF = max(hgt@lat2d)</div><div> res@mpMinLonF = min(hgt@lon2d)</div><div> res@mpMaxLonF = max(hgt@lon2d)</div><div><br></div><div>;---Additional resources desired</div><div> res@pmTickMarkDisplayMode = "Always" ; nicer tickmarks</div><div><br></div><div> res@mpDataBaseVersion = "MediumRes" ; better and more map outlines</div><div> res@mpDataSetName = "Earth..4"</div><div> res@mpOutlineBoundarySets = "AllBoundaries"</div><div> res@mpOutlineOn = True</div><div><br></div><div> res@lbOrientation = "Vertical"</div><div> res@tiMainOffsetYF = -0.03 ; Move the title down</div><div><br></div><div>;---Change contour levels to better match the color map being used</div><div> res@cnLevelSelectionMode = "ExplicitLevels"</div><div> res@cnLevels = (/2,100,200,400,600,800,1000,1200,1400,1600,1800,2000,2200/)</div><div><br></div><div><br></div><div> contour = gsn_csm_contour_map(wks,hgt,res)</div><div><br></div><div>;</div><div>; This is for debugging purposes only. It shows what map resources the</div><div>; wrf_map_overlays routine would have use, if you had called that routine</div><div>; to do the plotting. This can be useful if you are trying to reproduce</div><div>; an original WRF-ARW plot.</div><div>;</div><div> dbgres = True</div><div> dbgres = wrf_map_resources(a,dbgres)</div><div> print(dbgres)</div><div>end</div></div><span><font color="#888888"><div><br></div><div>Craig</div><div><br></div></font></span></div>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div></div>