Two Layer Model API

Module containing the two-layer model

class openscm_twolayermodel.two_layer_model.TwoLayerModel(du=<Quantity(50, 'meter')>, dl=<Quantity(1200, 'meter')>, lambda0=<Quantity(1.24666667, 'watt / delta_degree_Celsius / meter ** 2')>, a=<Quantity(0.0, 'watt / delta_degree_Celsius ** 2 / meter ** 2')>, efficacy=<Quantity(1.0, 'dimensionless')>, eta=<Quantity(0.8, 'watt / delta_degree_Celsius / meter ** 2')>, delta_t=<Quantity(31557600.0, 'second')>)

Bases: openscm_twolayermodel.base.TwoLayerVariant

TODO: top line and paper references

This implementation uses a forward-differencing approach. This means that temperature and ocean heat uptake values are start of timestep values. For example, temperature[i] is only affected by drivers from the i-1 timestep. In practice, this means that the first temperature and ocean heat uptake values will always be zero and the last value in the input drivers has no effect on model output.

property a

pint.Quantity Dependence of climate feedback factor on temperature

property delta_t

pint.Quantity Time step for forward-differencing approximation

property dl

pint.Quantity Depth of lower layer

property du

pint.Quantity Depth of upper layer

property efficacy

pint.Quantity Efficacy factor

property erf

pint.Quantity Effective radiative forcing

property eta

pint.Quantity Heat transport efficiency

get_impulse_response_parameters()

Get equivalent two-timescale impulse response model parameters

For details on how the equivalence is calculated, please see the notebook impulse-response-equivalence.ipynb in the OpenSCM Two Layer model repository.

Returns

dict of str – Input arguments to initialise an openscm_twolayermodel.ImpulseResponseModel with the same temperature response as self

Return type

pint.Quantity

Raises

ValueErrorself.a is non-zero, the two-timescale model does not support state-dependence.

property heat_capacity_lower

pint.Quantity Heat capacity of lower layer

property heat_capacity_upper

pint.Quantity Heat capacity of upper layer

property lambda0

pint.Quantity Initial climate feedback factor

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 in scenarios must 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 (ScmDataFrame or ScmRun or pyam.IamDataFrame or pd.DataFrame or np.ndarray or str) – Scenarios to run. The input will be converted to an ScmRun before the run takes place.

  • driver_var (str) – The variable in scenarios to use as the driver of the model

  • progress (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_var in the "World" region in scenarios.

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

AssertionErrorerf is not one-dimensional

step()

Do a single time step.