[ncl-talk] netcdf file compression

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Sep 4 12:48:11 MDT 2018


Doug,

When creating a new netcdf-4 file, the "format" option must be globally
selected *before* the addfile command.  This is documented on the
setfileoption doc page under "format", but it is obscure.  Try rearranging
your script like this:

    setfileoption ("nc","Format","NetCDF4")
    file_chem = addfile (filename+”.nc", "w")
    setfileoption (file_chem,"CompressionLevel",4)

Example 5 at the bottom of the same page also talks about this.

--Dave


On Tue, Sep 4, 2018 at 8:11 AM, Douglas Lowe <Douglas.Lowe at manchester.ac.uk>
wrote:

> Dear all,
>
> I’m trying to use the file compression option listed on this manual page:
> https://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml
>
> This is my code:
> file_chem   = addfile(filename+”.nc", "w")
> setfileoption(file_chem,"Format","NetCDF4")
> setfileoption(file_chem,"CompressionLevel",4)
>
> However, I am not finding that there’s any extra compression of the data
> compared to
> using the default compression level - and if I compress the file myself
> using nccopy
> I find I can greatly compress the file (5Mb down to 50kb).
>
> Have I missed any extra code that I should be adding (my variable
> processing / writing
> code is the same as I’d use for netcdf3 files) to make this compression
> work?
>
> thanks,
> Doug
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180904/e73c7dc4/attachment.html>


More information about the ncl-talk mailing list