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.TwoLayerVariantTODO: 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.QuantityDependence of climate feedback factor on temperature
- property delta_t¶
pint.QuantityTime step for forward-differencing approximation
- property dl¶
pint.QuantityDepth of lower layer
- property du¶
pint.QuantityDepth of upper layer
- property efficacy¶
pint.QuantityEfficacy factor
- property erf¶
pint.QuantityEffective radiative forcing
- property eta¶
pint.QuantityHeat 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.ipynbin the OpenSCM Two Layer model repository.- Returns
dict of str – Input arguments to initialise an
openscm_twolayermodel.ImpulseResponseModelwith the same temperature response asself- Return type
pint.Quantity- Raises
ValueError –
self.ais non-zero, the two-timescale model does not support state-dependence.
- property heat_capacity_lower¶
pint.QuantityHeat capacity of lower layer
- property heat_capacity_upper¶
pint.QuantityHeat capacity of upper layer
- property lambda0¶
pint.QuantityInitial 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 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.