Git Product home page Git Product logo

Comments (5)

pmav99 avatar pmav99 commented on September 14, 2024 1

The compression level no.4 was the best in terms of speed and compression.

I agree that as a rule of thumb it is a good choice.

by converting the original double precision data to integer* ones, after converting the original values (e.g. water level in meters to mm) without loosing accuracy

True, that being said, depending on the application, even losing accuracy is something that can occasionally be considered.

from pyposeidon.

brey avatar brey commented on September 14, 2024

Good tip. I will look into it.

from pyposeidon.

vvoukouvalas avatar vvoukouvalas commented on September 14, 2024

Some years ago, I did some tests with the netcdf compression levels (1-9). The compression level no.4 was the best in terms of speed and compression. The tests were done with matlab's snctools (a) but I guess the same should hold true for the other netcdf libraries.
Additionally, we can reduce the file size, by converting the original double precision data to integer* ones, after converting the original values (e.g. water level in meters to mm) without loosing accuracy.

a) http://mexcdf.sourceforge.net/

from pyposeidon.

pmav99 avatar pmav99 commented on September 14, 2024

Implementing this will require to pass a parameter named encoding to the to_netcdf() calls.

http://xarray.pydata.org/en/stable/generated/xarray.Dataset.to_netcdf.html

encoding (dict, optional) – Nested dictionary with variable names as keys and dictionaries of variable specific encodings as values, e.g., {"my_variable": {"dtype": "int16", "scale_factor": 0.1, "zlib": True}, ...}

The h5netcdf engine supports both the NetCDF4-style compression encoding parameters {"zlib": True, "complevel": 9} and the h5py ones {"compression": "gzip", "compression_opts": 9}. This allows using any compression plugin installed in the HDF5 library, e.g. LZF.

Not necessarily related to the issue at hand, but the following links provide some interesting insights WRT data formats and compression:

https://docs.dask.org/en/latest/best-practices.html#store-data-efficiently
https://docs.dask.org/en/latest/dataframe-best-practices.html#store-data-in-apache-parquet-format

from pyposeidon.

pmav99 avatar pmav99 commented on September 14, 2024

If the netcdf files are being created with the xarray.DataSet.to_netcdf() method, then we need to provide a value for the encoding parameter. It should be a dictionary of the form

{"my_variable": {"dtype": "int16", "scale_factor": 0.1, "zlib": True}, ...}

http://xarray.pydata.org/en/stable/generated/xarray.Dataset.to_netcdf.html

from pyposeidon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.