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

Adam Phillips asphilli at ucar.edu
Tue Sep 17 09:57:10 MDT 2019


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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190917/a867aa29/attachment.html>


More information about the ncl-talk mailing list