From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>

Date: Tue Oct 29 2013 - 15:48:56 MDT

Date: Tue Oct 29 2013 - 15:48:56 MDT

Hi David,

To draw a zoomed-in version of your WRF data using gsn_csm_xxx, you can do one of two things.

The first is the way you are doing it, by setting tfDoNDCOverlay to True:

*> res@tfDoNDCOverlay = True
*

However, you can't set both tfDoNDCOverlay to True and these resources:

*> res@vfYCStartV = minlat ; Define lat/lon corners
*

*> res@vfXCStartV = minlon ;for vector plot.
*

*> res@vfXCEndV = maxlon
*

*> res@vfYCEndV = maxlat
*

because the tfDoNDCOverlay resource assumes that the data has already been projected, and hence it ignores the vf resources.

In order to get the map projection exactly right for a zoomed in map plot, you have use minlat/maxlat and minlon/maxlon values that are exactly equal to lat/lon values in your XLONG/XLAT arrays. This can get complicated. Some folks use the wrf_user_ll_to_ij function to get the i,j index of the approximate area of interest.

The second way, which I recommend, is to use the lat2d/lon2d arrays you read in, but attach them to u10 and v10:

*> u10@lon2d = lon2d
*

*> u10@lat2d = lat2d
*

*> v10@lon2d = lon2d
*

*> v10@lat2d = lat2d
*

and then remove or comment these:

*>
*

*> res@vfYCStartV = minlat ; Define lat/lon corners
*

*> res@vfXCStartV = minlon ;for vector plot.
*

*> res@vfXCEndV = maxlon
*

*> res@vfYCEndV = maxlat
*

and also remove this line or set the resource to False:

*> res@tfDoNDCOverlay = False ; False is the default
*

You also need:

res@gsnAddCyclic = False

You may want to look at this WRF plotting template. This is for contours, but the same principle can be applied to vector plots:

http://www.ncl.ucar.edu/Applications/Templates/wrf_contour_map_template.ncl

--Mary

On Oct 24, 2013, at 1:24 PM, David Rasmussen <drasmussen@ucdavis.edu> wrote:

*> Hi,
*

*>
*

*> There was a thread about this previously, but the answer was supposedly "attached" in a way that I can not see it. I am thus re-asking it in the hopes that I can find a solution to my problem. The old thread is here:
*

*>
*

*> http://www.ncl.ucar.edu/Support/talk_archives/2012/3174.html#start
*

*>
*

*> In a nutshell, I am trying to "zoom in" on an area in my principal WRF domain and plot 10-m wind vectors. I get the map to plot correctly in the background, but the vectors that are plotted are those of the principal domain.
*

*>
*

*> How can I get the vectors to correctly plot in the area I've selected?
*

*>
*

*> Thanks!
*

*>
*

*>
*

*> begin
*

*>
*

*> ; target date
*

*> year="2012"
*

*> month="07"
*

*> day="11"
*

*>
*

*> ; options
*

*> domain=3
*

*> Plot=True
*

*>
*

*> ; open the WRF file
*

*>
*

*> wrfDir="/data/r009/user/daniel/WRFV3.4.1/"+year+"/run_"+month+"/"
*

*> wrfName="wrfout_d0"+domain+"_"+year+"-"+month+"-"+day+"_12-00-00.nc"
*

*> wrfout=wrfDir+wrfName
*

*> print("Opening file: "+wrfout+" ...")
*

*> a = addfile(wrfout,"r")
*

*>
*

*> ; 10-m u, v component wind
*

*> u10 = a->U10 ; (time, south_north, west_east)
*

*> v10 = a->V10
*

*> lat2d = a->XLAT(0,:,:) ; time invariant
*

*> lon2d = a->XLONG(0,:,:)
*

*>
*

*> times = chartostring(a->Times)
*

*> ntim = dimsizes(times)
*

*>
*

*> if (Plot) then
*

