CSV I/O

class rtctools.optimization.csv_mixin.CSVMixin(**kwargs)[source]

Bases: IOMixin

Adds reading and writing of CSV timeseries and parameters to your optimization problem.

During preprocessing, files named timeseries_import.csv, initial_state.csv, and parameters.csv are read from the input subfolder.

During postprocessing, a file named timeseries_export.csv is written to the output subfolder.

In ensemble mode, a file named ensemble.csv is read from the input folder. This file contains two columns. The first column gives the name of the ensemble member, and the second column its probability. Furthermore, the other XML files appear one level deeper inside the filesystem hierarchy, inside subfolders with the names of the ensemble members.

Variables:
  • csv_initial_state_basename – Initial state file basename. Default is initial_state.

  • csv_parameters_basename – Parameters file basename. Default is parameters.

  • csv_ensemble_basename – Ensemble file basename. Default is ensemble.

  • csv_delimiter – Column delimiter used in CSV files. Default is ,.

  • csv_equidistant – Whether or not the timeseries data is equidistant. Default is True.

  • csv_ensemble_mode – Whether or not to use ensembles. Default is False.

  • csv_validate_timeseries – Check consistency of timeseries. Default is True.

max_timeseries_id(variable: str) str

Returns the name of the upper bound timeseries for the specified variable.

Parameters:

variable – Variable name.

min_timeseries_id(variable: str) str

Returns the name of the lower bound timeseries for the specified variable.

Parameters:

variable – Variable name.