Adapter base class¶
-
class
openscm.adapters.Adapter(input_parameters, output_parameters)¶ Bases:
objectAll model adapters in OpenSCM are implemented as subclasses of the
openscm.adapter.Adapterbase class.Writing a model adapter provides a how-to on implementing an adapter.
A model adapter is responsible for requesting the expected input parameters (in the expected time format and units) for the particular SCM from a
openscm.core.ParameterSet. It also runs its wrapped SCM and writes the output data back to aopenscm.core.ParameterSet.-
__init__(input_parameters, output_parameters)¶ Initialize.
- Parameters
input_parameters (
ParameterSet) – Input parameter set to useoutput_parameters (
ParameterSet) – Output parameter set to use
-
_abc_impl= <_abc_data object>¶
-
abstract
_initialize_model()¶ To be implemented by specific adapters.
Initialize the model. Called only once but as late as possible before a call to
_run()or_step().- Return type
None
-
abstract
_initialize_model_input()¶ To be implemented by specific adapters.
Initialize the model input. Called before the adapter is used in any way and at most once before a call to
_run()or_step().- Return type
None
-
abstract
_initialize_run_parameters()¶ To be implemented by specific adapters.
Initialize parameters for the run. Called before the adapter is used in any way and at most once before a call to
_run()or_step().- Return type
None
-
_initialized= None¶ Trueif model has been initialized via_initialize_model()
-
_output= None¶ Output parameter set
-
_parameters= None¶ Input parameter set
-
abstract
_reset()¶ To be implemented by specific adapters.
Reset the model to prepare for a new run. Called once after each call of
_run()and to reset the model after several calls to_step().- Return type
None
-
abstract
_run()¶ To be implemented by specific adapters.
Run the model over the full time range.
- Return type
None
-
abstract
_shutdown()¶ To be implemented by specific adapters.
Shut the model down.
- Return type
None
-
abstract
_step()¶ To be implemented by specific adapters.
Do a single time step.
- Return type
None
-
initialize_model_input()¶ Initialize the model input.
Called before the adapter is used in any way and at most once before a call to
run()orstep().- Return type
None
-
initialize_run_parameters()¶ Initialize parameters for the run.
Called before the adapter is used in any way and at most once before a call to
run()orstep().- Return type
None
-
reset()¶ Reset the model to prepare for a new run.
Called once after each call of
run()and to reset the model after several calls tostep().- Return type
None
-
run()¶ Run the model over the full time range.
- Return type
None
-
step()¶ Do a single time step.
- Returns
Current time
- Return type
np.datetime64
-