|
@@ 330-338 (lines=9) @@
|
| 327 |
|
assert_almost_equal(rh, 82.7145 * units.percent, 3) |
| 328 |
|
|
| 329 |
|
|
| 330 |
|
def test_cape_cin(): |
| 331 |
|
"""Tests the basic CAPE and CIN calculation.""" |
| 332 |
|
p = np.array([959., 779.2, 751.3, 724.3, 700., 269.]) * units.mbar |
| 333 |
|
temperature = np.array([22.2, 14.6, 12., 9.4, 7., -38.]) * units.celsius |
| 334 |
|
dewpoint = np.array([19., -11.2, -10.8, -10.4, -10., -53.2]) * units.celsius |
| 335 |
|
parcel_prof = parcel_profile(p, temperature[0], Td[0]).to('degC') |
| 336 |
|
cape, cin = cape_cin(p, temperature, dewpoint, parcel_prof) |
| 337 |
|
assert_almost_equal(cape, 58.0368212 * units('joule / kilogram'), 6) |
| 338 |
|
assert_almost_equal(cin, -89.8073512 * units('joule / kilogram'), 6) |
| 339 |
|
|
| 340 |
|
|
| 341 |
|
def test_find_append_zero_crossings(): |
|
@@ 179-186 (lines=8) @@
|
| 176 |
|
lcl(1000. * units.mbar, 30. * units.degC, 20. * units.degC, max_iters=2) |
| 177 |
|
|
| 178 |
|
|
| 179 |
|
def test_lfc_basic(): |
| 180 |
|
"""Test LFC calculation.""" |
| 181 |
|
levels = np.array([959., 779.2, 751.3, 724.3, 700., 269.]) * units.mbar |
| 182 |
|
temperatures = np.array([22.2, 14.6, 12., 9.4, 7., -49.]) * units.celsius |
| 183 |
|
dewpoints = np.array([19., -11.2, -10.8, -10.4, -10., -53.2]) * units.celsius |
| 184 |
|
l = lfc(levels, temperatures, dewpoints) |
| 185 |
|
assert_almost_equal(l[0], 727.468 * units.mbar, 2) |
| 186 |
|
assert_almost_equal(l[1], 9.705 * units.celsius, 2) |
| 187 |
|
|
| 188 |
|
|
| 189 |
|
def test_no_lfc(): |