Add more docs

This commit is contained in:
Magnus Ulimoen 2025-06-10 16:58:19 +02:00
parent 7058e7f514
commit 3614c02b13
2 changed files with 4 additions and 5 deletions

View File

@ -31,7 +31,9 @@ All variable data is read into a contiguous buffer, or into an [ndarray](https:/
## Building
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.
This crate depends on the C library [`netcdf-c`](https://www.unidata.ucar.edu/netcdf/) which must be installed on the machine, along with libraries such as `hdf5` which `netcdf-c` depends on. For some platforms you might have to set the environment variable `NETCDF_DIR` which needs to point at the installation of `netcdf-c` you wish to use.
An alternative to using the system libraries is to enable `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`. Please see the github workflows for tips on how to install `netcdf`.

View File

@ -249,14 +249,11 @@ fn main() {
.or_else(|| std::env::var_os("NetCDF_DIR"))
.map(PathBuf::from);
#[cfg(windows)]
let nc_dir = nc_dir.map(|d| d.join("Library"));
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(||
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`")
panic!("A system version of libnetcdf could not be found. Consider installing to some default location, use the environment variable NETCDF_DIR (remember to restart the shell), or prefer building the static version of libnetcdf by enabling the `static` feature on `netcdf-sys` or `netcdf`")
)
};