# [ncl-talk] Extracting Time Series From WRF Output

Zilore Mumba zmumba at gmail.com
Fri Apr 24 06:35:56 MDT 2020

```Thank you very much Dennis.
You explanation will permit me to advance in my attempt. However its seems
to me wrf coordinates are "a simple thing made hard".
Thank you very much

On Fri, Apr 24, 2020 at 4:42 AM Dennis Shea via ncl-talk <ncl-talk at ucar.edu>
wrote:

> The syntax *{...} *can ONLY be used with a special type of variable
> called a *coordinate variable [CV]*
> A CV is a one where the variable name *and* the dimension names are
> identical.
> eg:  lat(lat),  lon(on), latitude(latitude) .   etc
>
> The WRF variables containing the geographic coordinates are two-or-three
> dimensions.
> XLAT ( Time, south_north, west_east )
> XLONG(...)
>
> Hence, they are not CVs.
> Use the *getind_latlon2d *f
> <http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml>unction.
>
>   lat2d = f[0]->XLAT(0,:,:)
>   lon2d = f-[0]>XLONG(0,:,:)
>
>   printVarSummary(lat2d)
>   printMinMax(lat2d, 0)
>   printMinMax(lon2d, 0)
>
>   lat   = (/  -18  /)   ; user specified coordinate pairs
>   lon   = (/ -30  /)
>                                           ; return 2d subscripts
>   nm = *getind_latlon2d* (lat2d,lon2d, lat, lon)
>   print(nm)
>
>   x = a[:]->T2(:,n,m)
>   y = a[:]->V(:,{2},n,m)
>
>
>
> On Thu, Apr 23, 2020 at 4:31 PM zilore mumba via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Hello once again.
>> I am hoping someone may have a script which they can share,or correct my
>> code below where I am attempting to extract a time series. From the
>> assistance I got a few days ago, I am able to write values at a given
>> location at the surface T2) and a a fixed level (V). Though I am getting
>> several warnings, firstly
>>
>> Dimension (west_east) and (south_north) of file
>> (wrfout_d01_2020-02-03_00:00:00) does not have an associated coordinate
>> variable
>> and
>>
>> warning:Invalid stride: stride must be positive non-zero integer
>>
>> But my problem is that I am not able to select the forecast time of the
>> series, i.e e.g. daily time series of the forecast at 0600UTC. Currently I
>> am printing 484 values from 12 files each with forecast range of 120H (5
>> days). I am not able to tell which value corresponds to what forecast range
>> and why they are 484.
>> Is there a way to select for x and y (in the code below) the specific
>> time step for the time series?
>>
>> Help will be appreciated
>>
>> begin
>>   files = systemfunc("ls -1 data/wrfout_d01_2020*") + ".nc"
>>
>>   ListSetType (a, "cat")          ; concatenate (=default)
>>
>>   varnames = getfilevarnames(a[0]) ; get var names from the first file
>>   print(varnames)
>>
>>   x = a[:]->T2(:,{-18},{30})
>>   y = a[:]->V(:,{2},{-18},{30})
>>
>>   asciiwrite("Lusaka.txt", x)
>>   asciiwrite("Lusaka2.txt", y)
>>
>> end
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> 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/20200424/baccbfb5/attachment.html>
```