[ncl-talk] addfiles to join variables from two files

Adam Phillips asphilli at ucar.edu
Tue Oct 25 15:02:15 MDT 2016


Hi Juris,
When using addfiles as opposed to addfile you need to change your read-in
syntax a bit. Change this:
xlat = f->XLAT
to this:
xlat = f[0]->XLAT

I'm assuming in the above that the first listed file (files(0)) has
XLAT/XLONG in it.

When you go to read in a variable across files you would do something like
this:
tk = f[:]->TK

Refer to the addfiles documentation page here for more information:
http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml

Hope that helps. If you have further questions please respond to the
ncl-talk email list.
Adam

On Tue, Oct 25, 2016 at 2:57 PM, Juris Almonte <Juris.Almonte at umanitoba.ca>
wrote:

> Hi  NCL talk,
>
> I have several hourly output files with variables such as TK, RH, etc. and
> one file with the coordinate/constant variables within them (e.g. XLAT,
> XLONG). I would like to join the constants variables file with the hourly
> output file.
>
> I have tried using the addfiles function without success where only one
> hourly file
>
> ncl 0> files = systemfunc("ls *.nc")
> ncl 1> f = addfiles(files,"r")
> ncl 2> ListSetType (f, "join")
> ncl 3> xlat = f->XLAT
> fatal:(f) not reference to a valid file
> fatal:["Execute.c":8573]:Execute: Error occurred at or near line 3
>
> ncl 4> printVarSummary(f)
>
> Variable: f
> Type: list <join | fifo>
> Total items: 2
>
> ncl 5>
>
> I know NCO can do this with the use of ncecat, however, I want the data to
> stay intact as individual hourly files.
>
> Is there a way to do this in NCL?
>
> Thanks in advance,
>
> Juris
> M.Sc. Student
> University of Manitoba
>
> _______________________________________________
> 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/20161025/063cb16e/attachment.html 


More information about the ncl-talk mailing list