Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

concatenating files

Help
Ben
2014-01-06
2014-01-06
  • Ben
    Ben
    2014-01-06

    I'm wondering if the following is possible. I need to concatenate a bunch of netcdf files at different times, otherwise they have the same data. The files have 1 time per file and I can not modify them. The time dimension was created as a fixed length variable. Thus to use ncrcat to merge the different times I need to one by one make a copy of the files where I have made time a record dimension, then call ncrcat. Is there anyway I can use ncecat to merge these files if a manner similar to ncrcat to avoid have to make a copy of every file I want to merge.

     
  • Charlie Zender
    Charlie Zender
    2014-01-06

    Yes. Something like this should do the trick:

    ncecat -u new_time in*.nc out.nc
    ncwa -a time out.nc out.nc
    ncrename -d new_time,time out.nc out.nc

    This only works as intended when time is a degenerate (size 1) dimension in each input file to ncecat.

    cz