Re : concatenate pairs of files

From: louis Vonder <appopson_at_nyahnyahspammersnyahnyah>
Date: Mon Mar 31 2014 - 23:23:59 MDT

Dear Jiaxin,

What about using nco or cdo

with nco you can do: ncrcat site1_tair_*.nc output_files
with cdo you can do: cdo mergetime site1_tair_*.nc output_file

Regards

--------------------------------------------
En date de : Mar 1.4.14, Jiaxin Zhang <jiaxinzhang3@gmail.com> a écrit :

 Objet: [ncl-talk] concatenate pairs of files
 À: "ncl-talk@ucar.edu maillist" <ncl-talk@ucar.edu>
 Date: Mardi 1 avril 2014, 4h13
 
 Dear NCL
 users,
  
 I have one question
 about concatenate pairs of netcdf
 files.
  
 I need to concatenate
 two netcdf files and create a new netcdf file including
 information of both netcdf files. Attached is a code
 that works for the two attached netcdf
 files. The problem is that the code
 has to be modified to work for all the netcdf files.
 
 
  
 I have the following
 netcdf files (the file name means site1_tair_year1980_month01.nc):
 
  
 site1_tair_1980_01.nc, 
 site1_tair_1980_02.nc,
 site1_tair_1980_03.nc,
 site1_tair_1980_04.nc,
 ..., site1_tair_1980_10.nc,
 site1_tair_1980_11.nc,
 site1_tair_1980_12.nc,
 site1_tair_1981_01.nc,
 site1_tair_1981_02.nc,
 ..., site1_tair_1981_12.nc,
 site1_tair_1982_01.nc,
 ..., and so on until site1_tair_2012_12.nc.
 
  
 What I would need to
 do is to concatenate pairs of files (the file of one month,
 with the file of the following month). For instance
 concatenate file site1_tair_1980_01.nc
 with file site1_tair_1980_02.nc
 and create a new netcdf including information of both files;
 also concatenate file site1_tair_1980_02.nc
 with site1_tair_1980_03.nc
 and create a new netcdf;... and so on. Also at the end of
 the year concatenate the December netcdf with the January
 netcdf of the following year (for instance concatenate site1_tair_1980_12.nc
 with site1_tair_1981_01.nc).
 The last netcdf file that I have is December 2012 (no netcdf
 file for January 2013 to concatenate with December
 2012). 
 
  
 Could someone please
 let me know what has to be modified in the attached NCL code
 to concatenate pairs of files (consecutive months) for all
 the netcdf files (starting in January 1980 until
 December 2012)?
 
  
 Thank you in
 advance.
  
 Jiaxin
 -----La pièce jointe associée suit-----
 
 _______________________________________________
 ncl-talk mailing list
 List instructions, subscriber options, unsubscribe:
 http://mailman.ucar.edu/mailman/listinfo/ncl-talk
 
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Mar 31 23:24:12 2014

This archive was generated by hypermail 2.1.8 : Thu Apr 03 2014 - 13:36:27 MDT