cdo and fortran compression
Added by Hailong Liu over 7 years ago
Hi,
I have tried to compress nc4 file by using cdo (cdo z zip -f nc4). I got a very good results. A 110M file can be reduced to about 26MB. Thank you of your great work. :)
After that, I tried to compress the same file by using fortran subroutine, NF_DEF_VAR_DEFLATE. I choose level 9, but I got a compressed file about 77M, much larger than what the cdo did.
Could you tell me what is the difference between the two method and how can I get a compressed file as small as cdo did using the fortran subroutine?
Thanks a lot.
Hailong
Replies (2)
RE: cdo and fortran compression - Added by Uwe Schulzweida over 7 years ago
Hi Hailong,
The main key for good compression results is the chunking (NF_DEF_VAR_CHUNKING). The default value might not be the best. CDO uses the size of the horizontal grid as one chunk.
Cheers,
Uwe
RE: cdo and fortran compression - Added by Hailong Liu over 7 years ago
Hi Uwe
Thank you for your timely reply. I have solved the problem following your suggestion. But the situation seems complicated. I use the command "ncdump hst" to check the chunking size of the cdo compressed file, and then used the numbers in the fortran program. It is interesting that the size of my data is 3600X2302, but the chunking size is 1786X1141 in cdo file. I don't know why, but it works. :)
Cheers,
Hailong