<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Mary</p>
<p style="margin-top:0;margin-bottom:0"> Thanks a lot for taking your time and your clear explanation! "<span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;">res@vcMapDirection=False"
indeed made the difference for <span>res@vcGlyphStyle="FillArrow"</span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;"><span> But if I use "<span>CurlyVector", "<span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;">res@vcMapDirection
= False</span>" doesn't make difference.</span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;"><span><span>See figure below, CurlyVector still appears incorrect. </span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;"><span><span>I pasted my NCl below. </span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;"><span><span>BTW: why the map did not show up? </span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;"><span><span>Thanks a lot!</span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;"><span><span>Xiaoming </span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;"><span><span><img size="151930" contenttype="image/png" id="img718010" tabindex="0" style="max-width: 99.9%; user-select: none;" src="cid:399c97bf-60d0-4aa7-9d16-71b5940896b7"><br>
</span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;"><span><span><img size="140036" contenttype="image/png" id="img368592" tabindex="0" style="max-width: 99.9%; user-select: none;" src="cid:983ba056-4968-4477-abe8-b7f11914001e"><br>
</span></span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;"><span><span></span></span></span></p>
<pre style="word-wrap: break-word; white-space: pre-wrap;">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
if(.not.isvar("ndc_overlay")) then
ndc_overlay = False
end if
if(.not.isvar("map_direction")) then
map_direction = False
end if
;----------------------------------------------------------------------
; Get the data. You can set the filename on the command line, if
; desired:
; ncl 'filename="wrfout_d01_2003-07-13_12:00:00"' wrf_vectors.ncl
;----------------------------------------------------------------------
if(.not.isvar("filename")) then
filename = "wrfout_d01_2011-08-08_12:00:00"
end if
print("==================================================")
print("file: " + filename)
f = addfile(filename+".nc","r")
u = wrf_user_getvar(f,"ua",0)
v = wrf_user_getvar(f,"va",0)
pf = wrf_user_getvar(f,"pressure",0) ; Full model pressure [hPa]
geoHeight = ( f->PH(0,:,:,:) + f->PHB(0,:,:,:) ) / 9.81
dim = dimsizes(geoHeight)
geoHeight_nonstag = (geoHeight(0:dim(0)-2,:,:)+geoHeight(1:dim(0)-1,:,:))/2
geoHeight_950 = wrf_interp_3d_z(geoHeight_nonstag,pf,950.)
u_950 = wrf_interp_3d_z(u,pf,950.)
v_950 = wrf_interp_3d_z(v,pf,950.)
lat2d = f->XLAT(0,:,:)
lon2d = f->XLONG(0,:,:)
nlat = dimsizes(lat2d(:,0))
nlon = dimsizes(lat2d(0,:))
min_lat_diff = abs(min(lat2d(1,:)-lat2d(0,:)))
min_lon_diff = abs(min(lon2d(:,1)-lon2d(0,0)))
max_lat_diff = min_lat_diff
max_lon_diff = min_lon_diff
do n=2,nlat-1
min_lat_diff = abs(min((/min_lat_diff,min(lat2d(n,:)-lat2d(n-1,:))/)))
max_lat_diff = abs(max((/max_lat_diff,max(lat2d(n,:)-lat2d(n-1,:))/)))
end do
do n=2,nlon-1
min_lon_diff = abs(min((/min_lon_diff,min(lon2d(:,n)-lon2d(:,n-1))/)))
max_lon_diff = abs(max((/max_lon_diff,max(lon2d(:,n)-lon2d(:,n-1))/)))
end do
print("min lat diff = " + min_lat_diff)
print("max lat diff = " + max_lat_diff)
print("min lon diff = " + min_lon_diff)
print("max lon diff = " + max_lon_diff)
; printMinMax(u_950,0)
; printMinMax(v_950,0)
;----------------------------------------------------------------------
; Set the plotting options
;----------------------------------------------------------------------
res = True
res@gsnMaximize = True
res@gsnAddCyclic = False ; don't add a longitude cyclic point
res@tfDoNDCOverlay = ndc_overlay ; True / False
res@pmTickMarkDisplayMode = "Always" ; turn on nice tickmarks
res@vcMapDirection = map_direction ; True / False
res@vcRefMagnitudeF = 8. ; define vector ref mag
res@vcRefLengthF = 0.025 ; define length of vec ref
res@vcMinDistanceF = 0.02 ; larger means sparser
res@vcFillArrowEdgeColor = "black"
res@vcFillArrowEdgeThicknessF = .25
res@vcGlyphStyle = "FillArrow"
res@gsnScalarContour = True ; contours desired
res@cnFillOn = True ; color plot desired
res@cnLinesOn = False ; turn off contour lines
res@cnLineLabelsOn = False ; turn off contour labels
res@cnLevelSelectionMode = "ManualLevels"
res@cnLevelSpacingF = 5
res@cnMaxLevelValF = 585+10
res@cnMinLevelValF = 530
res@lbLabelStride = 4
; res@gsnLeftString="GeoHeight@950mb"
res = wrf_map_resources(f, res)
if(.not.ndc_overlay) then
u_950@lat2d = lat2d
u_950@lon2d = lon2d
v_950@lat2d = lat2d
v_950@lon2d = lon2d
geoHeight_950@lat2d = lat2d
geoHeight_950@lon2d = lon2d
; n_cutoff = 150
; res@mpLeftCornerLonF = lon2d(0,n_cutoff)
; res@mpLeftCornerLatF = lat2d(0,n_cutoff)
end if
res@tiMainString = "FillArrow"
res@gsnLeftString = "tfDoNDCOverlay=" + ndc_overlay
res@gsnRightString = "vcMapDirection=" + map_direction
figurename = str_sub_str(filename,":","_")
;----------------------------------------------------------------------
; Create the plot
;----------------------------------------------------------------------
wks = gsn_open_wks("png",figurename + "_ndc_" + ndc_overlay + "_mapdir_" + map_direction+"_vcGlyphStyle_FillArrow")
; vector_plot = gsn_csm_vector_map(wks,u_950,v_950,res)
plot = gsn_csm_vector_scalar_map(wks,u_950,v_950,geoHeight_950,res)
end </pre>
<br>
<p></p>
<p style="margin-top:0;margin-bottom:0"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: small;"><span><span><br>
</span></span></span></p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Mary Haley <haley@ucar.edu><br>
<b>Sent:</b> Friday, April 27, 2018 2:34 PM<br>
<b>To:</b> xiaoming Hu<br>
<b>Cc:</b> ncl-talk; Xiaoming Hu<br>
<b>Subject:</b> Re: difference between using res@tfDoNDCOverlay and @lat2d @lon2d when overlaying wind vectors</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div class="x_gmail_default" style="font-size:small">Xiaoming,</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small">I finally had a chance to look at this.</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small">I first took your script and reduced it to just create a basic line vector plot, because I wanted to make sure there were no extraneous resources being set that could be the source of the problem.</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small">Long story short: if you set tfDoNDCOverlay=False and use the special lat2d/lon2d attributes to create the plot, then you also need to set:</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small"> res@vcMapDirection = False</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small">See the attached wrf_vectors.ncl (which I will make an official example on the WRF examples page somewhere). </div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small">This script allows you to try different combinations of vcMapDirection and tfDoNDCOverlay in one script so you can compare the images. You can also plug in other WRF output files and it should work.</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small">To try different combinations of these two resources setting, set ndc_overlay and/or map_direction to True / False on the NCL command line. For example:</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px">
<div class="x_gmail_default">
<div class="x_gmail_default"><font face="monospace, monospace">ncl map_direction=False ndc_overlay=True wrf_vectors.ncl</font></div>
</div>
<div class="x_gmail_default">
<div class="x_gmail_default"><font face="monospace, monospace">ncl map_direction=False ndc_overlay=False wrf_vectors.ncl</font></div>
</div>
<div class="x_gmail_default">
<div class="x_gmail_default"><font face="monospace, monospace">ncl map_direction=True ndc_overlay=True wrf_vectors.ncl</font></div>
</div>
<div class="x_gmail_default">
<div class="x_gmail_default"><font face="monospace, monospace">ncl map_direction=True ndc_overlay=False wrf_vectors.ncl</font></div>
</div>
</blockquote>
<div class="x_gmail_default">
<div class="x_gmail_default"><br>
</div>
</div>
<div class="x_gmail_default" style="font-size:small">For the case of map_direction = True (vcMapDirection) and ndc_overlay = False (tfDoNDCOverlay), the vectors are slightly shifted (and incorrect as you pointed out).</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small">For the other three combinations of these two settings, the vector plots are the same. I've attached all four PNGs to this email.</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small">I have to admit that the vcMapDirection resource is a bit of a mystery to me as to when it should be True or False. It is documented on the
<a href="http://www.ncl.ucar.edu/Document/Graphics/Resources/vc.shtml#vcMapDirection" target="_blank" id="LPlnk880647" previewremoved="true">
vectors resource page</a>:</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<blockquote style="margin:0px 0px 0px 40px; border:none; padding:0px">
<div class="x_gmail_default" style="font-size:small">
<div class="x_gmail_default"><b><font face="monospace, monospace">vcMapDirection</font></b></div>
</div>
<div class="x_gmail_default" style="font-size:small">
<div class="x_gmail_default"><font face="monospace, monospace">This resource controls whether the vector direction is mapped into the same coordinate space as the vector location, or whether it is rendered in a locally uniform cartesian coordinate space. This
resource has an effect whenever a non-uniform transformation is in effect. These include most of the MapTransformation transformations and IrregularTransformation transformations. Also included are logarithmic transformations provided by the LogLinTransformation
and even linear transformations when the X and Y unit sizes are different.</font></div>
</div>
<div class="x_gmail_default" style="font-size:small">
<div class="x_gmail_default"><font face="monospace, monospace">Default: True</font></div>
</div>
</blockquote>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default" style="font-size:small">If you look at our vectors examples page (which I just updated):</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_gmail_default"><a href="http://www.ncl.ucar.edu/Applications/vector.shtml" id="LPlnk487916" previewremoved="true">http://www.ncl.ucar.edu/Applications/vector.shtml</a><br>
</div>
<div class="x_gmail_default"><br>
</div>
<div class="x_gmail_default">it talks about the vcMapDirection resource and how it must be set to False if the latitude spacings are very different from the long<span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline">itude
spacings. With your data, </span>the latitude spacings vary from 0.097 to 0.11, whereas the longitude spacings vary from 0.1 to 11.0. This is enough of a difference that vcMapDirection needs to be set to False.</div>
<div class="x_gmail_default"><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline"><br>
</span></div>
<div class="x_gmail_default">As an extra test, I asked Bill Ladwig to plot this same data using a Python script that uses PyNIO to read in the data and matplotlib to plot it. I've attached the Python script and the wrf_quiver.png file so you can compare.</div>
<div class="x_gmail_default"><br>
</div>
<div class="x_gmail_default">To learn more about wrf-python, see: </div>
<div class="x_gmail_default"><br>
</div>
<div class="x_gmail_default"><a href="http://wrf-python.readthedocs.io/en/latest/" id="LPlnk483386" previewremoved="true">http://wrf-python.readthedocs.io/en/latest/</a></div>
<div class="x_gmail_default"><br>
</div>
<div class="x_gmail_default">Thanks for your patience.</div>
<div class="x_gmail_default"><br>
</div>
<div class="x_gmail_default">--Mary</div>
<div class="x_gmail_default"><br>
</div>
<div class="x_gmail_default" style="font-size:small"><br>
</div>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">On Fri, Apr 20, 2018 at 1:47 PM, xiaoming Hu <span dir="ltr">
<<a href="mailto:yuanfangcan@hotmail.com" target="_blank" id="LPlnk118681" previewremoved="true">yuanfangcan@hotmail.com</a>></span> wrote:<br>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="x_m_-1855891650296734960divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p style="margin-top:0; margin-bottom:0">Realized ncl scripts are not attached in previous email. Here again! </p>
<div style="color:rgb(0,0,0)">
<div dir="ltr">
<div>
<div class="x_h5">
<div id="x_m_-1855891650296734960x_divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p style="margin-top:0; margin-bottom:0"></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"> Thanks a lot for helping on this!</p>
<p style="margin-top:0; margin-bottom:0"> Now I changed to NCl 6.3.0 and used <span>wrf_map_resources and added <span>res@gsnAddCyclic = False </span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span> But I still did not make <span>the case of tfDoNDCOverlay not being set to be consistent with the case of <span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small">tfDoNDCOverlay
setting to True</span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span><span><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> I attached 2 cleaned script</span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span><span><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> with <span>plot_geoHeight950mb_<wbr>combine2episodes_with_ndc_<wbr>overlay.ncl I got: </span></span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span><span><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><span><br>
</span></span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span><span><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><span>with <span>plot_geoHeight950mb_<wbr>combine2episodes_without_ndc_<wbr>overlay.ncl, I got: </span></span></span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span><span><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><span><span><br>
</span></span></span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span><span><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><span><span>The previous issue still exists, plus the map is gone. :) </span></span></span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span><span><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><span><span>See the difference between the 2 scripts:</span></span></span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span><span><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><span><span></span></span></span></span></span></span></p>
<div>< ; res@tfDoNDCOverlay = True</div>
<div>< res@tfDoNDCOverlay = False </div>
<div>---</div>
<div>> res@tfDoNDCOverlay = True</div>
<div>> ; res@tfDoNDCOverlay = False </div>
<div>134,140d132<br>
</div>
<div>< u_950@lat2d = lat2d</div>
<div>< u_950@lon2d = lon2d</div>
<div>< v_950@lat2d = lat2d</div>
<div>< v_950@lon2d = lon2d</div>
<div>< geoHeight_950@lat2d = lat2d</div>
<div>< geoHeight_950@lon2d = lon2d</div>
<div>< </div>
<div>146,147c138,139</div>
<div>< ; plot = gsn_csm_vector_scalar_map(wks,<wbr>u_950(:,n_cutoff:),v_950(:,n_<wbr>cutoff:),geoHeight_950(:,n_<wbr>cutoff:),res) </div>
<div>< plot = gsn_csm_vector_scalar_map(wks,<wbr>u_950,v_950,geoHeight_950,res)<wbr> </div>
<div>---</div>
<div>> plot = gsn_csm_vector_scalar_map(wks,<wbr>u_950(:,n_cutoff:),v_950(:,n_<wbr>cutoff:),geoHeight_950(:,n_<wbr>cutoff:),res) </div>
<div>> ; plot = gsn_csm_vector_scalar_map(wks,<wbr>u_950,v_950,geoHeight_950,res)<wbr> </div>
<div><br>
</div>
<div>Did I miss anything? </div>
<br>
<p></p>
<p style="margin-top:0; margin-bottom:0"><span><span><span><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> I put the data (1.9G) at</span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"> <a href="http://www.caps.ou.edu/micronet/HurricaneImpactonO3/WRFV3.9.1/YSU/wrfchem3.9.1_ERA2d_CONUS_NLCD_NEI2011_MEGAN_nudge2.2011082500/wrfout_d01_2011-08-08_12:00:00" class="x_m_-1855891650296734960x_OWAAutoLink" id="LPlnk472645" target="_blank" previewremoved="true">http://www.caps.ou.edu/<wbr>micronet/HurricaneImpactonO3/<wbr>WRFV3.9.1/YSU/wrfchem3.9.1_<wbr>ERA2d_CONUS_NLCD_NEI2011_<wbr>MEGAN_nudge2.2011082500/<wbr>wrfout_d01_2011-08-08_12:00:00</a></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Thanks a lot!</p>
<p style="margin-top:0; margin-bottom:0">Xiaoming </p>
</div>
<hr style="display:inline-block; width:98%">
<div id="x_m_-1855891650296734960x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Mary Haley <<a href="mailto:haley@ucar.edu" target="_blank" id="LPlnk780400" previewremoved="true">haley@ucar.edu</a>><br>
<b>Sent:</b> Wednesday, April 18, 2018 7:18:48 PM<br>
<b>To:</b> xiaoming Hu<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank" id="LPlnk232197" previewremoved="true">
ncl-talk@ucar.edu</a>; Xiaoming Hu<br>
<b>Subject:</b> Re: [ncl-talk] difference between using res@tfDoNDCOverlay and @lat2d @lon2d when overlaying wind vectors</font>
<div> </div>
</div>
</div>
</div>
<div>
<div dir="ltr">
<div>
<div class="x_h5">
<div class="x_m_-1855891650296734960x_x_gmail_default" style="font-size:small">Xiaoming,</div>
<div class="x_m_-1855891650296734960x_x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default" style="font-size:small">You have an out-dated function call (WRF_map_c) that might possibly be the source of the problem. This is a deprecated function and you should use wrf_map_resources to set your WRF
map projection instead:</div>
<div class="x_m_-1855891650296734960x_x_gmail_default" style="font-size:small"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><a href="http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_resources.shtml" id="LPlnk468402" target="_blank" previewremoved="true">http://www.ncl.ucar.edu/<wbr>Document/Functions/WRF_arw/<wbr>wrf_map_resources.shtml<br>
</a></div>
</div>
</div>
<div id="x_m_-1855891650296734960LPBorder_GT_15242535099620.3968200121499177" style="margin-bottom:20px; overflow:auto; width:100%; text-indent:0px">
<table id="x_m_-1855891650296734960LPContainer_15242535099600.9257469684388908" cellspacing="0" style="width:90%; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top:1px dotted rgb(200,200,200); border-bottom:1px dotted rgb(200,200,200)">
<tbody>
<tr valign="top" style="border-spacing:0px">
<td id="x_m_-1855891650296734960TextCell_15242535099600.9540445601268872" colspan="2" style="vertical-align:top; padding:0px; display:table-cell">
<div id="x_m_-1855891650296734960LPRemovePreviewContainer_15242535099600.6667717851877681">
</div>
<div id="x_m_-1855891650296734960LPTitle_15242535099600.5324536210193809" style="color:rgb(0,120,215); font-weight:400; font-size:21px; font-family:wf_segoe-ui_light,"Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height:21px">
<a id="LPlnk789656" href="http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_resources.shtml" target="_blank" style="text-decoration:none" previewremoved="true">wrf_map_resources - CISL's NCAR Command Language (NCL)</a></div>
<div id="x_m_-1855891650296734960LPMetadata_15242535099620.8614668955147915" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:400; font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
<a href="http://www.ncl.ucar.edu" target="_blank" id="LPlnk625860" previewremoved="true">www.ncl.ucar.edu</a></div>
<div id="x_m_-1855891650296734960LPDescription_15242535099620.7195484767907574" style="display:block; color:rgb(102,102,102); font-weight:400; font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:20px; max-height:100px; overflow:hidden">
NCL Home > Documentation > Functions > WRF, Graphics routines wrf_map_resources. Sets map plotting resources based on an input WRF-ARW file. Available in version 6.1.0 and later.</div>
</td>
</tr>
</tbody>
</table>
</div>
<span class=""><br>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default">I can't tell from your code why the two results are different, because it's not clear to me if the only thing you are changing is whether or not tfDoNDCOverlay is set.</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default">If I'm understanding your email correctly, it sounds like the plot that is created when <span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline">tfDoNDCOverlay
is set to True is the one that's correct. However, I'm surprised it's working for you because:</span></div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default">[1] If you set tfDoNDCOverlay to True, you should NOT attach any lat2d/lon2d attributes to your data variables.</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default">[2] Also, if <span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline">tfDoNDCOverlay
is True, you must be using the EXACT map projection that was defined on the file. But, you are using WRF_map_c which hasn't been updated in years, so this function could likely be giving you wrong results. Also, you are setting:</span></div>
<br>
n_cutoff = 150<br>
res@mpLeftCornerLonF = lon2d(0,n_cutoff)<br>
res@mpLeftCornerLatF = lat2d(0,n_cutoff)
<div class="x_m_-1855891650296734960x_x_gmail_default"><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline"><br>
</span></div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline">which
looks to me like you are zooming in on the map, but you haven't also zoomed in on the data in the same way, so again, I don't know how your plots can be correct.</span></div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline"><br>
</span></div>
<div class="x_m_-1855891650296734960x_x_gmail_default">[3] For the case of tfDoNDCOverlay not being set, you may need to set res@gsnAddCyclic = False to prevent a longitude cyclic point from being added.</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default">Please visit this WRF examples page, which has examples of plotting WRF data with both tfDoNDCOverlay set and without it set:</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><a href="http://www.ncl.ucar.edu/Applications/wrfgsn.shtml" id="LPlnk756499" target="_blank" previewremoved="true">http://www.ncl.ucar.edu/<wbr>Applications/wrfgsn.shtml</a><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default">I've attached two modified versions of your script. Since I don't have the data, I am unable to test these scripts. But, hopefully they help show the difference between these two scenarios.</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default">If you continue to have problems with this, please post back to ncl-talk, but include a clean, updated script if possible.</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default">Good luck,</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default">--Mary</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline"><br>
</span></div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline"><br>
</span></div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><span style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small; font-style:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; background-color:rgb(255,255,255); float:none; display:inline"><br>
</span></div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
<div class="x_m_-1855891650296734960x_x_gmail_default"><br>
</div>
</span></div>
<div class="x_m_-1855891650296734960x_x_gmail_extra"><br>
<div class="x_m_-1855891650296734960x_x_gmail_quote"><span class="">On Tue, Apr 17, 2018 at 11:04 PM, xiaoming Hu
<span dir="ltr"><<a href="mailto:yuanfangcan@hotmail.com" id="LPlnk803668" target="_blank" previewremoved="true">yuanfangcan@hotmail.com</a>></span> wrote:<br>
</span>
<blockquote class="x_m_-1855891650296734960x_x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="x_m_-1855891650296734960x_x_m_-1516211398501258156divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<span class="">
<p style="margin-top:0; margin-bottom:0">Hello </p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"> If I use <span>res@tfDoNDCOverlay I got the figure of </span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
</span><span class="">
<p style="margin-top:0; margin-bottom:0"><span>But If I use @lat2d @lon2d without <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">res@tfDoNDCOverlay
I got</span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px"><br>
</span></span></p>
</span><span class="">
<p style="margin-top:0; margin-bottom:0"><span>The wind vectors near the right edge in the left panel do not follow the pressure lines now. </span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>Any comments on overlaying wind vectors using <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">res@tfDoNDCOverlay
or using <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">@lat2d @lon2d without </span><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">res@tfDoNDCOverlay
? </span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">I
attached my ncl script </span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">Thanks</span></span></span></p>
<span class="x_m_-1855891650296734960x_x_HOEnZb"><font color="#888888">
<p style="margin-top:0; margin-bottom:0"><span><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">Xiaoming </span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
</font></span></span></div>
</div>
<span class=""><br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" id="LPlnk71675" target="_blank" previewremoved="true">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" id="LPlnk33549" target="_blank" previewremoved="true">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br>
</span></blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>