[ncl-talk] Getting time series from several files in ncl

Rick Brownrigg brownrig at ucar.edu
Sun Apr 19 15:53:19 MDT 2020


Perhaps do a printVarSummary(a[0]->T2)  ; it sounds like its not the shape
you think it might/should be; i.e. 3D vs 4D



On Sun, Apr 19, 2020 at 3:29 PM zilore mumba <zmumba at yahoo.com> wrote:

>
>
> On Sunday, April 19, 2020, 11:27:47 PM GMT+2, zilore mumba <
> zmumba at yahoo.com> wrote:
>
>
> Thanks Rick, that is close. The error am getting now is:
> fatal:Number of subscripts on rhs do not match number of dimensions of
> aggregated cat type variable, (4) Subscripts used, (3) Subscripts expected
>
> On Sunday, April 19, 2020, 10:17:12 PM GMT+2, Rick Brownrigg <
> brownrig at ucar.edu> wrote:
>
>
> HI Zilore,
>
> I think the issue is that addfiles() return a *list* of filevars, where
> addfile returns a single filevar.  Lists are indexed with [ ] notation;
> perhaps something like this will work:
>
>   x = a[:]->T2(0,{850},{-15},{30})
>
> Rick
>
> On Sun, Apr 19, 2020 at 1:54 PM zilore mumba via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
> I am trying to get time series at given locations from several WRF output
> files, e.g. 48H forecast temperature at 850hPa. Each file contains a day's
> model run.
> I have used ncl for years by adapting existing scripts, without really
> understanding. One issue I have difficulty with is getting variables from a
> file, especially WRF output.
> I thought the script to get a time series at 15S, 30E would be as simple
> as the one below. I am able to print the varsummary, but printing x tells
> me that "a is not a valid file reference.
> I would appreciate ant assistance.
> begin
> files = systemfunc("ls -1 data/wrfout_d01_2020*") + ".nc"
>   a = addfiles(files,"r")
>
>   ListSetType (a, "cat")          ; concatenate (=default)
>   tc = wrf_user_getvar(a,"tc",0)
>   printVarSummary (tc)
>
>   x = a->T2(0,{850},{-15},{30})
>   asciiwrite("outfile.txt",x)
> end
>
> Zilore Mumba
> _______________________________________________
> 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/20200419/1458e762/attachment.html>


More information about the ncl-talk mailing list