Skip to content

Commit

Permalink
Merge pull request #33 from hgloeckner/add_calc_rh
Browse files Browse the repository at this point in the history
add theta_t reverse test
  • Loading branch information
hgloeckner authored Sep 3, 2024
2 parents 396a3be + a431190 commit 092d384
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

ds = xr.Dataset(
data_vars=dict(
ta=(["alt"], T),
p=(["alt"], p),
ta=(["alt"], T, {"units": "kelvin"}),
p=(["alt"], p, {"units": "Pa"}),
rh=(["alt"], rh),
q=(["alt"], q),
),
Expand All @@ -30,3 +30,9 @@ def test_q2rh2q():
rh2q = hh.calc_q_from_rh(ds)
q2rh = hh.calc_rh_from_q(rh2q)
assert np.all(np.round(ds.rh.values, 3) == np.round(q2rh.rh.values, 3))


def test_t2theta2t():
t2theta = hh.calc_theta_from_T(ds)
theta2t = hh.calc_T_from_theta(t2theta)
assert np.all(np.round(ds.ta.values, 2) == np.round(theta2t.ta.values, 2))

0 comments on commit 092d384

Please sign in to comment.