Skip to main content

Crate rustyhdf5_netcdf4

Crate rustyhdf5_netcdf4 

Source
Expand description

NetCDF-4 read support built on rustyhdf5.

NetCDF-4 files are HDF5 files following specific conventions. This crate provides a high-level API for reading NetCDF-4 metadata (dimensions, variables, CF attributes, groups) from HDF5 files written by netCDF4-python, nco, CDO, or any compliant NetCDF-4 writer.

§Example

use rustyhdf5_netcdf4::NetCDF4File;

let file = NetCDF4File::open("data.nc").unwrap();
for dim in file.dimensions().unwrap() {
    println!("{}: {} (unlimited={})", dim.name, dim.size, dim.is_unlimited);
}
for mut var in file.variables().unwrap() {
    println!("{}: {:?}", var.name(), var.shape().unwrap());
    let cf = var.cf_attributes().unwrap();
    if let Some(units) = &cf.units {
        println!("  units: {units}");
    }
}

Re-exports§

pub use cf::CfAttributes;
pub use cf::FillValue;
pub use dimension::Dimension;
pub use error::Error;
pub use group::NetCDF4Group;
pub use types::NcType;
pub use variable::Variable;

Modules§

cf
CF (Climate and Forecast) convention attribute handling.
dimension
NetCDF-4 dimension representation.
error
Error types for the NetCDF-4 reader.
group
NetCDF-4 group representation.
types
NetCDF-4 data type mapping.
variable
NetCDF-4 variable representation.

Structs§

NetCDF4File
A NetCDF-4 file reader.

Enums§

AttrValue
Convenient attribute values for the write API.