*>
*

*> wks = gsn_open_wks("ps","stream") ; open a ps file
*

*> res = True ; plot mods desired
*

*> res@gsnAddCyclic = False
*

*> res@mpOutlineDrawOrder = "PostDraw" ; draw continental outline last
*

*>
*

*> minlon = -119.142151
*

*> maxlon = -116.291199
*

*> minlat = 33.56886
*

*> maxlat = 34.474864
*

*> ; res@vfXArray = lon2d
*

*> ; res@vfYArray = lat2d
*

*> res@tfDoNDCOverlay = True
*

*> res@mpProjection = "LambertConformal"
*

*> res@mpLambertParallel1F = a@TRUELAT1
*

*> res@mpLambertParallel2F = a@TRUELAT2
*

*> res@mpLambertMeridianF = a@CEN_LON
*

*> res@mpLimitMode = "LatLon"
*

*> res@mpMinLonF = minlon ;
*

*> res@mpMaxLonF = maxlon;
*

*> res@mpMinLatF = minlat;
*

*> res@mpMaxLatF = maxlat;
*

*>
*

*> res@vfYCStartV = minlat ; Define lat/lon corners
*

*> res@vfXCStartV = minlon ;for vector plot.
*

*> res@vfXCEndV = maxlon
*

*> res@vfYCEndV = maxlat
*

*>
*

*> res@gsnPaperOrientation = "portrait"
*

*> res@gsnMaximize = True
*

*> res@tfDoNDCOverlay = True
*

*> res@vcLevelSelectionMode = "ManualLevels"
*

*> res@vcMinLevelValF = 0.5
*

*> res@vcMaxLevelValF = 7.0
*

*> res@vcLevelSpacingF = 0.5
*

*>
*

*> res@vcMinDistanceF = 0.017 ; thin out vectors
*

*>
*

*>
*

*> res@vcRefMagnitudeF = 5.0 ; define vector ref mag
*

*> res@vcRefLengthF = 0.045 ; define length of vec ref
*

*> ;
*

*> ; Annotation info for vectors.
*

*> ;
*

*> res@vcRefAnnoZone = 4
*

*> res@vcRefAnnoFont = "Helvetica-Bold"
*

*> res@vcRefAnnoFontColor = "Black"
*

*> res@vcRefAnnoString1 = "$VMG$ ms~S~-1~N~"
*

*> res@vcRefAnnoString2On = False
*

*> res@vcRefAnnoBackgroundColor = "LightGray"
*

*> res@vcRefAnnoPerimOn = False
*

*>
*

*> res@mpDataBaseVersion = "Medium"
*

*> res@mpOutlineBoundarySets = "GeophysicalAndUSStates"
*

*> res@mpDataBaseVersion = "Ncarg4_1"
*

*> res@mpDataSetName = "Earth..2"
*

*> res@mpFillOn = False ; turn off map fill
*

*> res@mpOutlineOn = True
*

*> res@mpOutlineSpecifiers = (/"Land","California"/)
*

*> res@mpMaskOutlineSpecifiers = (/"water"/)
*

*>
*

*> do ihr = 0, ntim-1
*

*> res@tiMainString = "WRF-ARW 10-m winds"; title
*

*> res@gsnLeftString = times(ihr)+" local time"
*

*> plot = gsn_csm_vector_map (wks, u10(ihr,:,:), v10(ihr,:,:), res)
*

*> end do
*

*>
*

*> end if
*

*> end
*

*>
*

*> _______________________________________________
*

*> ncl-talk mailing list
*

*> List instructions, subscriber options, unsubscribe:
*

*> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
*

_______________________________________________

ncl-talk mailing list

List instructions, subscriber options, unsubscribe:

http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Tue Oct 29 15:49:03 2013

*
This archive was generated by hypermail 2.1.8
: Fri Nov 01 2013 - 08:58:14 MDT
*