示例#1
0
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)
示例#2
0
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)
示例#3
0
 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
示例#4
0
 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
示例#5
0
 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 {}
示例#6
0
 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 {}
示例#7
0
 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
示例#8
0
 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
示例#9
0
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)
示例#10
0
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)