BaseWriter.write

BaseWriter.write#

BaseWriter.write(obj: Dataset | DataTree, path: Path | str) → str[source]#

Public entrypoint: write an object to path.

Orchestration is the same for every format:

  1. can_write() - refuse early, with a reason the user can act on

  2. check_conformance() - CF-1.8 / ACDD / controlled vocabulary

  3. provenance - append to history and eoio:processing_steps

  4. encode_attrs() - make attributes serialisable

  5. write_dataset() - the format-specific part

Provenance is added before encoding and writing, so that it ends up in the written file rather than only on a discarded in-memory copy.

The input object is never modified.

Parameters:
  • obj – Dataset or DataTree to write.

  • path – Destination path.

Returns:

The path written, as a string.

Raises:

TypeError – If this writer cannot express obj.