pylag.mediator module
The module provides a set of classes to assist with communication between objects of type DataReader and objects of type FileReader. Primarily, the mediator module was introduced in order to abstract away the MPI interface, making it easier to PyLag either in serial or parallel. It also assists with testing.
See also
- class pylag.mediator.Mediator[source]
Bases:
objectBase class for objects of type Mediator.
Mediators manage data transfers between FileReaders and other objects. Data transfers are typically between objects of type FileReader and objects of type DataReader. The decoupling between FileReader and DataReader objects was put in place in order to support parallel simulations where it is preferable for just a single process to access the file system.
- get_grid_variable(var_name, var_dims, var_type)[source]
Wrapper for FileReader’s get_grid_variable
- Parameters:
var_name (str) – The name of the variable.
- Returns:
The the grid variable.
- Return type:
NDArray
- get_grid_variable_dimensions(var_name)[source]
Wrapper for FileReader’s get_grid_variable_dimensions
- get_mask_at_last_time_index(var_name, var_dims)[source]
Wrapper for FileReader’s function of the same name
- get_mask_at_next_time_index(var_name, var_dims)[source]
Wrapper for FileReader’s function of the same name
- get_time_at_last_time_index()[source]
Wrapper for FileReader’s get_time_at_last_time_index
- Returns:
The time at the last time index.
- Return type:
- get_time_at_next_time_index()[source]
Wrapper for FileReader’s get_time_at_next_time_index
- Returns:
The time at the last time index.
- Return type:
- get_time_dependent_variable_at_last_time_index(var_name, var_dims, var_type)[source]
Wrapper for FileReader’s function of the same name
- get_time_dependent_variable_at_next_time_index(var_name, var_dims, var_type)[source]
Wrapper for FileReader’s function of the same name
- get_variable_dimensions(var_name, include_time=True)[source]
Wrapper for FileReader’s get_variable_dimension
- get_variable_shape(var_name, include_time=True)[source]
Wrapper for FileReader’s get_variable_shape
- class pylag.mediator.SerialMediator(config, data_source, datetime_start, datetime_end)[source]
Bases:
MediatorSerial mediator
Serial mediator for serial runs.
- Parameters:
config (ConfigParser) – Run configuration object
data_source (str) – String indicating what type of data the datetime objects will be associated with. Options are: ‘ocean’, ‘atmosphere’, and ‘wave’.
start_datetime (Datetime) – Simulation start date/time.
end_datetime (Datetime) – Simulation end date/time.
- Variables:
config (ConfigParser) – Run configuration object
file_reader (pylag.FileReader) – FileReader object.
- get_grid_variable(var_name, var_dims, var_type)[source]
Wrapper for FileReader’s get_grid_variable
- Parameters:
var_name (str) – The name of the variable.
- Returns:
The the grid variable.
- Return type:
NDArray
- get_grid_variable_dimensions(var_name)[source]
Wrapper for FileReader’s get_grid_variable_dimensions
- get_mask_at_last_time_index(var_name, var_dims)[source]
Wrapper for FileReader’s function of the same name
- get_mask_at_next_time_index(var_name, var_dims)[source]
Wrapper for FileReader’s function of the same name
- get_time_at_last_time_index()[source]
Wrapper for FileReader’s get_time_at_last_time_index
- Returns:
The time at the last time index.
- Return type:
- get_time_at_next_time_index()[source]
Wrapper for FileReader’s get_time_at_next_time_index
- Returns:
The time at the last time index.
- Return type:
- get_time_dependent_variable_at_last_time_index(var_name, var_dims, var_type)[source]
Wrapper for FileReader’s function of the same name
- get_time_dependent_variable_at_next_time_index(var_name, var_dims, var_type)[source]
Wrapper for FileReader’s function of the same name
- get_variable_dimensions(var_name, include_time=True)[source]
Wrapper for FileReader’s get_variable_dimension
- get_variable_shape(var_name, include_time=True)[source]
Wrapper for FileReader’s get_variable_shape