CAM3

climlab wrappers for the NCAR CAM3 radiation code
Input arguments and diagnostics follow specifications in
_Radiation
- Example:
Here is a quick example of setting up a single-column Radiative-Convective model with fixed relative humdity:
import climlab alb = 0.25 # State variables (Air and surface temperature) state = climlab.column_state(num_lev=30) # Parent model process rcm = climlab.TimeDependentProcess(state=state) # Fixed relative humidity h2o = climlab.radiation.ManabeWaterVapor(state=state) # Couple water vapor to radiation rad = climlab.radiation.CAM3(state=state, specific_humidity=h2o.q, albedo=alb) # Convective adjustment conv = climlab.convection.ConvectiveAdjustment(state=state, adj_lapse_rate=6.5) # Couple everything together rcm.add_subprocess('Radiation', rad) rcm.add_subprocess('WaterVapor', h2o) rcm.add_subprocess('Convection', conv) # Run the model rcm.integrate_years(1) # Check for energy balance print rcm.ASR - rcm.OLR
- class climlab.radiation.cam3.CAM3(**kwargs)[source]
Bases:
_Radiation_SW
,_Radiation_LW
climlab wrapper for the CAM3 radiation code.
For some details about inputs and diagnostics, see the radiation module.
- Attributes:
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
- insolation
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, timeave])Convert process variables to
xarray.Dataset
format.- _cam3_to_climlab(field)[source]
Output is either (KM, JM, 1) or (JM, 1). Transform this to…
(KM,) or (1,) if JM==1
(KM, JM) or (JM, 1) if JM>1
(longitude dimension IM not yet implemented).
- _climlab_to_cam3(field)[source]
Prepare field with proper dimension order. CAM3 code expects 3D arrays with (KM, JM, 1) and 2D arrays with (JM, 1).
- climlab grid dimensions are any of:
(KM,)
(JM, KM)
(JM, IM, KM)
(longitude dimension IM not yet implemented here).
- class climlab.radiation.cam3.CAM3_LW(**kwargs)[source]
Bases:
CAM3
- Attributes:
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
- insolation
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, timeave])Convert process variables to
xarray.Dataset
format.
- class climlab.radiation.cam3.CAM3_SW(**kwargs)[source]
Bases:
CAM3
- Attributes:
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
- insolation
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, timeave])Convert process variables to
xarray.Dataset
format.