<div dir="ltr"><div>Hi all,<br><br></div>I am trying to do a simple wrf_map_overlays, but I keep getting a blank image and I do not understand why. The field that I am trying to contour and use for vectors I get from a seperate .nc file. Also I should mention that I am not using winds for the vectors. They are the x- and y- components of my vector value (IVT : Integrated vapor transport). All the data from the .nc files is there because I checked it with ncdump. Also, I get no errors out of the output from NCL. <br>
<div><br></div><div>here is my script below:<br></div><div><br><br clear="all"><span style="color:rgb(11,83,148)">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)">load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">begin</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> case ="3dvar_t1"</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> if (case.eq."run3.1" .or. case.eq."n3") then</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> cmd ="ls -1 /data2/eiserloh/data/AR/" + case + "/wrfout_d02_2012*" ;frost</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> else</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> cmd ="ls -1 /data2/eiserloh/data/" + case + "/wrfout_d02_2012*" ;thunder</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> end if</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> files = systemfunc(cmd) + ".nc"</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> a = addfiles(files,"r")</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> time = wrf_user_list_times(a) ; get times in the files</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> lat2d=wrf_user_getvar(a[0],"lat",0)</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> lon2d=wrf_user_getvar(a[0],"lon",0)</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ivt_file=case+"_<a href="http://ivt_6hrly.nc">ivt_6hrly.nc</a>"</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> b = addfile(ivt_file,"r")</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> times = b->times</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> IVT = b->IVT</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> IVT_x = b->IVT_x</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> IVT_y = b->IVT_y</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)">; IVT@lat2d = lat2d</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; IVT@lon2d = lon2d</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; IVT_x@lat2d = lat2d</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)">; IVT_x@lon2d = lon2d</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; IVT_y@lat2d = lat2d</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; IVT_y@lon2d = lon2d</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ntimes = dimsizes(times)</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; We generate plots, but what kind do we prefer?</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> type = "ps"</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; type = "png"</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> type@wkOrientation = "landscape"</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> wks = gsn_open_wks(type,case+"_ivt")</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> gsn_define_colormap(wks,"BlAqGrYeOrRe")</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; Set some basic resources</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> res = True</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> res@gsnDraw = False</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> res@gsnFrame = False</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> res@MainTitle = " "</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> res@Footer = False</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> MTOPosF = -0.05</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> pltres = True</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> mpres = True</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> colr = "black"</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> mpres@gsnMaximize = True</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> mpres@mpGeophysicalLineColor = colr</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> mpres@mpNationalLineColor = colr</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> mpres@mpUSStateLineColor = colr</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> mpres@mpGridLineColor = colr</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> mpres@mpLimbLineColor = colr</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> mpres@mpPerimLineColor = colr</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> mpres@mpOutlineBoundarySets = "GeophysicalandUSStates"</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> mpres@mpGeophysicalLineThicknessF = 1.5</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> mpres@mpUSStateLineThicknessF = 1.5</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> mpres@mpGridLineThicknessF = 1.0</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> mpres@mpLimbLineThicknessF = 1.0</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> mpres@mpNationalLineThicknessF = 1.5</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> mpres@mpUSStateLineThicknessF = 1.5</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> mpres@mpGridLineDashPattern = 1.5</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> mpres@mpDataBaseVersion = "MediumRes"</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> mpres@mpDataSetName = "Earth..4"</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> pltres@PanelPlot = True</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> pltres@LatLonOverlay = True</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; What times and how many time steps are in the data set?</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">hour_int=6</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; do it = 0,ntimes-1 ; TIME LOOP</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> do it =0,1</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> f=it*hour_int</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> print("Working on time: " + time(f) )</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> res@TimeLabel = times(it) ; Set Valid time to use on plots</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)">; u = wrf_user_getvar(a[f],"ua",0) ; u averaged to mass points</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; v = wrf_user_getvar(a[f],"va",0) ; v averaged to mass points</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)">; ws = ((u^2)+(v^2))^(0.5) ; Wind speed</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ter = wrf_user_getvar(a[f],"ter",0) </span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)">; p = wrf_user_getvar(a[f],"pressure",0)</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ;mandatory pressure levels</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)">; mplevs=(/1000.,925.,850.,700.,500.,300./)</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> </span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ;get u at mandatory plevs for vectors for plot</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)">; u_mpls=wrf_user_intrp3d(u,p,"h",mand_pres_levs,0.,False)</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; v_mpls=wrf_user_intrp3d(v,p,"h",mand_pres_levs,0.,False)</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> </span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; u_bar=dim_sum_n(u_mpls,0) </span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">; v_bar=dim_sum_n(v_mpls,0)</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ; Plotting Time</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> slp = wrf_user_getvar(a[f],"slp",0) ; slp</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> res@InitTime = False</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> res@ValidTime = False</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> res@NoHeaderFooter = True</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> tt=slp</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> tt@description = " Valid " + times(it)</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> tt@units = "UTC"</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts=res</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@ContourParameters = (/1., 2., 1./)</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@cnFillColors = -1</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@lbTitleOn = False</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@cnInfoLabelOn = False</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@sfXArray = lon2d</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@sfYArray = lat2d</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> title = wrf_contour(a[f],wks,tt,opts)</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> delete(opts)</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ; Plotting options IVT contour fill </span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts = res </span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@cnFillOn = True </span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@ContourParameters = (/ 0., 800., 50. /)</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@lbOrientation = "Vertical"</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@pmLabelBarSide = "Right"</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@pmLabelBarOrthogonalPosF= -0.04</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@lbTitleOn = False</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@FieldTitle = IVT@description</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@sfXArray = lon2d</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@sfYArray = lat2d</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> contour = wrf_contour(a[f],wks,IVT(it,:,:),opts)</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> delete(opts)</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ; Plotting Opts for Terrain Contours</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts=res</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@cnFillOn=False</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@ContourParameters=(/0.,5000.,250./)</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@FieldTitle = "Elevation (m)"</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@cnLineLabelInterval = 0</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@sfXArray = lon2d</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@sfYArray = lat2d</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> terrain = wrf_contour(a[f],wks,ter,opts)</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> delete(opts)</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> ; Overplot Vectors </span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts = res </span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ; opts@vcGlyphStyle = "LineArrow"</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@FieldTitle = "IVT Vectors" ; overwrite Field Title</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@NumVectors = 25 ; wind barb density</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> opts@vfXArray = lon2d</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> opts@vfYArray = lat2d</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> vector = wrf_vector(a[f],wks,IVT_x(it,:,:),IVT_y(it,:,:),opts)</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> delete(opts)</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ; MAKE PLOTS </span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> plot = wrf_map_overlays(a[f],wks,(/contour,vector,terrain,title/),pltres,mpres)</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> draw(plot)</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> frame(wks)</span><br style="color:rgb(11,83,148)"><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> end do ; END OF TIME LOOP</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> ; cmd = "convert "+case+"_<a href="http://ivt.ps">ivt.ps</a> -rotate '-90<' "+case+"_ivt.png"</span><br style="color:rgb(11,83,148)">
<span style="color:rgb(11,83,148)"> cmd = "convert "+case+"_<a href="http://ivt.ps">ivt.ps</a> "+case+"_ivt.png"</span><br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)"> system(cmd)</span><br style="color:rgb(11,83,148)">
<br style="color:rgb(11,83,148)"><span style="color:rgb(11,83,148)">end</span><br><br></div><div>Thanks,<br><br></div><div>-- <br><div dir="ltr">Arthur J. Eiserloh, Jr.<div>San Jose State University </div><div>Graduate Student</div>
<div>Dept. of Meteorology and Climate Science</div></div>
</div></div>