Skip to content

Commit

Permalink
Bug fixes on the ThreeLayerSW process. Now have a working example in …
Browse files Browse the repository at this point in the history
…the Spectral Column notebook.
  • Loading branch information
brian-rose committed Feb 27, 2015
1 parent 0c24dff commit 1ff4288
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 84 deletions.
4 changes: 3 additions & 1 deletion climlab/model/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def do_diagnostics(self):
#self.diagnostics['OLR_atm'] = self.flux['atm2space']
try: self.diagnostics['ASR'] = SW.flux_from_space - SW.flux_to_space
except: pass
try: self.diagnostics['SW_absorbed_sfc'] = -SW.flux_net[0]
try:
self.diagnostics['SW_absorbed_sfc'] = (surf.SW_from_atm -
surf.SW_to_atm)
except: pass
try: self.diagnostics['SW_absorbed_atm'] = SW.absorbed
except: pass
Expand Down
26 changes: 16 additions & 10 deletions climlab/radiation/three_band.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def __init__(self, **kwargs):
self.qStrat = 5.E-6 # minimum specific humidity for stratosphere
#self.flux_from_space = self.band_fraction*np.ones_like(self.Ts)
#self.flux_from_space = self.flux_from_space[..., np.newaxis]
self.flux_from_sfc = self.band_fraction*np.zeros_like(self.Ts)
self.flux_from_sfc = self.flux_from_sfc[..., np.newaxis]
self.flux_from_sfc = np.zeros_like(self.Ts)
#self.flux_from_sfc = self.flux_from_sfc[..., np.newaxis]
self.albedo_sfc = np.ones_like(self.band_fraction)*self.albedo_sfc
self.albedo_sfc = self.albedo_sfc[..., np.newaxis]
#self.albedo_sfc = self.albedo_sfc[..., np.newaxis]
self.compute_absorptivity()

def Manabe_water_vapor(self):
Expand Down Expand Up @@ -96,20 +96,26 @@ def radiative_heating(self):
self.emission = self.compute_emission()
#self.diagnostics['emission'] = emission
try:
fromspace = (self.band_fraction*self.flux_from_space)[..., np.newaxis]
fromspace = self.split_channels(self.flux_from_space)
except:
fromspace = np.zeros_like(self.Ts)
fromspace = self.split_channels(np.zeros_like(self.Ts))

self.flux_down = self.trans.flux_down(fromspace, self.emission)
# this ensure same dimensions as other fields
flux_down_sfc = self.flux_down[..., 0, np.newaxis]
flux_up_bottom = self.flux_from_sfc + self.albedo_sfc*flux_down_sfc
#flux_down_sfc = self.flux_down[..., 0]
self.flux_to_sfc = np.sum(flux_down_sfc, axis=0)

flux_from_sfc = self.split_channels(self.flux_from_sfc)
flux_up_bottom = flux_from_sfc + self.albedo_sfc*flux_down_sfc
self.flux_up = self.trans.flux_up(flux_up_bottom, self.emission)
self.flux_net = self.flux_up - self.flux_down
flux_up_top = self.flux_up[..., -1, np.newaxis]
# absorbed radiation (flux convergence) in W / m**2
self.absorbed = -np.diff(self.flux_net)
self.absorbed = -np.diff(self.flux_net, axis=1)
self.absorbed_total = np.sum(self.absorbed)
self.heating_rate['Tatm'] = self.absorbed
self.flux_to_sfc = flux_down_sfc
self.flux_to_space = flux_up_top
self.heating_rate['Tatm'] = np.sum(self.absorbed, axis=0)
self.flux_to_space = np.sum(flux_up_top, axis=0)

def split_channels(self, flux):
return (self.band_fraction*flux)[..., np.newaxis]
18 changes: 9 additions & 9 deletions courseware/Soundings from Observations and RCE Models.ipynb

Large diffs are not rendered by default.

230 changes: 166 additions & 64 deletions courseware/The spectral column model.ipynb

Large diffs are not rendered by default.

0 comments on commit 1ff4288

Please sign in to comment.