AplusBT¶
digraph inheritance2878b3a7d8 { bgcolor=transparent; rankdir=LR; ratio=expand; size=""; "AplusBT" [URL="#climlab.radiation.aplusbt.AplusBT",dirType=back,fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=14,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The simplest linear longwave radiation module."]; "EnergyBudget" -> "AplusBT" [arrowsize=0.5,dirType=back,style="setlinewidth(0.5)"]; "EnergyBudget" [URL="climlab.process.energy_budget.html#climlab.process.energy_budget.EnergyBudget",dirType=back,fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=14,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A parent class for explicit energy budget processes."]; "TimeDependentProcess" -> "EnergyBudget" [arrowsize=0.5,dirType=back,style="setlinewidth(0.5)"]; "Process" [URL="climlab.process.process.html#climlab.process.process.Process",dirType=back,fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=14,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A generic parent class for all climlab process objects."]; "TimeDependentProcess" [URL="climlab.process.time_dependent_process.html#climlab.process.time_dependent_process.TimeDependentProcess",dirType=back,fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=14,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A generic parent class for all time-dependent processes."]; "Process" -> "TimeDependentProcess" [arrowsize=0.5,dirType=back,style="setlinewidth(0.5)"]; }- class climlab.radiation.aplusbt.AplusBT(A=200.0, B=2.0, **kwargs)[source]¶
Bases:
EnergyBudget
The simplest linear longwave radiation module.
Calculates the Outgoing Longwave Radation (OLR) \(R\uparrow\) as
\[R\uparrow = A + B \cdot T\]where \(T\) is the state variable.
Should be invoked with a single temperature state variable only.
Initialization parameters n
An instance of
AplusBT
is initialized with the following arguments:- Parameters:
Object attributes n
Additional to the parent class
EnergyBudget
following object attributes are generated or modified during initialization:- Variables:
Warning
This module currently works only for a single state variable!
- Example:
Simple linear radiation module (stand alone):
>>> import climlab >>> # create a column atmosphere and scalar surface >>> sfc, atm = climlab.domain.single_column() >>> # Create a state variable >>> Ts = climlab.Field(15., domain=sfc) >>> # Make a dictionary of state variables >>> s = {'Ts': Ts} >>> # create process >>> olr = climlab.radiation.AplusBT(state=s) >>> print olr climlab Process of type <class 'climlab.radiation.AplusBT.AplusBT'>. State variables and domain shapes: Ts: (1,) The subprocess tree: top: <class 'climlab.radiation.AplusBT.AplusBT'> >>> # to compute tendencies and diagnostics >>> olr.compute() >>> # or to actually update the temperature >>> olr.step_forward() >>> print olr.state {'Ts': Field([ 5.69123176])}
- Attributes:
A
Property of AplusBT parameter A.
B
Property of AplusBT parameter B.
depth
Depth at grid centers (m)
depth_bounds
Depth at grid interfaces (m)
diagnostics
Dictionary access to all diagnostic variables
input
Dictionary access to all input variables
lat
Latitude of grid centers (degrees North)
lat_bounds
Latitude of grid interfaces (degrees North)
lev
Pressure levels at grid centers (hPa or mb)
lev_bounds
Pressure levels at grid interfaces (hPa or mb)
lon
Longitude of grid centers (degrees)
lon_bounds
Longitude of grid interfaces (degrees)
timestep
The amount of time over which
step_forward()
is integrating in unit seconds.
Methods
add_diagnostic
(name[, value])Create a new diagnostic variable called
name
for this process and initialize it with the givenvalue
.add_input
(name[, value])Create a new input variable called
name
for this process and initialize it with the givenvalue
.add_subprocess
(name, proc)Adds a single subprocess to this process.
add_subprocesses
(procdict)Adds a dictionary of subproceses to this process.
compute
()Computes the tendencies for all state variables given current state and specified input.
compute_diagnostics
([num_iter])Compute all tendencies and diagnostics, but don't update model state.
declare_diagnostics
(diaglist)Add the variable names in
inputlist
to the list of diagnostics.declare_input
(inputlist)Add the variable names in
inputlist
to the list of necessary inputs.integrate_converge
([crit, verbose])Integrates the model until model states are converging.
integrate_days
([days, verbose])Integrates the model forward for a specified number of days.
integrate_years
([years, verbose])Integrates the model by a given number of years.
remove_diagnostic
(name)Removes a diagnostic from the
process.diagnostic
dictionary and also delete the associated process attribute.remove_subprocess
(name[, verbose])Removes a single subprocess from this process.
set_state
(name, value)Sets the variable
name
to a new statevalue
.set_timestep
([timestep, num_steps_per_year])Calculates the timestep in unit seconds and calls the setter function of
timestep()
step_forward
()Updates state variables with computed tendencies.
to_xarray
([diagnostics])Convert process variables to
xarray.Dataset
format.- property A¶
Property of AplusBT parameter A.
- Getter:
Returns the parameter A which is stored in attribute
self._A
- Setter:
sets parameter A which is addressed as
self._A
to the new valueupdates the parameter dictionary
self.param['A']
- Type:
- Example:
>>> import climlab >>> model = climlab.EBM() >>> # getter >>> model.subprocess['LW'].A 210.0 >>> # setter >>> model.subprocess['LW'].A = 220 >>> # getter again >>> model.subprocess['LW'].A 220 >>> # subprocess parameter dictionary >>> model.subprocess['LW'].param['A'] 220
- class climlab.radiation.aplusbt.AplusBT_CO2(CO2=300.0, **kwargs)[source]¶
Bases:
EnergyBudget
Linear longwave radiation module considering CO2 concentration.
This radiation subprocess is based in the idea to linearize the Outgoing Longwave Radiation (OLR) emitted to space according to the surface temperature (see
AplusBT
).To consider a the change of the greenhouse effect through range of \(CO_2\) in the atmosphere, the parameters A and B are computed like the following:
\[ \begin{align}\begin{aligned}A(c) = -326.4 + 9.161 c - 3.164 c^2 + 0.5468 c^3 \\B(c) = 1.953 - 0.04866 c + 0.01309 c^2 - 0.002577 c^3\end{aligned}\end{align} \]where \(c=\log \frac{p}{300}\) and \(p\) represents the concentration of \(CO_2\) in the atmosphere.
For further reading see [].
Initialization parameters
An instance of
AplusBT_CO2
is initialized with the following argument:- Parameters:
CO2 (float) –
The concentration of \(CO_2\) in the atmosphere. Referred to as \(p\) in the above given formulas.
unit: \(\textrm{ppm}\) (parts per million)
default value:
300.0
Object attributes
Additional to the parent class
EnergyBudget
following object attributes are generated or updated during initialization:- Variables:
- Example:
Replacing an the regular AplusBT subprocess in an energy balance model:
>>> import climlab >>> from climlab.radiation.AplusBT import AplusBT_CO2 >>> # creating EBM model >>> model = climlab.EBM() >>> print model
climlab Process of type <class 'climlab.model.ebm.EBM'>. State variables and domain shapes: Ts: (90, 1) The subprocess tree: top: <class 'climlab.model.ebm.EBM'> diffusion: <class 'climlab.dynamics.diffusion.MeridionalDiffusion'> LW: <class 'climlab.radiation.AplusBT.AplusBT'> albedo: <class 'climlab.surface.albedo.StepFunctionAlbedo'> iceline: <class 'climlab.surface.albedo.Iceline'> cold_albedo: <class 'climlab.surface.albedo.ConstantAlbedo'> warm_albedo: <class 'climlab.surface.albedo.P2Albedo'> insolation: <class 'climlab.radiation.insolation.P2Insolation'>
>>> # creating and adding albedo feedback subprocess >>> LW_CO2 = AplusBT_CO2(CO2=400, state=model.state, **model.param) >>> # overwriting old 'LW' subprocess with same name >>> model.add_subprocess('LW', LW_CO2) >>> print model
climlab Process of type <class 'climlab.model.ebm.EBM'>. State variables and domain shapes: Ts: (90, 1) The subprocess tree: top: <class 'climlab.model.ebm.EBM'> diffusion: <class 'climlab.dynamics.diffusion.MeridionalDiffusion'> LW: <class 'climlab.radiation.AplusBT.AplusBT_CO2'> albedo: <class 'climlab.surface.albedo.StepFunctionAlbedo'> iceline: <class 'climlab.surface.albedo.Iceline'> cold_albedo: <class 'climlab.surface.albedo.ConstantAlbedo'> warm_albedo: <class 'climlab.surface.albedo.P2Albedo'> insolation: <class 'climlab.radiation.insolation.P2Insolation'>
- Attributes:
CO2
Property of AplusBT_CO2 parameter CO2.
depth
Depth at grid centers (m)
depth_bounds
Depth at grid interfaces (m)
diagnostics
Dictionary access to all diagnostic variables
input
Dictionary access to all input variables
lat
Latitude of grid centers (degrees North)
lat_bounds
Latitude of grid interfaces (degrees North)
lev
Pressure levels at grid centers (hPa or mb)
lev_bounds
Pressure levels at grid interfaces (hPa or mb)
lon
Longitude of grid centers (degrees)
lon_bounds
Longitude of grid interfaces (degrees)
timestep
The amount of time over which
step_forward()
is integrating in unit seconds.
Methods
add_diagnostic
(name[, value])Create a new diagnostic variable called
name
for this process and initialize it with the givenvalue
.add_input
(name[, value])Create a new input variable called
name
for this process and initialize it with the givenvalue
.add_subprocess
(name, proc)Adds a single subprocess to this process.
add_subprocesses
(procdict)Adds a dictionary of subproceses to this process.
compute
()Computes the tendencies for all state variables given current state and specified input.
compute_diagnostics
([num_iter])Compute all tendencies and diagnostics, but don't update model state.
declare_diagnostics
(diaglist)Add the variable names in
inputlist
to the list of diagnostics.declare_input
(inputlist)Add the variable names in
inputlist
to the list of necessary inputs.integrate_converge
([crit, verbose])Integrates the model until model states are converging.
integrate_days
([days, verbose])Integrates the model forward for a specified number of days.
integrate_years
([years, verbose])Integrates the model by a given number of years.
remove_diagnostic
(name)Removes a diagnostic from the
process.diagnostic
dictionary and also delete the associated process attribute.remove_subprocess
(name[, verbose])Removes a single subprocess from this process.
set_state
(name, value)Sets the variable
name
to a new statevalue
.set_timestep
([timestep, num_steps_per_year])Calculates the timestep in unit seconds and calls the setter function of
timestep()
step_forward
()Updates state variables with computed tendencies.
to_xarray
([diagnostics])Convert process variables to
xarray.Dataset
format.