<div dir="ltr">Mary,<div><br></div><div>Thanks for your help on this. I was at a conference since I sent in my help requests and hadn't had time to look at all of this. After installing NCL 6.3 and changing my script to use gsn_csn_streamline_scalar_map, I was able to get the plot I expected.</div><div><br></div><div>Thanks,</div><div>Craig</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 9, 2015 at 10:51 PM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.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 class="gmail_default" style="font-size:small">Hi Craig,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You are using the generic "gsn_streamline_scalar_map" function, which doesn't look for the special lat2d/lon2d attributes.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you have NCL V6.3.0 installed, then you can use gsn_csm_streamline_scalar_map, which should recognize these special attributes.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I created a simple example for you. See example wrf_gsn_8.ncl at:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/wrfgsn.shtml#ex8" target="_blank">http://www.ncl.ucar.edu/Applications/wrfgsn.shtml#ex8</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Apr 9, 2015 at 3:17 PM, Craig Tierney - NOAA Affiliate <span dir="ltr"><<a href="mailto: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 class="h5"><div dir="ltr">Hello,<div><br></div><div>After some good help from some list members, I believe that I am setting up the resources for plotting WRF data without the WRF functions. However, I still get no streamlines in my plot, or at least not in the correct place.</div><div><br></div><div>I am using NCL 6.1.2. My WRF domain is close to CONUS. The domain is LambertConformal and I am setting the mapping properties stored in the Global section of the NetCDF file to the appropriate variables for the LC mapping. To draw the streamlines, I am basing my code off of the example here:</div><div><br></div><div><a href="https://www.ncl.ucar.edu/Applications/Scripts/gsn_stream_4.ncl" target="_blank">https://www.ncl.ucar.edu/Applications/Scripts/gsn_stream_4.ncl</a><br></div><div><br></div><div>I read in the data, massage it, then try and plot it. When I plot the speed, u1, or v1 arrays with contour:</div><div><br></div><div><div> contour = gsn_csm_contour_map(wks,speed,res)</div><div><br></div></div><div> I get what I would want, a contour of that variable with the bounds of the plot that of my domain. When I try the same thing to create a streamline plot:</div><div><br></div><div> plot = gsn_streamline_scalar_map(wks,u1,v1,speed,res)<br></div><div><br></div><div>I get nothing. When I remove setting the Corners of the domain by commenting out the following:</div><div><br></div><div><div> res@mpRightCornerLatF = lat2d(0,0)</div><div> res@mpRightCornerLonF = lon2d(0,0)</div><div> res@mpLeftCornerLatF = lat2d(nlat-1,nlon-1) </div><div> res@mpLeftCornerLonF = lon2d(nlat-1,nlon-1)</div><div> res@mpLimitMode = "Corners"</div></div><div><br></div><div>I get streamlines, but they are between 0E and 225E and 0N to 90N. For the CONUS domain I am using the corners are about (138W,21N) and (298W,47N). Something is being calculated, but not what I was expecting.</div><div><br></div><div>Any ideas are appreciated.</div><div><br></div><div>Thanks,</div><div>Craig</div><div><br></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> du1 = wrf_user_getvar(a,"U10",it) ; Terrain elevation</div><div> dv1 = wrf_user_getvar(a,"V10",it) ; Terrain elevation</div><div> dlon2d=wrf_user_getvar(a,"XLONG",it)</div><div> dlat2d=wrf_user_getvar(a,"XLAT",it)</div><div><br></div><div>; Down sample hack</div><div> d=dimsizes(du1)</div><div> nx=d(0)</div><div> ny=d(1)</div><div> s=8</div><div> u1=du1(0:nx-1:s,0:ny-1:s)</div><div> v1=dv1(0:nx-1:s,0:ny-1:s)</div><div> lat2d=dlat2d(0:nx-1:s,0:ny-1:s)</div><div> lon2d=dlon2d(0:nx-1:s,0:ny-1:s)</div><div><br></div><div> u1@lon2d=lon2d</div><div> u1@lat2d=lat2d</div><div> v1@lon2d=lon2d</div><div> v1@lat2d=lat2d</div><div><br></div><div> speed=sqrt(u1*u1+v1*v1)</div><div> speed@lat2d=lat2d</div><div> speed@lon2d=lon2d</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@mpProjection = "CylindricalEquidistant" </div><div> res@mpProjection = "LambertConformal" </div><div><br></div><div> res@mpLambertParallel1F = a@TRUELAT1 ; two parallels</div><div> res@mpLambertParallel2F = a@TRUELAT2</div><div> res@mpLambertMeridianF = a@STAND_LON ; central meridian</div><div> res@mpCenterLonF = a@CEN_LON</div><div> res@mpCenterLatF = a@CEN_LAT</div><div><br></div><div> d=dimsizes(u1)</div><div> nlat=d(0)</div><div> nlon=d(1)</div><div><br></div><div>;;;; Comment this section out, and we get streamlines, but in the wrong place</div><div>;;;; This is why they don't show up in the zoomed in plot</div><div>; res@mpRightCornerLatF = lat2d(0,0)</div><div>; res@mpRightCornerLonF = lon2d(0,0)</div><div>; res@mpLeftCornerLatF = lat2d(nlat-1,nlon-1)</div><div>; res@mpLeftCornerLonF = lon2d(nlat-1,nlon-1)</div><div>; res@mpLimitMode = "Corners"</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>;; This is where we decide what to plot</div><div> ptype="contour"</div><div>; ptype="streamline"</div><div><br></div><div> if (ptype .eq. "contour") then</div><div><span style="white-space:pre-wrap">        </span>print("Plotting: "+ptype)</div><div><span style="white-space:pre-wrap">        </span>res@cnFillOn = True</div><div><span style="white-space:pre-wrap">        </span>res@cnFillPalette = "OceanLakeLandSnow"</div><div><span style="white-space:pre-wrap">        </span>res@cnLinesOn = False</div><div><span style="white-space:pre-wrap">        </span>;contour = gsn_csm_contour_map(wks,speed,res)</div><div><span style="white-space:pre-wrap">        </span>;contour = gsn_csm_contour_map(wks,u1,res)</div><div><span style="white-space:pre-wrap">        </span>contour = gsn_csm_contour_map(wks,v1,res)</div><div> else</div><div><span style="white-space:pre-wrap">        </span>if (ptype .eq. "streamline") then</div><div><span style="white-space:pre-wrap">                </span>print("Plotting: "+ptype)</div><div><span style="white-space:pre-wrap">                </span>res@pmTickMarkDisplayMode = "Always"</div><div> <span style="white-space:pre-wrap">                </span>res@pmLabelBarDisplayMode = "Always"</div><div><span style="white-space:pre-wrap">                </span>res@pmLabelBarOrthogonalPosF = -0.02</div><div><span style="white-space:pre-wrap">                </span>res@pmLabelBarWidthF = 0.1</div><div><span style="white-space:pre-wrap">                </span>res@lbPerimOn = False</div><div><br></div><div><span style="white-space:pre-wrap">                </span>plot = gsn_streamline_scalar_map(wks,u1,v1,speed,res)</div><div><span style="white-space:pre-wrap">        </span>else</div><div><span style="white-space:pre-wrap">                </span>print("Unable to plot either contour or streamline: "+ptype)</div><div> <span style="white-space:pre-wrap">        </span>exit</div><div><span style="white-space:pre-wrap">        </span>end if</div><div> end if</div><div><br></div><div>end</div></div><div><br></div></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>