pylag.restart module

Restart module that provides the following functionality:

  1. Writing of model restart files

The reading of restart files is implemented in particle_initialisation.py.

class pylag.restart.RestartFileCreator(config)[source]

Bases: object

Restart file creator

Objects of type RestartFileCreator manage the creation of model restart files.

Parameters

config (ConfigParser) – Configuration obect.

create(filename_stem, n_particles, datetime, particle_data)[source]

Create a restart file

Restart files will be created in the directory restart_dir. The following file naming convention is used:

<restart_dir>/<filename_stem>_YYYYMMDD-HHMMSS.nc

The time stamp is obtained from the supplied datetime parameter.

All the particle data that is required to restart the model should be provided in the dictionary particle_data. This allows for a completely generic structure.

Parameters
  • filename_str (str) – The file name stem, as explaing above (e.g. set_1).

  • n_particles (int) – The total number of particles.

  • datetime (Datetime) – Datetime object corresponding to the current date and time.

  • particle_data (dict) – Dictionary containing particle data.