arraysrnetcdfnetcdf4nco

How can I reduce the dimension size in a netCDF file?


I have a netCDF file

dimensions:
    i1 = 3 ;
    x = 11 ;
    s1 = 1 ;
    mid1 = 8 ;
    mid2 = 8 ;
variables:
    double Height(i1,x) ;
    double Temp(s1, x) ;
    short Soil(s1, x) ;
    double Liq(mid1, x) ;

I want to reduce the mid1 size to 3 where I remove the rest of the 5 values.

How can I do it in using ncdf4 package or some other utility?


Solution

  • You could use NCO's ncks to hyperslab netCDF files, e.g.,

    ncks -d mid1,0,2 in.nc out.nc