[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #IGX-663824]: compression data



Greetings Jiande!

> Dear Sean:
> Thanks for your email.
> I played the sample code you mentioned and it works. However I am a
> bit puzzled by the size of the output files.
> 
> First I run the sample code without any change, the output file size is
> 36926
> 
> Then I comment out lines "nc_def_var_chunking" and "nc_def_var_deflate",
> the output file size is 34309

There is a little bit of overhead associated with the chunking, so what you are 
seeing the the effect of removing that overhead. You could play with the 
compression level (say, make it maximum by setting deflate_level to 9).

> 
> I further changed "NC_NETCDF4" on line "nc_create" to "NC_CLOBBER" (with
> chunking and deflate commented out), the output file size is 28896

I think in this case, you changed the file output format from netCDF4 to netcdf 
classic. Try using NC_CLOBBER|NC_NETCDF4
> 
> I also tried to set half of the data to missing value, but the output
> file size became even bigger.
> 
> My question is why the deflated file didn't become small, also is it
> true that I must use "NC_NETCDF4" in nc_create in order to use chunking
> and deflate function and to generate NETCDF4 files?

If you don't use the nc_def_var_chunking function, some default chunking will 
take place when you call nc_def_var_deflate. The default setting may or may not 
work so well, so it is something you may need to play with.

Cheers!

Sean

> 
> Thanks in advance.
> Jiande
> 
> On 8/15/2011 1:32 PM, Unidata netCDF Support wrote:
> > Greetings Jiande,
> >
> > Have a look at our examples page:
> >
> > http://www.unidata.ucar.edu/software/netcdf/examples/programs/
> >
> > Also, for an example of compression, check out 
> > http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-tutorial.html#simple_005fxy_005fnc4-in-C,
> >  specifically the line near the bottom that contains the function call 
> > "nc_def_var_deflat(".
> >
> > Cheers!
> >
> > Sean
> >
> >> Full Name: Jiande Wang
> >> Email Address: address@hidden
> >> Organization: NOAA
> >> Package Version: 4
> >> Operating System: linux
> >> Hardware:
> >> Description of problem:
> >>
> >> Hi,
> >>
> >> I am new to this data format. I need to write some data to NetCDF 4
> >> format with compression. Can you please show me a sample C code?
> >>
> >> Thanks in advance
> >> Jiande
> >>
> >>
> >
> > Ticket Details
> > ===================
> > Ticket ID: IGX-663824
> > Department: Support netCDF
> > Priority: Normal
> > Status: Open
> >
> 
> 


Ticket Details
===================
Ticket ID: IGX-663824
Department: Support netCDF
Priority: Normal
Status: Open