Helper Functions

Basic Helper Functions

DAPyr.copyExpt(expt: Expt)

Create a deepcopy of an existing experiment

Parameters:

expt (Expt) – An instance of the Expt class.

Returns:

A copy of the experiment.

Return type:

Expt

Saving and Reading Experiments

DAPyr.loadParamFile(filename: str)

Create an experiment from params textfile.

Parameters:

filename (str) – Path to a textfile containing all configurable parameters, see sample files.

Returns:

An instance of the Expt class.

Return type:

Expt

DAPyr.loadExpt(file: str)

Load an experiment from the filesystem.

Parameters:

file (str) – A string containing the filepath to the experiment.

Returns:

An instance of the Expt class.

Return type:

Expt

DAPyr.saveExpt(outputdir: str, expt: Expt)

Save an experiment to the file system. Will save the file under ‘exptname.expt’.

Parameters:
  • outputdir (str) – Path to directory where the experiment will be saved.

  • expt (Expt) – The experiment instance to save.

Plotting and Visualization

DAPyr.plotLocalization(expt: Expt, ax=None)

Plot the localization radius of an experiment.

Parameters:
  • expt (Expt) – An Expt instance to plot localization for.

  • ax (_type_, optional) – A matplotlib.pyplot Axes instance on which to plot localization onto, by default None. Must have a ‘3d’ projection specified.

Returns:

A matplotlib.pyplot.Axes instance.

Return type:

matplotlib.pyplot.Axes

DAPyr.plotExpt(expt: Expt, T: int, ax=None, plotObs=False, plotEns=True, plotEnsMean=False)

Plots the model truth, obs, ensembles, and ensemble mean at time T.

Parameters:
  • expt (Expt) – An Expt instance to plot

  • T (int) – The time step during the experiment to plot.

  • ax (matplotlib.pyplot.Axes, optional) – An instance of a matplotlib Axes to plot onto, by default None. Must have specified a ‘3d’ projection

  • plotObs (bool, optional) – A boolean to configure whether to plot observations, by default False

  • plotEns (bool, optional) – A boolean to configure whether to plot ensemble members, by default True. Must have had saveEns configured to 1.

  • plotEnsMean (bool, optional) – A boolean to configure whether to plot ensemble mean, by default False. Must have had saveEnsMean configured to 1.

Returns:

A matplotlib.pyplot Axes instance

Return type:

matplotlib.pyplot.Axes

Raises:
  • TypeError – Raised if Expt instance is not passed.

  • ValueError – Raised if the Expt instance passed has not be run through runDA(), or an invalid time step, T, provided.