[ncl-talk] Merging two .nc file

Appo derbetini appopson4 at gmail.com
Tue Jun 9 12:04:16 MDT 2015


You can do it easily with cdo

cdo mergetime  file_1981_1990.nc    file_1991_2000.nc  file_1981_2000.nc

2015-06-09 16:29 GMT+01:00 Alan Brammer <abrammer at albany.edu>:

> This can be done in about 7 lines in ncl (less if really desired). This
> should be used a pseudocode and edited to work.  If you don't understand
> the below look at the documentation. For bigger files this would not be the
> best solution but for data ~1MB this should be fine.
> This relies on the the data being consistent and only time changing.
>
>
> filenames = (/"tasmax...","tasmax..."/)
> infiles = addfiles(filenames, "r")
> listSetType(infiles, "cat")
>
> var = "variable_name"
> data = infiles[:]->$var$
>
> ncout = addfile("tasmax_all.nc","c")
> ncout->$var$ = data
>
>
>
>
> On 9 June 2015 at 10:09, amit timilsina <timilsinaamit87 at huskers.unl.edu>
> wrote:
>
>>
>> The attached two files contain three co-ordinates with similar latitude
>> and longitude co-ordinates but differ in time periods (1981-1990 and
>> 1991-2000). Now I want to merge two files to get new file with values of
>> tasmax from 1981-2000 for same latitude and longitude combination. Any link
>> and suggestions to go through will be highly appreciated.
>>
>> Regards,
>> Amit Prasad Timilsina
>> Ph D student
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
> _______________________________________________
> 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/20150609/29bf4134/attachment.html 


More information about the ncl-talk mailing list