[ncl-talk] WRF wind-vector vertical profile time-series

Bill Ladwig ladwig at ucar.edu
Wed Mar 15 11:05:47 MDT 2017


Hi Tabish,

To get the time series for uvmet, you can supply the wrf_user_getvar
function a time index of -1, and that will extract the uvmet variable
across all times.  For example:

files = systemfunc("ls -l wrfout_d02_2005*") + ".nc"
a = addfiles(files, "r")
uvmet_all = wrf_user_getvar(a, "uvmet", -1)

This will return an array of shape: u_v x Time x bottom_top x south_north x
west_east .

I am assuming here that you know the south_north and west_east indexes that
you want, so to get the time series of vertical columns, you would do:

uvmet_series = uvmet_all(:, :, :, your_south_north, your_west_east)

This will return an array of shape: u_v x Time x bottom_top

We're almost there.  Now you just need to use the wrf_interp_1d function (
http://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_interp_1d.shtml) to
interpolate each column to the height levels you want at each time.
 (Unfortunately, this function does not implicitly loop across all times,
so you need to manually loop for each time).

First, we need the model heights for all of the times.

heights = wrf_user_getvar(a, "z", -1)
height_series = heights(:, :, your_south_north, your_west_east)

Now, get the number of times:

dim_ht = dimsizes(height_series)
ntimes = dim_ht(0)

Create an array with your desired height levels to interpolate to (in
meters):

your_heights = (/100., 1000., 2000./)

Finally, let's loop over all times and get each interpolated column:

do t = 0,ntimes - 1
    u_interp = wrf_interp_1d(uvmet_series(0, t, :), height_series(t, :),
your_heights)
    v_interp = wrf_interp_1d(uvmet_series(1, t, :), height_series(t, :),
your_heights)
    ; Now do something with these variables
end do

If you are just looking to store the data, prior to the loop, you can
create an empty array (using new) that is 2 x ntimes x
dimsizes(your_heights) and then copy the u_interp and v_interp to this
array inside the loop.

Hope this helps,

Bill



On Fri, Mar 10, 2017 at 11:26 AM, Tabish Ansari <tabishumaransari at gmail.com>
wrote:

> Hi
>
> I wish to plot time-series of vertical profile of wind (u and v) at a
> given location (grid point) from my WRF output. The closest script I've got
> for my purpose is this:
>
> http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/
> Examples/SPECIAL/wrf_meteo_4.ncl
>
> However, this script plots model levels on the y-axis - I want height in
> metres instead. Further, this script works over a single wrfout file which
> is imported using addfile but I have multiple daily files. I generally
> import variables like: temp = a[:]->t2 but this doesn't work with
> wrf_user_getvar() method. So I need an alternate way to read in umet and
> vmet (as in the script above) where I get rotated wind vectors time-series
> from all the files in order.
>
> Could you please help me achieve this?
>
> Thanks in advance.
>
> Tabish
>
> Tabish U Ansari
> PhD student, Lancaster Environment Center
> Lancaster Univeristy
> Bailrigg, Lancaster,
> LA1 4YW, United Kingdom
>
> _______________________________________________
> 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/20170315/22fa840e/attachment.html 


More information about the ncl-talk mailing list