How to combine multiple NetCDF files into a single file?

Help
2014-01-22
2014-01-22
  • James Adams

    James Adams - 2014-01-22

    I have several NetCDF files that were split from one big file, one small file per longitude. I'd like to recombine these into a single file using NCO if possible. How would I go about this?

    The small files look like this:

    netcdf file:/N:/james/ghcnm_output/0nout.nc {
      dimensions:
        time = 1420;
        lat = 584;
        lon = 1;
      variables:
        float spi01(time=1420, lon=1, lat=584);
    
        float spi02(time=1420, lon=1, lat=584);
    
        float spi03(time=1420, lon=1, lat=584);
    
        float spi04(time=1420, lon=1, lat=584);
    
        float spi05(time=1420, lon=1, lat=584);
    
        float spi06(time=1420, lon=1, lat=584);
    
        float spi07(time=1420, lon=1, lat=584);
    
        int time(time=1420);
          :units = "days since 1800-01-01 00:00:00";
          :_CoordinateAxisType = "Time";
    
        float lat(lat=584);
          :_CoordinateAxisType = "Lat";
    
        float lon(lon=1);
          :_CoordinateAxisType = "Lon";
    
      // global attributes:
      :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention";
    }
    

    Thanks in advance for any suggestions.

    --James

     
    • Gus Correa

      Gus Correa - 2014-01-22

      Hi James

      The NCO manual, section 2.6.1 has a sample script to
      concatenate files along any dimension.
      It uses ncpdq (to permute the dimensions, making "lon" in your case,
      become the record dimension),
      followed by ncrcat (to concatenate along the "lon" dimension,
      in your case),
      and finally flip back the dimension order (restoring the time dimension
      status of record dimension).

      http://nco.sourceforge.net/nco.html#Concatenation

      I hope this helps,
      Gus Correa

      On 01/22/2014 03:35 PM, James Adams wrote:

      I have several NetCDF files that were split from one big file, one small
      file per longitude. I'd like to recombine these into a single file using
      NCO if possible. How would I go about this?

      The small files look like this:

      netcdf file:/N:/james/ghcnm_output/0nout.nc {
      dimensions:
      time = 1420;
      lat = 584;
      lon = 1;
      variables:
      float spi01(time=1420, lon=1, lat=584);

       float  spi02(time=1420,  lon=1,  lat=584);
      
       float  spi03(time=1420,  lon=1,  lat=584);
      
       float  spi04(time=1420,  lon=1,  lat=584);
      
       float  spi05(time=1420,  lon=1,  lat=584);
      
       float  spi06(time=1420,  lon=1,  lat=584);
      
       float  spi07(time=1420,  lon=1,  lat=584);
      
       int  time(time=1420);
         :units  =  "days since 1800-01-01 00:00:00";
         :_CoordinateAxisType  =  "Time";
      
       float  lat(lat=584);
         :_CoordinateAxisType  =  "Lat";
      
       float  lon(lon=1);
         :_CoordinateAxisType  =  "Lon";
      

      // global attributes:
      :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention";
      }

      Thanks in advance for any suggestions.

      --James


      How to combine multiple NetCDF files into a single file?
      https://sourceforge.net/p/nco/discussion/9830/thread/bac51427/?limit=25#61d3


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/nco/discussion/9830/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

Log in to post a comment.