Base API¶
Module containing the base for model implementations
- class openscm_twolayermodel.base.Model¶
Bases:
abc.ABCBase class for model implementations
- reset()¶
Reset everything so that a new run can be performed.
Called as late as possible before
run().
- run()¶
Run the model.
- abstract set_drivers(*args, **kwargs)¶
Set the model’s drivers
- step()¶
Do a single time step.
- class openscm_twolayermodel.base.TwoLayerVariant¶
Bases:
openscm_twolayermodel.base.ModelBase for variations of implementations of the two-layer model
- property delta_t¶
pint.QuantityTime step for forward-differencing approximation
- property erf¶
pint.QuantityEffective radiative forcing
- reset()¶
Reset everything so that a new run can be performed.
Called as late as possible before
run().
- run()¶
Run the model.
- run_scenarios(scenarios, driver_var='Effective Radiative Forcing', progress=True)¶
Run scenarios.
The model timestep is automatically adjusted based on the timestep used in
scenarios. The timestep used inscenariosmust be constant because this implementation has a constant timestep. Pull requests to upgrade the implementation to support variable timesteps are welcome https://github.com/openscm/openscm-twolayermodel/pulls.- Parameters
scenarios (
ScmDataFrameorScmRunorpyam.IamDataFrameorpd.DataFrameornp.ndarrayor str) – Scenarios to run. The input will be converted to anScmRunbefore the run takes place.driver_var (str) – The variable in
scenariosto use as the driver of the modelprogress (bool) – Whether to display a progress bar
- Returns
Results of the run (including drivers)
- Return type
ScmRun- Raises
ValueError – No data is available for
driver_varin the"World"region inscenarios.
- set_drivers(erf)¶
Set drivers for a model run
- Parameters
erf (
pint.Quantity) – Effective radiative forcing (W/m^2) to use to drive the model- Raises
AssertionError –
erfis not one-dimensional
- step()¶
Do a single time step.