1

I have a compressed netCDF file called in.nc with a (_DeflateLevel=4). I want to decompress the file.

I've already tried using the following command but it doesn't change anything:

nccopy -d 0 in.nc out.nc

Here are the in.nc specifications:

time_counter = UNLIMITED ; // (12 currently)
    y = 552 ;
    x = 552 ;
variables:
    float Q16c(time_counter, y, x) ;
        Q16c:long_name = "Deep Sediment Particulate organic Matter" ;
        Q16c:units = "mg C/m2" ;
        Q16c:online_operation = "average" ;
        Q16c:interval_operation = "900 s" ;
        Q16c:interval_write = "1 month" ;
        Q16c:cell_methods = "time: mean (interval: 900 s)" ;
        Q16c:_FillValue = 1.e+20f ;
        Q16c:missing_value = 1.e+20f ;
        Q16c:coordinates = "time_centered nav_lat nav_lon" ;
        Q16c:_Storage = "chunked" ;
        Q16c:_ChunkSizes = 1, 552, 552 ;
        Q16c:_DeflateLevel = 4 ;
        Q16c:_Endianness = "little" ;
ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
Amr Talaat
  • 81
  • 2
  • 10

2 Answers2

2

The way to decompress a compressed file with NCO is straightforward:

ncks -L 0 in.nc out.nc

p.s.: this method should work for the most common codecs, including DEFLATE, Zstandard, and Bzip2.

Charlie Zender
  • 5,929
  • 14
  • 19
1

I think the way to decompress files in cdo is

cdo -z zip_0 copy in.nc out.nc 

If they are compressed using 2 byte shorts with an add_offset and scale_factor (e.g. ERA5 etc) then you can decompress those by converting to float like this

cdo unpack in.nc out.nc 

or alternatively

cdo -b f32 copy in.nc out.nc 
ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86