[ncl-talk] A problem when I use wrf_user_vert_interp function

Bill Ladwig ladwig at ucar.edu
Fri Apr 13 07:56:49 MDT 2018


Hi Fangda,

You need to set the time index in your options to wrf_user_vert_interp by
using the "time" attribute for your options Boolean (see
https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_vert_interp.shtml).
By default, the time index is -1, which is going to extract all the times
for pressure, thus creating a 4th dimension for pressure, while your field
of interest is only 3. This is what the error is complaining about. Make
sure this time index matches the time index for your field of interest when
it was extracted.

Hope this helps,

Bill



On Fri, Apr 13, 2018, 1:38 AM Fangda <tengfangda at gmail.com> wrote:

> Hello Everyone
>
> I use ncl 6.4.0 under Cygwin on Windows, when I deal with wrfout_* files
> generated by WRF, I have this problem:
> I just want to plot a cross section through a specific longitude and
> pressure levels, so I decide to use qrain2 =
> wrf_user_vert_interp(a,qrain,"pressure",level,opts)
> to interpolate the model data to pressure level and then use qrain3 =
> rcm2rgrid_Wrap(lat2d,lon2d,qrain2,lat,lon,1) to interpolate the data to
> longitude-latitude grids.
>
> But I got this fatal message:
>
>> fatal:wrf_vintrp: The pres and field arrays must have the same
>> dimensionality
>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 2348 in
>> file /usr/local/ncl6.4.0/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 83 in
>> file wrf_cross_q_pl2.ncl
>
>
> Here is part of my code:
>
>> lon = fspan(110,125,15)
>> lat = fspan(25,55,30)
>> level = ispan(200,1000,100)
>> lon at units = "degrees_east"
>> lat at units = "degrees_noeth"
>> level at units = "hPa"
>> a = addfile("wrfout_d01","r")
>> times = wrf_user_getvar(a,"times",-1)
>> lat2d = wrf_user_getvar(a,"XLAT",0)
>> lon2d = wrf_user_getvar(a,"XLONG",0)
>> opts = True
>> do it = 0,ntimes-1,12
>> qrain = wrf_user_getvar(a,"QRAIN",it)
>> qrain2 = wrf_user_vert_interp(a,qrain,"theta",level,opts)
>> qrain3 = rcm2rgrid_Wrap(lat2d,lon2d,qrain2,lat,lon,1)
>> qrain3!0 = "pressure"
>> qrain3!1 = "lat"
>> qrain3!2 = "lon"
>> qrain3&pressure = level
>> qrain3&lat = lat
>> qrain3&lon = lon
>> plot(ii) = gsn_csm_pres_hgt(wks,qrain3(:,:,{115}),res)
>> end do
>
>
> What's wrong with my code? And is this a correct method to plot a cross
> section through a specific longitude and pressure levels?
>
> Fangda
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180413/a3f7f033/attachment.html>


More information about the ncl-talk mailing list