def test_thermo_domain(): '''Can we call qsat, etc on a multi-dim climlab state temperature object?''' state = climlab.column_state(num_lev = 30, num_lat=3) T = state.Tatm p = T.domain.lev.points thermo.clausius_clapeyron(T) thermo.qsat(T, p) thermo.pseudoadiabat(T, p) thermo.blackbody_emission(T)
def compute(self): es = clausius_clapeyron(self.Tatm) e = self.RH_profile * es # convert to specific humidity (assume dilute) qH2O = e / self.lev * const.Rd / const.Rv # mixing ratio can't be smaller than qStrat # (need some water in the stratosphere!) q = np.maximum(self.qStrat, qH2O) self.q -= self.q self.q += q
def _compute(self): es = clausius_clapeyron(self.Tatm) e = self.RH_profile * es # convert to specific humidity (assume dilute) qH2O = e / self.lev * const.Rd / const.Rv # mixing ratio can't be smaller than qStrat # (need some water in the stratosphere!) q = np.maximum(self.qStrat, qH2O) # Just set this directly here q_adjustment = q - self.q self.q += q_adjustment return {}
def _compute(self): es = clausius_clapeyron(self.Tatm) e = self.RH_profile * es # convert to specific humidity (assume dilute) qH2O = e/self.lev * const.Rd / const.Rv # mixing ratio can't be smaller than qStrat # (need some water in the stratosphere!) q = np.maximum(self.qStrat, qH2O) # Just set this directly here q_adjustment = q - self.q self.q += q_adjustment return {}
def compute(self): p = self.lev Q = p / const.ps h = self.relative_humidity * ( (Q - 0.02) / (1-0.02) ) es = clausius_clapeyron( self.Tatm ) e = h * es # convert to specific humidity (assume dilute) qH2O = e/p * const.Rd / const.Rv # mixing ratio can't be smaller than qStrat # (need some water in the stratosphere!) q = np.maximum( self.qStrat, qH2O ) self.q -= self.q self.q += q
def compute(self): p = self.lev Q = p / const.ps h = self.relative_humidity * ((Q - 0.02) / (1 - 0.02)) es = clausius_clapeyron(self.Tatm) e = h * es # convert to specific humidity (assume dilute) qH2O = e / p * const.Rd / const.Rv # mixing ratio can't be smaller than qStrat # (need some water in the stratosphere!) q = np.maximum(self.qStrat, qH2O) self.q -= self.q self.q += q
def test_thermo(): '''Basic single value tests for the thermodynamic routines.''' assert np.isclose(thermo.potential_temperature(250., 500.), 304.783) assert np.isclose(thermo.theta(250., 500.), 304.783) assert np.isclose(thermo.temperature_from_potential(300., 500.), 246.076) assert np.isclose(thermo.T(300., 500.), 246.076) assert np.isclose(thermo.clausius_clapeyron(300.), 35.345) assert np.isclose(thermo.qsat(300., 1000.), 0.02227839) assert np.isclose(thermo.estimated_inversion_strength(300., 290.), 5.3605345) assert np.isclose(thermo.EIS(300., 290.), 5.3605345) assert np.isclose(thermo.blackbody_emission(300.), 459.3)
def test_thermo(): '''Basic single value tests for the thermodynamic routines.''' assert np.isclose(thermo.potential_temperature(250., 500.), 304.783) assert np.isclose(thermo.theta(250., 500.), 304.783) assert np.isclose(thermo.temperature_from_potential(300., 500.), 246.076) assert np.isclose(thermo.T(300., 500.), 246.076) assert np.isclose(thermo.clausius_clapeyron(300.), 35.345) assert np.isclose(thermo.qsat(300., 1000.), 0.02227839) assert np.isclose(thermo.estimated_inversion_strength(300., 290.), 2.58025) assert np.isclose(thermo.EIS(300., 290.), 2.58025) assert np.isclose(thermo.blackbody_emission(300.), 459.3)