insolation

Classes to provide insolation as input for other CLIMLAB processes.
Options include
climlab.radiation.P2Insolation(idealized 2nd Legendre polynomial form)climlab.radiation.FixedInsolation(generic steady-state insolation)climlab.radiation.AnnualMeanInsolation(steady-state annual-mean insolation computed from orbital parameters and latitude)climlab.radiation.DailyInsolation(time-varying daily-mean insolation computed from orbital parameters, latitude and time of year)climlab.radiation.InstantInsolation(time-varying instantaneous insolation computed from orbital parameters, latitude, longitude, and time of year)
All are subclasses of climlab.process.DiagnosticProcess
and do not add any tendencies to any state variables.
At least three diagnostics are provided:
insolation, the incoming solar radiation in \(\frac{\textrm{W}}{\textrm{m}^2}\)coszen, cosine of the solar zenith angle (dimensionless)irradiance_factor, ratio of current total irradiance to its annual average, i.e. solar constant (dimensionless)
- class climlab.radiation.insolation.AnnualMeanInsolation(S0=1365.2, orb={'ecc': 0.017236, 'long_peri': 281.37, 'obliquity': 23.446}, weighting='time', **kwargs)[source]
Bases:
_InsolationA class for latitudewise solar insolation averaged over a year.
This class computes the daily-mean solar insolation for each day of the year and latitude specified in the domain on the basis of orbital parameters and astronomical formulas.
Internally this process calls the method
daily_insolation_factors()to compute solar zenith angle and adjustments to total irradiance. See there for details on how the solar distribution depends on orbital parameters.The mean over the year is calculated from data returned by
daily_insolation_factors()and stored in the diagnosticsinsolation,coszen, andirrandiance_factor.Different daily averaging methods can be specified for the zenith angle via the
weightingargument. Seedaily_insolation_factors()for more details.Initialization parameters
- Parameters:
S0 (float) –
solar constant
unit: \(\frac{\textrm{W}}{\textrm{m}^2}\)
default value:
1365.2
orb (dict) –
a dictionary with three orbital parameters (as provided by
OrbitalTable):'ecc'- eccentricityunit: dimensionless
default value:
0.017236
'long_peri'- longitude of perihelion (precession angle)unit: degrees
default value:
281.37
'obliquity'- obliquity angleunit: degrees
default value:
23.446
weighting (str) –
flag to specify daily averaging method for solar zenith angle. Valid options are:
'time'(default): unweighted 24 hour daily average'sunlit': time average over sunlit hours'insolation': insolation-weighted average
Object attributes
Additional to the parent class
_Insolationfollowing object attributes are generated and updated during initialization:- Variables:
- Example:
Create regular EBM and replace standard insolation subprocess by
AnnualMeanInsolation:>>> import climlab >>> from climlab.radiation import AnnualMeanInsolation >>> # model creation >>> 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'>>>> # catch model domain for subprocess creation >>> sfc = model.domains['Ts'] >>> # create AnnualMeanInsolation subprocess >>> new_insol = AnnualMeanInsolation(domains=sfc, **model.param) >>> # add it to the model >>> model.add_subprocess('insolation',new_insol) >>> 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.AnnualMeanInsolation'>- Attributes:
S0Property of solar constant S0.
depthDepth at grid centers (m)
depth_boundsDepth at grid interfaces (m)
diagnosticsDictionary access to all diagnostic variables
inputDictionary access to all input variables
latLatitude of grid centers (degrees North)
lat_boundsLatitude of grid interfaces (degrees North)
levPressure levels at grid centers (hPa or mb)
lev_boundsPressure levels at grid interfaces (hPa or mb)
lonLongitude of grid centers (degrees)
lon_boundsLongitude of grid interfaces (degrees)
orbProperty of dictionary for orbital parameters.
timestepThe amount of time over which
step_forward()is integrating in unit seconds.
Methods
add_diagnostic(name[, value])Create a new diagnostic variable called
namefor this process and initialize it with the givenvalue.add_input(name[, value])Create a new input variable called
namefor this process and initialize it with the givenvalue.add_subprocess(name, proc[, verbose])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
inputlistto the list of diagnostics.declare_input(inputlist)Add the variable names in
inputlistto 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.diagnosticdictionary 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
nameto 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, timeave])Convert process variables to
xarray.Datasetformat.- property orb
Property of dictionary for orbital parameters.
orb contains: (for more information see
OrbitalTable)'ecc'- eccentricity [unit: dimensionless]'long_peri'- longitude of perihelion (precession angle) [unit: degrees]'obliquity'- obliquity angle [unit: degrees]
- Getter:
Returns the orbital dictionary which is stored in attribute
self._orb.- Setter:
sets orb which is addressed as
self._orbto the new valueupdates the parameter dictionary
self.param['orb']andcalls method
_compute_fixed()
- Type:
- class climlab.radiation.insolation.DailyInsolation(S0=1365.2, orb={'ecc': 0.017236, 'long_peri': 281.37, 'obliquity': 23.446}, weighting='time', **kwargs)[source]
Bases:
AnnualMeanInsolationA class to compute latitudewise daily average solar insolation for specific days of the year.
This class computes the solar insolation on basis of orbital parameters and astronomical formulas.
Internally this process calls the method
daily_insolation_factors(). to compute solar zenith angle and adjustments to total irradiance. See there for details on how the solar distribution depends on orbital parameters.Different daily averaging methods can be specified for the zenith angle via the
weightingargument. Seedaily_insolation_factors()for more details.Initialization parameters
- Parameters:
S0 (float) –
solar constant
unit: \(\frac{\textrm{W}}{\textrm{m}^2}\)
default value:
1365.2
orb (dict) –
a dictionary with orbital parameters:
'ecc'- eccentricityunit: dimensionless
default value:
0.017236
'long_peri'- longitude of perihelion (precession angle)unit: degrees
default value:
281.37
'obliquity'- obliquity angleunit: degrees
default value:
23.446
weighting (str) –
flag to specify daily averaging method for solar zenith angle. Valid options are:
'time'(default): unweighted 24 hour daily average'sunlit': time average over sunlit hours'insolation': insolation-weighted average
Object attributes
Additional to the parent class
_Insolationfollowing object attributes are generated and updated during initialization:- Variables:
- Example:
Create regular EBM and replace standard insolation subprocess by
DailyInsolation:>>> import climlab >>> from climlab.radiation import DailyInsolation >>> # model creation >>> 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'>>>> # catch model domain for subprocess creation >>> sfc = model.domains['Ts'] >>> # create DailyInsolation subprocess and add it to the model >>> model.add_subprocess('insolation',DailyInsolation(domains=sfc, **model.param)) >>> 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.DailyInsolation'>- Attributes:
S0Property of solar constant S0.
depthDepth at grid centers (m)
depth_boundsDepth at grid interfaces (m)
diagnosticsDictionary access to all diagnostic variables
inputDictionary access to all input variables
latLatitude of grid centers (degrees North)
lat_boundsLatitude of grid interfaces (degrees North)
levPressure levels at grid centers (hPa or mb)
lev_boundsPressure levels at grid interfaces (hPa or mb)
lonLongitude of grid centers (degrees)
lon_boundsLongitude of grid interfaces (degrees)
orbProperty of dictionary for orbital parameters.
timestepThe amount of time over which
step_forward()is integrating in unit seconds.
Methods
add_diagnostic(name[, value])Create a new diagnostic variable called
namefor this process and initialize it with the givenvalue.add_input(name[, value])Create a new input variable called
namefor this process and initialize it with the givenvalue.add_subprocess(name, proc[, verbose])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
inputlistto the list of diagnostics.declare_input(inputlist)Add the variable names in
inputlistto 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.diagnosticdictionary 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
nameto 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, timeave])Convert process variables to
xarray.Datasetformat.
- class climlab.radiation.insolation.FixedInsolation(S0=341.3, **kwargs)[source]
Bases:
_InsolationA class for fixed insolation at each point of latitude off the domain.
The solar distribution for the whole domain is constant and specified by a parameter.
Initialization parameters
- Parameters:
S0 (float) –
solar constant
unit: \(\frac{\textrm{W}}{\textrm{m}^2}\)
default value:
const.S0/4 = 341.2
- Example:
>>> import climlab >>> from climlab.radiation.insolation import FixedInsolation >>> model = climlab.EBM() >>> sfc = model.Ts.domain >>> fixed_ins = FixedInsolation(S0=340.0, domains=sfc) >>> print(fixed_ins) climlab Process of type <class 'climlab.radiation.insolation.FixedInsolation'>. State variables and domain shapes: The subprocess tree: top: <class 'climlab.radiation.insolation.FixedInsolation'>
- Attributes:
S0Property of solar constant S0.
depthDepth at grid centers (m)
depth_boundsDepth at grid interfaces (m)
diagnosticsDictionary access to all diagnostic variables
inputDictionary access to all input variables
latLatitude of grid centers (degrees North)
lat_boundsLatitude of grid interfaces (degrees North)
levPressure levels at grid centers (hPa or mb)
lev_boundsPressure levels at grid interfaces (hPa or mb)
lonLongitude of grid centers (degrees)
lon_boundsLongitude of grid interfaces (degrees)
timestepThe amount of time over which
step_forward()is integrating in unit seconds.
Methods
add_diagnostic(name[, value])Create a new diagnostic variable called
namefor this process and initialize it with the givenvalue.add_input(name[, value])Create a new input variable called
namefor this process and initialize it with the givenvalue.add_subprocess(name, proc[, verbose])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
inputlistto the list of diagnostics.declare_input(inputlist)Add the variable names in
inputlistto 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.diagnosticdictionary 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
nameto 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, timeave])Convert process variables to
xarray.Datasetformat.
- class climlab.radiation.insolation.InstantInsolation(S0=1365.2, orb={'ecc': 0.017236, 'long_peri': 281.37, 'obliquity': 23.446}, weighting='time', **kwargs)[source]
Bases:
AnnualMeanInsolationA class to compute latitudewise instantaneous solar insolation for specific days of the year.
This class computes the solar insolation on basis of orbital parameters and astronomical formulas.
Therefore it uses the method
instant_insolation(). For details how the solar distribution is dependend on orbital parameters see there.Initialization parameters
- Parameters:
S0 (float) –
solar constant
unit: \(\frac{\textrm{W}}{\textrm{m}^2}\)
default value:
1365.2
orb (dict) –
a dictionary with orbital parameters:
'ecc'- eccentricityunit: dimensionless
default value:
0.017236
'long_peri'- longitude of perihelion (precession angle)unit: degrees
default value:
281.37
'obliquity'- obliquity angleunit: degrees
default value:
23.446
Object attributes
Additional to the parent class
_Insolationfollowing object attributes are generated and updated during initialization:- Variables:
- Example:
Create regular EBM and replace standard insolation subprocess by
DailyInsolation:>>> import climlab >>> from climlab.radiation import InstantInsolation >>> # model creation >>> 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'>>>> # catch model domain for subprocess creation >>> sfc = model.domains['Ts'] >>> # create InstantInsolation subprocess and add it to the model >>> model.add_subprocess('insolation',InstantInsolation(domains=sfc, **model.param)) >>> 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.InstantInsolation'>- Attributes:
S0Property of solar constant S0.
depthDepth at grid centers (m)
depth_boundsDepth at grid interfaces (m)
diagnosticsDictionary access to all diagnostic variables
inputDictionary access to all input variables
latLatitude of grid centers (degrees North)
lat_boundsLatitude of grid interfaces (degrees North)
levPressure levels at grid centers (hPa or mb)
lev_boundsPressure levels at grid interfaces (hPa or mb)
lonLongitude of grid centers (degrees)
lon_boundsLongitude of grid interfaces (degrees)
orbProperty of dictionary for orbital parameters.
timestepThe amount of time over which
step_forward()is integrating in unit seconds.
Methods
add_diagnostic(name[, value])Create a new diagnostic variable called
namefor this process and initialize it with the givenvalue.add_input(name[, value])Create a new input variable called
namefor this process and initialize it with the givenvalue.add_subprocess(name, proc[, verbose])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
inputlistto the list of diagnostics.declare_input(inputlist)Add the variable names in
inputlistto 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.diagnosticdictionary 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
nameto 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, timeave])Convert process variables to
xarray.Datasetformat.
- class climlab.radiation.insolation.P2Insolation(S0=1365.2, s2=-0.48, **kwargs)[source]
Bases:
_InsolationA class for parabolic solar distribution over the domain’s latitude on the basis of the second order Legendre Polynomial.
Calculates the latitude dependent solar distribution as
\[S(\varphi) = \frac{S_0}{4} \left( 1 + s_2 P_2(x) \right)\]where \(P_2(x) = \frac{1}{2} (3x^2 - 1)\) is the second order Legendre Polynomial and \(x=sin(\varphi)\).
Initialization parameters
- Parameters:
S0 (float) –
solar constant
unit: \(\frac{\textrm{W}}{\textrm{m}^2}\)
default value:
1365.2
s2 (floar) –
factor for second legendre polynominal term
default value:
-0.48
- Example:
>>> import climlab >>> from climlab.radiation.insolation import P2Insolation >>> model = climlab.EBM() >>> sfc = model.Ts.domain >>> p2_ins = P2Insolation(S0=340.0, s2=-0.5, domains=sfc) >>> print(p2_ins) climlab Process of type <class 'climlab.radiation.insolation.P2Insolation'>. State variables and domain shapes: The subprocess tree: top: <class 'climlab.radiation.insolation.P2Insolation'>
- Attributes:
S0Property of solar constant S0.
depthDepth at grid centers (m)
depth_boundsDepth at grid interfaces (m)
diagnosticsDictionary access to all diagnostic variables
inputDictionary access to all input variables
latLatitude of grid centers (degrees North)
lat_boundsLatitude of grid interfaces (degrees North)
levPressure levels at grid centers (hPa or mb)
lev_boundsPressure levels at grid interfaces (hPa or mb)
lonLongitude of grid centers (degrees)
lon_boundsLongitude of grid interfaces (degrees)
s2Property of second legendre polynomial factor s2.
timestepThe amount of time over which
step_forward()is integrating in unit seconds.
Methods
add_diagnostic(name[, value])Create a new diagnostic variable called
namefor this process and initialize it with the givenvalue.add_input(name[, value])Create a new input variable called
namefor this process and initialize it with the givenvalue.add_subprocess(name, proc[, verbose])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
inputlistto the list of diagnostics.declare_input(inputlist)Add the variable names in
inputlistto 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.diagnosticdictionary 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
nameto 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, timeave])Convert process variables to
xarray.Datasetformat.- property s2
Property of second legendre polynomial factor s2.
s2 in following equation:
\[S(\varphi) = \frac{S_0}{4} \left( 1 + s_2 P_2(x) \right)\]- Getter:
Returns the s2 parameter which is stored in attribute
self._s2.- Setter:
sets s2 which is addressed as
self._S0to the new valueupdates the parameter dictionary
self.param['s2']andcalls method
_compute_fixed()
- Type: