pyspeedy.callbacks.XarrayExporter

class pyspeedy.callbacks.XarrayExporter(interval=36, verbose=False, spinup_date=None, variables=None, output_dir='./', filename_fmt='%Y-%m-%d_%H%M.nc')

Callback used to create an xarray dataset with selected variables a the current model time step.

The variables are saved in the lat/lon grid space (not the spectral domain). Spectral variables are not supported by this callback.

__init__(interval=36, verbose=False, spinup_date=None, variables=None, output_dir='./', filename_fmt='%Y-%m-%d_%H%M.nc')
Parameters
interval: int

Interval, in time steps, for which the model variables are saved.

verbose: bool

If true, print debug and progress messages.

spinup_date: datetime or None:

End date of the spinup period. During the spinup the model checkpoints are not saved.

variables: list, tuple

List of variables to save

output_dir: str

Path to folder where the output files are stored.

filename_fmt: str

Format string used to generate the output filename. The format string is passed to the strftime method for the current model datetime.

interval: int

History interval in timesteps every which the output files are saved.

spinup_date: datetime or None

Model spinup date. From start_date to spinup_date the callbacks functions are not called.

Methods

__init__([interval, verbose, spinup_date, ...])

Parameters

print_msg(msg)

Print debug message if verbose was set to True.

skip_flag(model_instance)

Return True when the callback excecution is skipped for this time step if - model_date < spinup_date - current_step % interval !=0