|
@@ 397-415 (lines=19) @@
|
| 394 |
|
assert_almost_equal(isentprs[1], truetmp, 3) |
| 395 |
|
|
| 396 |
|
|
| 397 |
|
def test_isentropic_pressure_p_increase_rh_out(): |
| 398 |
|
"""Test calculation of isentropic pressure function, p increasing order.""" |
| 399 |
|
lev = [85000., 90000., 95000., 100000.] * units.Pa |
| 400 |
|
tmp = np.ones((4, 5, 5)) |
| 401 |
|
tmp[0, :] = 288. |
| 402 |
|
tmp[1, :] = 290. |
| 403 |
|
tmp[2, :] = 292. |
| 404 |
|
tmp[3, :] = 296. |
| 405 |
|
tmpk = tmp * units.kelvin |
| 406 |
|
rh = np.ones((4, 5, 5)) |
| 407 |
|
rh[0, :] = 20. |
| 408 |
|
rh[1, :] = 40. |
| 409 |
|
rh[2, :] = 80. |
| 410 |
|
rh[3, :] = 100. |
| 411 |
|
relh = rh * units.percent |
| 412 |
|
isentlev = [296.] * units.kelvin |
| 413 |
|
isentprs = get_isentropic_pressure(isentlev, lev, tmpk, relh) |
| 414 |
|
truerh = 100. * units.percent |
| 415 |
|
assert_almost_equal(isentprs[1], truerh, 3) |
| 416 |
|
|
|
@@ 361-379 (lines=19) @@
|
| 358 |
|
assert_almost_equal(isentprs[0], trueprs, 3) |
| 359 |
|
|
| 360 |
|
|
| 361 |
|
def test_isentropic_pressure_adition_args(): |
| 362 |
|
"""Test calculation of isentropic pressure function, additional args.""" |
| 363 |
|
lev = [100000., 95000., 90000., 85000.] * units.Pa |
| 364 |
|
tmp = np.ones((4, 5, 5)) |
| 365 |
|
tmp[0, :] = 296. |
| 366 |
|
tmp[1, :] = 292. |
| 367 |
|
tmp[2, :] = 290. |
| 368 |
|
tmp[3, :] = 288. |
| 369 |
|
rh = np.ones((4, 5, 5)) |
| 370 |
|
rh[0, :] = 100. |
| 371 |
|
rh[1, :] = 80. |
| 372 |
|
rh[2, :] = 40. |
| 373 |
|
rh[3, :] = 20. |
| 374 |
|
relh = rh * units.percent |
| 375 |
|
tmpk = tmp * units.kelvin |
| 376 |
|
isentlev = [296.] * units.kelvin |
| 377 |
|
isentprs = get_isentropic_pressure(isentlev, lev, tmpk, relh) |
| 378 |
|
truerh = 100. * units.percent |
| 379 |
|
assert_almost_equal(isentprs[1], truerh, 3) |
| 380 |
|
|
| 381 |
|
|
| 382 |
|
def test_isentropic_pressure_tmp_out(): |