[ncl-talk] Adding multiple WRF output files to a script

Mary Haley haley at ucar.edu
Mon Aug 29 14:21:58 MDT 2016


It appears that you are using "addfiles" to open a bunch of WRF files that
are from different domains. I assume these different domain files are of
different spatial sizes, and hence addfiles shouldn't be used to open all
of them together.

Addfiles is really mean to be used on similar files, for example, files
with the same spatial dimensions, but across different times or ensembles.

It's not clear to me what you are trying to accomplish with your original
script, because you have a couple of calculations, but nothing is really
done with them.

In any case, I suggest that since you are calling different types of files,
you will need to call "addfile" inside the loop for each file, and do the
necessary calculation:

  FILES = systemfunc (" ls -1 " + DATADir + "wrfout* ")
  nfiles = dimsizes(FILES)

  do nf = 0,nfiles-1         ; # of files loop
    f = addfile(FILES(nf))+".nc","r")
    times = wrf_user_list_times(f)
    ntimes = dimsizes(ntimes)

    u = wrf_user_getvar(f,"ua",-1)      ; u averaged to mass points
    v = wrf_user_getvar(f,"va",-1)      ; v averaged to mass points
. . .



On Mon, Aug 29, 2016 at 6:35 AM, Muhammad Omer Mughal <
m.mughal1 at postgrad.curtin.edu.au> wrote:

> Hi Mary
>
>
> Thanks for the reply. Kindly note intially ntimes was not defined due to
> error in the line
>
>
> ntimes = dimsizes(ntimes)
>
> so I changed it to
>
> ntimes = dimsizes(times)
>
>
> After that I get the error the detail of which is listed in the attached
> file.
>
>
>
> Muhammad Omer Mughal
> MSc BSc Mechanical Engineering
> PhD  Research Scholar
> Remote Sensing and Satellite Research Group
> Department of Imaging and Applied Physics
> Curtin University
>
> Curtin University
> Tel | +61 8 9266 7962
> Fax | +61 8 9266 2377
> Mobile | 0470 237 525
>
> Email | m.mughal1 at postgrad.curtin.edu.au <m.lynch at curtin.edu.au>
> Web | http://curtin.edu.au
>
> Curtin University is a trademark of Curtin University of Technology.
> CRICOS Provider Code 00301J (WA), 02637B (NSW)
>
>
> ------------------------------
> *From:* Mary Haley <haley at ucar.edu>
> *Sent:* Saturday, 27 August 2016 3:22:53 AM
> *To:* Muhammad Omer Mughal
> *Cc:* ncl-talk at ucar.edu
> *Subject:* Re: [ncl-talk] Adding multiple WRF output files to a script
>
> Dear Muhammad,
>
> The script you provided wouldn't run as-is, because you are referencing
> "times", but never setting it.
>
> Also, you are calling "addfiles" inside a do loop across the file names,
> but addfiles is meant to be used on an array of files.
>
> In the future, it would help if you provide the exact error message, and
> the full script, so we can see what line number the script is failing on.
>
> See the attached wrf_script_mod which is a modification of your file.
> It's likely not going to run, but hopefully it will help you get started in
> using addfiles correctly.
>
> --Mary
>
>
> On Fri, Aug 26, 2016 at 4:08 AM, Muhammad Omer Mughal <
> m.mughal1 at postgrad.curtin.edu.au> wrote:
>
>> Hi
>>
>>
>> I am trying to add multiple wrfoutput files in the attached script but I
>> get an  error of mismatch dimensions. Can some one help please
>>
>>
>>
>>
>>
>> Muhammad Omer Mughal
>> MSc BSc Mechanical Engineering
>> PhD  Research Scholar
>> Remote Sensing and Satellite Research Group
>> Department of Imaging and Applied Physics
>> Curtin University
>>
>> Curtin University
>> Tel | +61 8 9266 7962
>> Fax | +61 8 9266 2377
>> Mobile | 0470 237 525
>>
>> Email | m.mughal1 at postgrad.curtin.edu.au <m.lynch at curtin.edu.au>
>> Web | http://curtin.edu.au
>>
>> Curtin University is a trademark of Curtin University of Technology.
>> CRICOS Provider Code 00301J (WA), 02637B (NSW)
>>
>>
>>
>> _______________________________________________
>> 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/20160829/f20a5c44/attachment.html 


More information about the ncl-talk mailing list