Crates.io | netcdf |
lib.rs | netcdf |
version | 0.10.5 |
source | src |
created_at | 2015-06-27 17:22:31.562209 |
updated_at | 2024-08-20 14:54:26.472228 |
description | High-level NetCDF bindings for Rust |
homepage | |
repository | https://github.com/georust/netcdf |
max_upload_size | |
id | 2477 |
size | 223,606 |
Medium-level netCDF bindings for Rust, allowing easy reading and writing of array-like structures to a file.
netCDF can read and write hdf5
files, which is a commonly used file format in scientific computing.
Supported:
derive
(enum, compound, other types requires additional work)Not (yet) supported (PRs welcome):
All variable data is read into a contiguous buffer, or into an ndarray if the ndarray
feature is activated.
This crate depends on libnetcdf
, but a static build from source is also supported, which can be enabled using the static
feature.
The crate is built on several platforms using github actions, and is currently known to build form from source on all major platforms (linux, macos, windows (gnu+msvc)), and through the package installers conda
and apt
.
If during compilation there is an error in building the hdf5
crate, consider using the static
feature which will include a compatible version of both netcdf
and hdf5
. This is likely to be an issue upstream.
libnetcdf
or building staticallygit clone https://github.com/georust/netcdf
git submodule update --init --recursive
cargo build --features static
Some examples of usage can be found in the tests/lib.rs file. The documentation can also be generated using cargo doc
.
The netcdf
crate is thread-safe, although the netcdf-c
library is not itself threadsafe. To render a safe interface, a global mutex is used to serialize access to the underlying library. Consider using a non threadsafe version of hdf5
to avoid double locking (performance consideration).
Use of netcdf-sys
is not thread-safe. Users of this library must take care that calls do not interfere with simultaneous use of e.g. netcdf
or hdf5-sys
. Use the lock provided by netcdf-sys
to serialise access to the hdf5
and netCDF
libraries.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.