diff --git a/.typos.toml b/.typos.toml index 6f3ff0a..87748ed 100644 --- a/.typos.toml +++ b/.typos.toml @@ -5,4 +5,5 @@ extend-exclude = ["netcdf-src/source", "netcdf-sys"] extend-ignore-identifiers-re = [ "Dout", "is_ambigous", # Remove when deprecated item is removed + "typ", ] diff --git a/README.md b/README.md index 92ec473..107d070 100644 --- a/README.md +++ b/README.md @@ -31,13 +31,12 @@ All variable data is read into a contiguous buffer, or into an [ndarray](https:/ ## Building -This crate depends on `libnetcdf`, but a static build from source is also supported, which can be enabled using the `static` feature. +This crate depends on the library [`netcdf-c`](https://www.unidata.ucar.edu/netcdf/) which must be installed on the machine, along with libraries such as `hdf5`. An alternative to the system libraries is the use of the `static` feature of this crate (`cargo add netcdf --features static`), which compiles `libnetcdf` from source. The `static` feature requires `cmake`, a `c++` compiler and more to be installed on the build machine. -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`. +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`. Please see the github workflows for tips on how to install `netcdf`. -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](https://github.com/aldanor/hdf5-rust/issues/262). -### Building without `libnetcdf` or building statically +### Building `libnetcdf` statically 1. `git clone https://github.com/georust/netcdf` 2. `git submodule update --init --recursive` 3. `cargo build --features static` diff --git a/netcdf-sys/build.rs b/netcdf-sys/build.rs index 5906de8..bd13b29 100644 --- a/netcdf-sys/build.rs +++ b/netcdf-sys/build.rs @@ -172,9 +172,6 @@ fn from_utf8_to_trimmed_string(bytes: &[u8]) -> String { } impl NcInfo { - fn guess() -> Self { - todo!() - } fn from_path(path: &Path) -> Self { Self { version: None, @@ -258,7 +255,9 @@ fn main() { info = if let Some(nc_dir) = nc_dir.as_ref() { NcInfo::gather_from_ncconfig(Some(nc_dir)).unwrap_or_else(|| NcInfo::from_path(nc_dir)) } else { - NcInfo::gather_from_ncconfig(None).unwrap_or_else(NcInfo::guess) + NcInfo::gather_from_ncconfig(None).unwrap_or_else(|| + panic!("A system version of libnetcdf could not be found. Consider installing to some default location, use NETCDF_DIR, or prefer the static version of libnetcdf by setting the `static` feature on `netcdf-sys`") + ) }; println!("cargo::rustc-link-search={}", info.libdir.display()); diff --git a/netcdf/src/lib.rs b/netcdf/src/lib.rs index 888437a..0c628e7 100644 --- a/netcdf/src/lib.rs +++ b/netcdf/src/lib.rs @@ -14,7 +14,14 @@ //! //! For more information see: //! * [The official introduction to `netCDF`](https://docs.unidata.ucar.edu/nug/current/netcdf_introduction.html) -//! * [The `netCDF-c` repository](https://github.com/Unidata/netcdf-c) +//! * [The `NetCDF-c` repository](https://github.com/Unidata/netcdf-c) +//! +//! # Installing netcdf-c +//! +//! This crate depends on [Unidata NetCDF-c](https://github.com/Unidata/netcdf-c) and dependencies +//! of this library (such as hdf5). +//! An alternative to the system libraries is to use the bundled sources of netcdf by using the `static` feature of this crate. This will require build utilities such as `cmake`, `c++` compiler and more. +//! //! //! # Examples //! diff --git a/netcdf/src/variable.rs b/netcdf/src/variable.rs index 94aa36d..b855a25 100644 --- a/netcdf/src/variable.rs +++ b/netcdf/src/variable.rs @@ -19,7 +19,7 @@ use crate::utils::{checked_with_lock, with_lock}; /// /// This type is used for retrieving data from a variable. /// Metadata on the `netCDF`-level can be retrieved using e.g. -/// [`fill_value`](Self::fill_value), [`endinanness`](Self::endianness). +/// [`fill_value`](Self::fill_value), [`endianness`](Self::endianness). /// Use [`attributes`](Self::attribute) to get additional metadata assigned /// by the data producer. This crate will not apply any of the transformations /// given by such attributes (e.g. `add_offset` and `scale_factor` are NOT considered).