[][src]Crate netcdf3

Description

A pure Rust library for reading and writing NetCDF-3 files.

Examples

  • Define the NetCDF-3 using the struct Dataset :
    • Define (create, get, rename and remove) global atributes (examples here);
    • Define (create, get, rename and remove) dimensions (examples here);
    • Define (create, get, rename and remove) variables (examples here);
    • Define (create, get, rename and remove) variable attributes (examples here);
  • 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 than std::i32::MAX then this value is considered as indeterminate and the actually written value is numrecs = 2^32 - 1(see the File Format Specifications).
  • If the chunk size of a given variable vsize is greater the std::i32::MAX then its value is considered as indeterminate and the actually written value is vsize = 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 file tests/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

error

Structs

Attribute

NetCDF-3 attribute

DataSet

Allows to define the NetCDF-3 data sets

Dimension

NetCDF-3 dimension

FileReader

Allows to read NetCDF-3 files (the classic and the 64-bit offset versions).

FileWriter

Allows to write NetCDF-3 files (the classic and the 64-bit offset versions).

Variable

NetCDF-3 variable

Enums

DataType

All the data types supported by the NetCDF-3 format

DataVector

Wraps the six NetCDF-3 data types.

DimensionType

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 as NC_FILL_FLOAT defined in the header file netcdf.h)

NC_FILL_F64

Default fill value for the f64 elements (same value as NC_FILL_DOUBLE defined in the header file netcdf.h)

NC_FILL_I8

Default fill value for the i8 elements (same value as NC_FILL_BYTE defined in the header file netcdf.h)

NC_FILL_I16

Default fill value for the i16 elements (same value as NC_FILL_SHORT defined in the header file netcdf.h)

NC_FILL_I32

Default fill value for the i32 elements (same value as NC_FILL_INT defined in the header file netcdf.h)

NC_FILL_U8

Default fill value for the u8 elements (same value as NC_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.