[ncl-talk] How to combine many nc files from different folders

Dennis Shea shea at ucar.edu
Tue Sep 17 15:27:34 MDT 2019


As the message states, the file is "*corrupted*".  This is not an NCL
issue.

[1] delete the file[s] and try reacquiring them
[2] Possibly, the source files are corrupted.
---
FYI: There are some Persiann examples.
*https://www.ncl.ucar.edu/Applications/HiResPrc.shtml*
<https://www.ncl.ucar.edu/Applications/HiResPrc.shtml>



On Tue, Sep 17, 2019 at 12:15 PM Setareh Rahimi <setareh.rahimi at gmail.com>
wrote:

> Dear Adam, and Dennis,
> Thanks for your help. hopefully I could combine those files together, but
> NCL tells there is something wrong with some files (attached image). In
> order to check what could be wrong, I redownload 1983 files again and got
> many warning for the second time. Any suggestion to remove those warning,
> please?
> Best wishes,
>
> On Tue, Sep 17, 2019 at 10:14 PM Dennis Shea <shea at ucar.edu> wrote:
>
>> Given your screen shot, the following will likely work:
>>
>> fils= *systemfunc*
>> <https://www.ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml>("ls
>> [1-2][8-9-0-1]*/*nc")
>> print(fils)
>>
>> f    = *addfiles*
>> <https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml>
>> (fils, "r")
>> x   = f[:]->X
>> *printVarSummary*(x)
>>
>> On Tue, Sep 17, 2019 at 9:57 AM Adam Phillips via ncl-talk <
>> ncl-talk at ucar.edu> wrote:
>>
>>> Hi Setareh,
>>> See the examples on the addfiles documentation page:
>>> https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
>>>
>>> Whatever syntax works in your shell, will work for NCL. For instance
>>> this might work:
>>> fils = systemfunc ("ls */*.nc") ; file paths
>>> print(fils)
>>> f    = addfiles (fils, "r")
>>> IF the only files in the directories are the ones your want, the
>>> ordering is what you want, etc. See the output from print(fils). This may
>>> take some trial and error, but the goal will be to set the correct syntax
>>> within systemfunc to see only the files you want in the correct order that
>>> you need them.
>>> Adam
>>>
>>>
>>> On Tue, Sep 17, 2019 at 4:01 AM Setareh Rahimi via ncl-talk <
>>> ncl-talk at ucar.edu> wrote:
>>>
>>>> Dear all,
>>>>
>>>> I have daily precipitation data from 1983-2017. Each year has been
>>>> saved in one separate folder (have a look at attached image). I need to
>>>> combine all these data to have a climatological average of precipitation.
>>>> My problem is that, how can I indicate the path of data to NCL, to find all
>>>> the data set. The script I use is in the same folder that data has been
>>>> saved. the script attached. Please kindly advice me on this issue.
>>>> Many thanks in advance,
>>>> Best wishes,
>>>> --
>>>> S.Rahimi
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>>
>>> --
>>> Adam Phillips
>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>
>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
> --
> S.Rahimi
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190917/4220b59b/attachment.html>


More information about the ncl-talk mailing list