-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from brian-rose/newapi
version 0.3.0
- Loading branch information
Showing
77 changed files
with
14,936 additions
and
4,030 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__all__ = ['axis', 'domain'] | ||
__all__ = ['axis', 'domain', 'field', 'initial'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'''Convenience routines for setting up initial conditions.''' | ||
import numpy as np | ||
from climlab.domain import domain | ||
from climlab.domain.field import Field | ||
from climlab.utils.attr_dict import AttrDict | ||
from climlab.utils import legendre | ||
|
||
|
||
def column_state(num_lev=30, | ||
num_lat=1, | ||
lev=None, | ||
lat=None, | ||
water_depth=1.0): | ||
'''Set up a state variable dictionary consisting of temperatures | ||
for atmospheric column (`Tatm`) and surface mixed layer (`Ts`). | ||
''' | ||
if lat is not None: | ||
num_lat = np.array(lat).size | ||
if lev is not None: | ||
num_lev = np.array(lev).size | ||
|
||
if num_lat is 1: | ||
sfc, atm = domain.single_column(water_depth=water_depth, | ||
num_lev=num_lev, | ||
lev=lev) | ||
else: | ||
sfc, atm = domain.zonal_mean_column(water_depth=water_depth, | ||
num_lev=num_lev, | ||
lev=lev, | ||
num_lat=num_lat, | ||
lat=lat) | ||
num_lev = atm.lev.num_points | ||
Ts = Field(288.*np.ones(sfc.shape), domain=sfc) | ||
Tinitial = np.tile(np.linspace(200., 288.-10., num_lev), sfc.shape) | ||
Tatm = Field(Tinitial, domain=atm) | ||
state = AttrDict() | ||
state['Ts'] = Ts | ||
state['Tatm'] = Tatm | ||
return state | ||
|
||
|
||
def surface_state(num_lat=90, | ||
water_depth=10., | ||
T0=12., | ||
T2=-40.): | ||
'''Set up a state variable dictionary for a zonal-mean surface model | ||
(e.g. basic EBM). There is a single state variable `Ts`, the temperature | ||
of the surface mixed layer. | ||
''' | ||
sfc = domain.zonal_mean_surface(num_lat=num_lat, | ||
water_depth=water_depth) | ||
sinphi = np.sin(np.deg2rad(sfc.axes['lat'].points)) | ||
initial = T0 + T2 * legendre.P2(sinphi) | ||
Ts = Field(initial, domain=sfc) | ||
state = AttrDict() | ||
state['Ts'] = Ts | ||
return state |
Oops, something went wrong.