<div dir="ltr"><div><div><div><div>Hi ncl-talk,<br><br></div>I&#39;m having issues trying to plot ageostrophic winds cross section across a terrain.  I&#39;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 &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl&quot;<br><br>begin<br><br>;---Specify method to be used<br>    InterpMethod= &quot;patch&quot;<br><br>;---Input file<br>    srcDirName  = &quot;./&quot;<br>    srcFileName = &quot;<a href="http://wrfout_d01_2014-01-11_13_00_00.nc">wrfout_d01_2014-01-11_13_00_00.nc</a>&quot;<br>    srcFilePath =  srcDirName + srcFileName<br>    <br>   pltres = True <br><br>;---Wgt File: WRF to Rectilinear<br>    wgtDirName  = &quot;./&quot;<br>    wgtFileName = &quot;WRF_to_Rect.WgtFile_&quot;+InterpMethod+&quot;.nc&quot;<br>    wgtFilePath =  wgtDirName + wgtFileName<br><br><br>;---Retrieve either one level, or all levels. Use &#39;-1&#39; for all.<br>    sfile = addfile(srcFilePath,&quot;r&quot;)<br><br>    FirstTime = True<br>    FirstTimeMap = True<br>    times = wrf_user_getvar(sfile, &quot;times&quot;, -1)<br>    ntimes = dimsizes(times)<br><br>    mdims = getfilevardimsizes(sfile, &quot;P&quot;)<br>    nd = dimsizes(mdims)<br>   <br><br>    ua   = wrf_user_getvar(sfile,&quot;ua&quot;,0)    ; On mass grid <br>    va   = wrf_user_getvar(sfile,&quot;va&quot;,0)<br>    z    = wrf_user_getvar(sfile,&quot;z&quot;, 0)<br>    p    = wrf_user_getvar(sfile,&quot;pressure&quot;, 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-&gt;XLAT(0,:,:)               ; (south_north,west_east)<br>    lon2d = sfile-&gt;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(&quot;uv: min=&quot;+min(uv)+&quot;   max=&quot;+max(uv))<br><br>;----Calculate the geostrophic u wind component on a rectilinear grid<br>    u = uv(0,:,:,:)<br>    printVarSummary(u)<br>    print(&quot;u: min=&quot;+min(u)+&quot;   max=&quot;+max(u))<br><br>;----Calculate the geostrophic v wind component on a rectinlinear grid<br>   v = uv(1,:,:,:) <br>   printVarSummary(v)<br>   print(&quot;v:min=&quot;+min(v)+&quot;    max=&quot;+max(v))          <br><br>;---Calculate the uageo component<br> uageo = ur - u<br>   printVarSummary(uageo)<br>   print(&quot;uageo:min=&quot;+min(uageo)+&quot;  max=&quot;+max(uageo))<br><br>;---Calculate the vageo component<br>  vageo = vr - v<br>  printVarSummary(vageo)<br>  print(&quot;vageo:min=&quot;+min(vageo)+&quot;  max=&quot;+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, &quot;v&quot;, plane, 0.0, opt)<br>  vageo_plane = wrf_user_intrp3d(vageo, p, &quot;v&quot;, plane, 0.0, opt)<br>  x_plane  = wrf_user_intrp2d(lat2d, plane, 0.0, opt)<br><br>;--Let&#39;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,&quot;v&quot;,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 = &quot;png&quot;<br>    wks_type@wkWidth = 2500<br>    wks_type@wkHeight = 2500  <br>   wks = gsn_open_wks(&quot;png&quot;,&quot;ESMF&quot;)<br>            <br>  gsn_define_colormap(wks,&quot;matlab_jet&quot;)     ; this is the default v6.1.0 onward<br><br>   res = True<br>   res@tiXAxisString = &quot;Latitude&quot;<br>   res@tiYAxisString = &quot;Pressure (mb)&quot;<br>   res@tmXTOn        = False<br>   res@tmYROn        = False<br>   res@tmXBMode      = &quot;Explicit&quot;<br>   res@tmXBValues    = fspan(0, xspan, nx) <br>   res@tmXBLabels    = sprintf(&quot;%.1f&quot;,fspan(xmin,xmax,nx))<br>   res@tmXBTickSpacingF = 1.0<br>   res@tmXBLabelFontHeightF  = 0.015<br>   res@tmYLMode      = &quot;Explicit&quot;<br>   res@tmYLValues    = fspan(0, zspan, nz)<br>   res@tmYLLabels    = sprintf(&quot;%.1f&quot;,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&#39;t draw<br>    res1@gsnFrame             = False           ; don&#39;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         = &quot;&quot;<br>   ; res1@gsnRightString         = &quot;&quot;<br>    res1@vcGlyphStyle          = &quot;LineArrow&quot;<br>    res1@vcMinDistanceF        = 0.05<br>    res1@vcRefAnnoOn           = True   <br>    res1@gsnMaximize           = True<br>    res1@tiMainString          = &quot;Ageostrophic Winds Cross Section on Jan 11 at 13UTC&quot;<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>