runtraj.concentration.write_concentration#

runtraj.concentration.write_concentration(path, result, release, settings, met_files, metadata=None)[source]#

Write a concentration result to a NetCDF file that read_concentration() reads alone.

Each grid is a group of the file. The release id, the run’s settings and the met files go in the file’s attributes, with metadata, such as the settings hash.

Parameters:
  • path (str | Path | UPath) – File to write. On an object store it is written whole, from a temporary file here.

  • result (DataTree) – A child per grid (check_concentration()).

  • release (runtraj.releases.Release) – The release the result is of.

  • settings (Mapping[str, Any]) – The run’s settings, as its folder records them.

  • met_files (list[Path]) – The met files the run read.

  • metadata (Mapping[bytes, bytes] | None) – More attributes, as {b"runtraj:...": b"..."}.

Raises:

ImportError – If netCDF4 is not installed (pip install runtraj[concentration]).

Return type:

Path | UPath