Expand description
§Description
A pure Rust library for reading and writing NetCDF-3 files.
§Examples
- Define the NetCDF-3 using the struct
Dataset
: - Read the NetCDF-3 files using the struct
FileReader
. - Write the NetCDF-3 files using the struct
FileWriter
.
§Notes
- If the number of records
numrecs
is greater thanstd::i32::MAX
then this value is considered as indeterminate and the actually written value isnumrecs = 2^32 - 1
(see the File Format Specifications). - If the chunk size of a given variable
vsize
is greater thestd::i32::MAX
then its value is considered as indeterminate and the actually written value isvsize = 2^32 - 1
(see the File Format Specifications). - To validate the implementation of the NetCDF-3 files writing, binary comparisons between the crate outcomes and files produced by the Python library netCDF4 are done while the test suite (see the Python script
pyscripts/create_test_nc3_files.py
and the Rust test filetests/tests_write_nc3_files.rs
).
§Known limitations
- Cannot read/write a subset of a variable data yet.
- Cannot rewrite a NetCDF-3 file.
Re-exports§
pub use error::ReadError;
pub use error::WriteError;
pub use error::InvalidDataSet;
Modules§
Structs§
- Attribute
- NetCDF-3 attribute
- DataSet
- Allows to define the NetCDF-3 data sets
- Dimension
- NetCDF-3 dimension
- File
Reader - Allows to read NetCDF-3 files (the classic and the 64-bit offset versions).
- File
Writer - Allows to write NetCDF-3 files (the classic and the 64-bit offset versions).
- Variable
- NetCDF-3 variable
Enums§
- Data
Type - All the data types supported by the NetCDF-3 format
- Data
Vector - Wraps the six NetCDF-3 data types.
- Dimension
Type - Type of a dimension, fixed or unlimited size
- Version
- NetCDF-3 file versions (classic or 64-bit offset)
Constants§
- NC_
FILL_ F32 - Default fill value for the
f32
elements (same value asNC_FILL_FLOAT
defined in the header file netcdf.h) - NC_
FILL_ F64 - Default fill value for the
f64
elements (same value asNC_FILL_DOUBLE
defined in the header file netcdf.h) - NC_
FILL_ I8 - Default fill value for the
i8
elements (same value asNC_FILL_BYTE
defined in the header file netcdf.h) - NC_
FILL_ I16 - Default fill value for the
i16
elements (same value asNC_FILL_SHORT
defined in the header file netcdf.h) - NC_
FILL_ I32 - Default fill value for the
i32
elements (same value asNC_FILL_INT
defined in the header file netcdf.h) - NC_
FILL_ U8 - Default fill value for the
u8
elements (same value asNC_FILL_CHAR
defined in the header file netcdf.h) - NC_
MAX_ DIM_ SIZE - Maximum length of the fixed-size dimensions
- NC_
MAX_ NAME_ SIZE - Maximum size (number of bytes) allowed for the NetCDF names.
- NC_
MAX_ VAR_ DIMS - Maximum number of dimensions per variable
Functions§
- is_
valid_ name - Checks that
name
follows the NetCDF-3 naming convention.