gcubed.projections.simulation_layer_definitions

This module contains the SimulationLayerDefinitions class.

It contains a list of simulation layer definitions, in the order that they are to be imposed over the baseline for the model.

class SimulationLayerDefinitions(gcubed.base.Base):

An event_year ordered list of simulation layer definitions.

The ordered list implemented as a singly linked list.

It supports addition, removal and iteration of simulation layer definitions.

SimulationLayerDefinitions(sym_data: gcubed.sym_data.SymData)

Create an empty ordered list of SimulationLayerDefinitions

size
def add( self, simulation_layer_definition: gcubed.projections.simulation_layer_definition.SimulationLayerDefinition):

Overview

Insert a SimulationLayerDefinition into the iterable list of definitions, in the correct event-year order.

def remove( self, simulation_layer_definition: gcubed.projections.simulation_layer_definition.SimulationLayerDefinition):

Remove a SimulationLayerDefinition from the list

def get_simulation_layer_definition( self, simulation_name: str) -> gcubed.projections.simulation_layer_definition.SimulationLayerDefinition:

Arguments

simulation_name: The name of the simulation to retrieve details for.

Returns the definition for a named simulation layer.

def get_simulation_layer_definitions( self, event_year: int) -> list[gcubed.projections.simulation_layer_definition.SimulationLayerDefinition]:

Arguments

event_year: The event year.

Returns the simulation layer definitions that have the specified event year. They are returned in the same order as they have been loaded.

all_event_years_in_ascending_order

The list of unique event years associated with simulation layer definitions in ascending order.

def load_from_csv_file(self, design_file: str):

Overview

Loads the metadata about each simulation layer from the specified CSV experiment design file.

Arguments

design_file: the name and absolute path to the experiment design file.

Loads the simulation layer definitions from a CSV file that lists the files along with other details of each simulation layer. The CSV file columns are expected to be, in the following order:

  • name - the name of the simulation layer
  • data - the name of the simulation layer data file. The data files are expected to be in the same directory as the CSV design file that defines the simulation layers.
  • event_year - the event year for the simulation layer.
  • description - the text description of the simulation layer.

Exceptions

Raises an exception if the experiment design file does not exist.

Raises and exception if the simulation layers in the experiment design are not in event year order from earliest to latest.