eoio.writers.netcdf package#

eoio.writers.netcdf - netCDF writer

class eoio.writers.netcdf.NetCDFWriter(write_params: Dict[str, Any] | None = None)[source]#

Bases: BaseWriter

Write a Dataset or DataTree to netCDF.

all_write_params: Dict[str, str] = {'complevel': '1-9', 'compress': 'True/False', 'compress_min_bytes': 'smallest variable size in bytes to compress; smaller ones are stored uncompressed', 'create_parents': 'True/False', 'encode_attrs': 'True/False', 'encoding': 'per-variable encoding dict, or None to use the compression defaults', 'engine': 'netcdf4/scipy/h5netcdf, or None to use netcdf4 and fall back to h5netcdf if it cannot be imported', 'format': 'NETCDF4/NETCDF4_CLASSIC/NETCDF3_64BIT/NETCDF3_CLASSIC', 'group': 'group path for a Dataset, or None for the root group (not supported for a DataTree)', 'mode': 'w/a', 'on_nonconformance': 'warn/error/ignore', 'unlimited_dims': 'dimension name(s) to write as unlimited; for a DataTree, applied to every group containing them', 'update_history': 'True/False'}#
can_write(obj: Any) → WriteCapability[source]#

Report whether this writer can express obj with its current parameters.

Parameters:

obj – Candidate object.

Returns:

Capability, with a reason when the answer is no.

default_write_params: Dict[str, Any] = {'complevel': 4, 'compress': True, 'compress_min_bytes': 16384, 'create_parents': True, 'encode_attrs': True, 'encoding': None, 'engine': None, 'format': 'NETCDF4', 'group': None, 'mode': 'w', 'on_nonconformance': 'warn', 'unlimited_dims': None, 'update_history': True}#
static get_extension() → str[source]#

Return the filename extension this writer produces, including the dot.

Used to name outputs when the caller gives a directory rather than a full path (see write_multi).

name: str = 'netcdf'#

Name this writer is registered under. Concrete writers must set this.

write_dataset(obj: Dataset | DataTree, path: Path) → None[source]#

Write the object to netCDF.

Parameters:
  • obj – Dataset or DataTree, already encoded by the base class.

  • path – Destination path.

Submodules#