<div dir="ltr"><div><div><div><div>Hi ncl-talk,<br><br></div>I'm having issues trying to plot ageostrophic winds cross section across a terrain. I'm using a 12km wrf data. When I use 36km no terrain with the same script, I did not get any errors and I got very nice plots. <br><br></div><div>The 12km wrf data, to me, is very good because I was able to get other vertical cross sections across the terrain using Matlab. <br><br></div><div>Whatever help anyone can give me would be greatly apreciated<br><br></div><div>Thanks in advance!<br></div><div><br></div><div>Error Message:<br><br></div>
<p class="MsoNormal">fatal:VectorPlotDraw: VVECTR - VECTOR NDC LENGTH TOO GREAT</p>
<p class="MsoNormal">fatal:VectorPlotDraw: error drawing vectors</p>
<p class="MsoNormal">fatal:VectorPlotDraw: draw error</p>
<p class="MsoNormal">fatal:PlotManagerDraw: error in plot draw</p>
<p class="MsoNormal">fatal:_NhlPlotManagerDraw: Draw error</p>
<br></div>Varaible Outputs:<br><br>Variable: ua<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [bottom_top | 50] x [south_north | 118] x [west_east | 114]<br>Coordinates: <br>Number Of Attributes: 6<br> FieldType : 104<br> MemoryOrder : XYZ<br> description : x-wind component<br> units : m s-1<br> stagger : <br> coordinates : XLONG XLAT<br><br>Variable: va<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [bottom_top | 50] x [south_north | 118] x [west_east | 114]<br>Coordinates: <br>Number Of Attributes: 6<br> FieldType : 104<br> MemoryOrder : XYZ<br> description : y-wind component<br> units : m s-1<br> stagger : <br> coordinates : XLONG XLAT<br><br>Variable: z<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [bottom_top | 50] x [south_north | 118] x [west_east | 114]<br>Coordinates: <br>Number Of Attributes: 6<br> FieldType : 104<br> MemoryOrder : XYZ<br> description : Height<br> units : m<br> stagger : <br> coordinates : XLONG XLAT<br><br>Variable: p<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [bottom_top | 50] x [south_north | 118] x [west_east | 114]<br>Coordinates: <br>Number Of Attributes: 6<br> coordinates : XLONG XLAT<br> stagger : <br> units : hPa<br> description : Pressure<br> MemoryOrder : XYZ<br> FieldType : 104<br><br>Variable: ur<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [bottom_top | 50] x [lat | 118] x [lon | 114]<br>Coordinates: <br> lat: [31.90399932861328..44.84910202026367]<br> lon: [-128.5808258056641..-111.4191741943359]<br>Number Of Attributes: 8<br> _FillValue : 9.96921e+36<br> FieldType : 104<br> MemoryOrder : XYZ<br> description : x-wind component<br> units : m s-1<br> stagger : <br> remap : remapped via ESMF_regrid_with_weights: Bilinear remapping<br> missing_value : 9.96921e+36<br><br>Variable: vr<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [bottom_top | 50] x [lat | 118] x [lon | 114]<br>Coordinates: <br> lat: [31.90399932861328..44.84910202026367]<br> lon: [-128.5808258056641..-111.4191741943359]<br>Number Of Attributes: 8<br> _FillValue : 9.96921e+36<br> FieldType : 104<br> MemoryOrder : XYZ<br> description : y-wind component<br> units : m s-1<br> stagger : <br> remap : remapped via ESMF_regrid_with_weights: Bilinear remapping<br> missing_value : 9.96921e+36<br><br>Variable: zr<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [bottom_top | 50] x [lat | 118] x [lon | 114]<br>Coordinates: <br> lat: [31.90399932861328..44.84910202026367]<br> lon: [-128.5808258056641..-111.4191741943359]<br>Number Of Attributes: 8<br> _FillValue : 9.96921e+36<br> FieldType : 104<br> MemoryOrder : XYZ<br> description : Height<br> units : m<br> stagger : <br> remap : remapped via ESMF_regrid_with_weights: Bilinear remapping<br> missing_value : 9.96921e+36<br><br>Variable: press<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [bottom_top | 50] x [lat | 118] x [lon | 114]<br>Coordinates: <br> lat: [31.90399932861328..44.84910202026367]<br> lon: [-128.5808258056641..-111.4191741943359]<br>Number Of Attributes: 8<br> _FillValue : 9.96921e+36<br> stagger : <br> units : hPa<br> description : Pressure<br> MemoryOrder : XYZ<br> FieldType : 104<br> remap : remapped via ESMF_regrid_with_weights: Bilinear remapping<br> missing_value : 9.96921e+36<br><br>Variable: uv<br>Type: float<br>Total Size: 5380800 bytes<br> 1345200 values<br>Number of Dimensions: 4<br>Dimensions and sizes: [2] x [50] x [118] x [114]<br>Coordinates: <br>Number Of Attributes: 1<br> _FillValue : 9.96921e+36<br>(0) uv: min=-6821.45 max=7810.25<br><br>Variable: u<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [50] x [118] x [114]<br>Coordinates: <br>Number Of Attributes: 1<br> _FillValue : 9.96921e+36<br>(0) u: min=-5291.31 max=5693.54<br><br>Variable: v<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [50] x [118] x [114]<br>Coordinates: <br>Number Of Attributes: 1<br> _FillValue : 9.96921e+36<br>(0) v:min=-6821.45 max=7810.25<br><br>Variable: uageo<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [50] x [118] x [114]<br>Coordinates: <br>Number Of Attributes: 1<br> _FillValue : 9.96921e+36<br>(0) uageo:min=-5693.41 max=5288.43<br><br>Variable: vageo<br>Type: float<br>Total Size: 2690400 bytes<br> 672600 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [50] x [118] x [114]<br>Coordinates: <br>Number Of Attributes: 1<br> _FillValue : 9.96921e+36<br>(0) vageo:min=-7812.72 max=6823.08<br><br><br></div>My Script:<br><br>;======================================================================<br>; ESMF_regrid.ncl<br><br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"<br><br>begin<br><br>;---Specify method to be used<br> InterpMethod= "patch"<br><br>;---Input file<br> srcDirName = "./"<br> srcFileName = "<a href="http://wrfout_d01_2014-01-11_13_00_00.nc">wrfout_d01_2014-01-11_13_00_00.nc</a>"<br> srcFilePath = srcDirName + srcFileName<br> <br> pltres = True <br><br>;---Wgt File: WRF to Rectilinear<br> wgtDirName = "./"<br> wgtFileName = "WRF_to_Rect.WgtFile_"+InterpMethod+".nc"<br> wgtFilePath = wgtDirName + wgtFileName<br><br><br>;---Retrieve either one level, or all levels. Use '-1' for all.<br> sfile = addfile(srcFilePath,"r")<br><br> FirstTime = True<br> FirstTimeMap = True<br> times = wrf_user_getvar(sfile, "times", -1)<br> ntimes = dimsizes(times)<br><br> mdims = getfilevardimsizes(sfile, "P")<br> nd = dimsizes(mdims)<br> <br><br> ua = wrf_user_getvar(sfile,"ua",0) ; On mass grid <br> va = wrf_user_getvar(sfile,"va",0)<br> z = wrf_user_getvar(sfile,"z", 0)<br> p = wrf_user_getvar(sfile,"pressure", 0)<br><br> <br> printVarSummary(ua) ; (Time,bottom_top,south_north,west_east)<br> printVarSummary(va) ; (Time,bottom_top,south_north,west_east)<br> printVarSummary(z)<br> printVarSummary(p)<br> <br> <br><br>;---Regrid the wind components to a rectilinear grid<br> ur = ESMF_regrid_with_weights(ua,wgtFilePath,False)<br> vr = ESMF_regrid_with_weights(va,wgtFilePath,False)<br> zr = ESMF_regrid_with_weights(z,wgtFilePath, False)<br> press = ESMF_regrid_with_weights(p,wgtFilePath,False)<br> <br><br> printVarSummary(ur)<br> printVarSummary(vr)<br> printVarSummary(zr)<br> printVarSummary(press)<br><br>;---Compute the geostrophic winds on the rectilinear grid<br> lat2d = sfile->XLAT(0,:,:) ; (south_north,west_east)<br> lon2d = sfile->XLONG(0,:,:)<br><br>;---Generate the same rectilinear grid used to generate the weight file<br> dims = dimsizes(lat2d)<br> nlat = dims(0)<br> nlon = dims(1)<br><br> lat = fspan(min(lat2d), max(lat2d) ,nlat)<br> lon = fspan(min(lon2d), max(lon2d) ,nlon)<br><br>;---Calculate the geostrophic winds on a rectilinear grid<br> uv = z2geouv(zr, lat, lon, 1)<br> printVarSummary(uv)<br> print("uv: min="+min(uv)+" max="+max(uv))<br><br>;----Calculate the geostrophic u wind component on a rectilinear grid<br> u = uv(0,:,:,:)<br> printVarSummary(u)<br> print("u: min="+min(u)+" max="+max(u))<br><br>;----Calculate the geostrophic v wind component on a rectinlinear grid<br> v = uv(1,:,:,:) <br> printVarSummary(v)<br> print("v:min="+min(v)+" max="+max(v)) <br><br>;---Calculate the uageo component<br> uageo = ur - u<br> printVarSummary(uageo)<br> print("uageo:min="+min(uageo)+" max="+max(uageo))<br><br>;---Calculate the vageo component<br> vageo = vr - v<br> printVarSummary(vageo)<br> print("vageo:min="+min(vageo)+" max="+max(vageo))<br>;----------------------------------------------------------------------<br> opt = False<br> plane = new(4, float)<br> plane = (/ 63,37 , 63,72 /)<br> uageo_plane = wrf_user_intrp3d(uageo, p, "v", plane, 0.0, opt)<br> vageo_plane = wrf_user_intrp3d(vageo, p, "v", plane, 0.0, opt)<br> x_plane = wrf_user_intrp2d(lat2d, plane, 0.0, opt)<br><br>;--Let's create nice labels - only have to do this one<br> if ( FirstTime ) then<br> zmax = 200. ; Place top at model top or close to zmax<br> zz = wrf_user_intrp3d(p,p,"v",plane,0.,opt)<br> z_ind = ind(.not.ismissing(zz(:,0)))<br> zmin = zz(z_ind(0),0)<br> delete(z_ind)<br> nice_levs = floor((zmin-zmax)/50)*50<br> zmax = zmin - nice_levs<br> dims = dimsizes(zz)<br> zmax_pos = dims(0)-1<br> do imax = 1,dims(0)-1<br> if ( .not.ismissing(zz(imax,0)) .and. zz(imax,0) .ge. zmax ) then<br> zmax_pos = imax<br> end if<br> end do<br> zspan = zmax_pos<br> zmax = zz(zmax_pos,0)<br> nz = floattoint((zmin-zmax)/50+1)<br> FirstTime = False<br> end if<br><br><br>;-- x-axis labeles<br> dimsX = dimsizes(x_plane)<br> xmin = x_plane(0)<br> xmax = x_plane(dimsX(0)-1)<br> xspan = dimsX(0)-1<br> nx = floattoint( (xmax-xmin)/0.5 + 1)<br><br><br>; create plots: Note some defaults chaanged in NCL v6.1.0<br>;************************************************<br> wks_type = "png"<br> wks_type@wkWidth = 2500<br> wks_type@wkHeight = 2500 <br> wks = gsn_open_wks("png","ESMF")<br> <br> gsn_define_colormap(wks,"matlab_jet") ; this is the default v6.1.0 onward<br><br> res = True<br> res@tiXAxisString = "Latitude"<br> res@tiYAxisString = "Pressure (mb)"<br> res@tmXTOn = False<br> res@tmYROn = False<br> res@tmXBMode = "Explicit"<br> res@tmXBValues = fspan(0, xspan, nx) <br> res@tmXBLabels = sprintf("%.1f",fspan(xmin,xmax,nx))<br> res@tmXBTickSpacingF = 1.0<br> res@tmXBLabelFontHeightF = 0.015<br> res@tmYLMode = "Explicit"<br> res@tmYLValues = fspan(0, zspan, nz)<br> res@tmYLLabels = sprintf("%.1f",fspan(zmin, zmax, nz))<br> res@tiXAxisFontHeightF = 0.015<br> res@tiYAxisFontHeightF = 0.015<br> res@tmXBMajorLengthF = 0.02<br> res@tmYLMajorLengthF = 0.02<br> res@tmYLLabelFontHeightF = 0.015<br><br> <br> res1 = res<br> res1@gsnDraw = False ; don't draw<br> res1@gsnFrame = False ; don't advance frame<br> ; res1@gsnAddCyclic = False ; regional data<br> res1@vcLineArrowThicknessF = 3.0<br> res1@vcRefMagnitudeF = 10<br> res1@vcRefLengthF = 0.018<br> ; res1@gsnLeftString = ""<br> ; res1@gsnRightString = ""<br> res1@vcGlyphStyle = "LineArrow"<br> res1@vcMinDistanceF = 0.05<br> res1@vcRefAnnoOn = True <br> res1@gsnMaximize = True<br> res1@tiMainString = "Ageostrophic Winds Cross Section on Jan 11 at 13UTC"<br> res1@tiMainFontHeightF = 0.018<br> <br> <br> <br>ageo = gsn_csm_vector(wks, uageo_plane(0:zmax_pos,:), vageo_plane(0:zmax_pos,:), res1)<br><br><br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br><br>draw(ageo)<br>frame(wks)<br> <br>end<br><br><br></div>