|
@@ 540-558 (lines=19) @@
|
| 537 |
|
tmp[2, :] = 292. |
| 538 |
|
tmp[3, :] = 296. |
| 539 |
|
tmpk = tmp * units.kelvin |
| 540 |
|
rh = np.ones((4, 5, 5)) |
| 541 |
|
rh[0, :] = 20. |
| 542 |
|
rh[1, :] = 40. |
| 543 |
|
rh[2, :] = 80. |
| 544 |
|
rh[3, :] = 100. |
| 545 |
|
relh = rh * units.percent |
| 546 |
|
isentlev = 296. * units.kelvin |
| 547 |
|
isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh) |
| 548 |
|
truerh = 100. * units.percent |
| 549 |
|
assert_almost_equal(isentprs[1], truerh, 3) |
| 550 |
|
|
| 551 |
|
|
| 552 |
|
def test_isentropic_pressure_interp(): |
| 553 |
|
"""Test calculation of isentropic pressure function.""" |
| 554 |
|
lev = [100000., 95000., 90000., 85000.] * units.Pa |
| 555 |
|
tmp = np.ones((4, 5, 5)) |
| 556 |
|
tmp[0, :] = 296. |
| 557 |
|
tmp[1, :] = 292. |
| 558 |
|
tmp[2, :] = 290 |
| 559 |
|
tmp[3, :] = 288. |
| 560 |
|
tmpk = tmp * units.kelvin |
| 561 |
|
isentlev = [296., 297] * units.kelvin |
|
@@ 504-522 (lines=19) @@
|
| 501 |
|
tmp[2, :] = 290. |
| 502 |
|
tmp[3, :] = 288. |
| 503 |
|
rh = np.ones((4, 5, 5)) |
| 504 |
|
rh[0, :] = 100. |
| 505 |
|
rh[1, :] = 80. |
| 506 |
|
rh[2, :] = 40. |
| 507 |
|
rh[3, :] = 20. |
| 508 |
|
relh = rh * units.percent |
| 509 |
|
tmpk = tmp * units.kelvin |
| 510 |
|
isentlev = [296.] * units.kelvin |
| 511 |
|
isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh) |
| 512 |
|
truerh = 100. * units.percent |
| 513 |
|
assert_almost_equal(isentprs[1], truerh, 3) |
| 514 |
|
|
| 515 |
|
|
| 516 |
|
def test_isentropic_pressure_tmp_out(): |
| 517 |
|
"""Test calculation of isentropic pressure function, temperature output.""" |
| 518 |
|
lev = [100000., 95000., 90000., 85000.] * units.Pa |
| 519 |
|
tmp = np.ones((4, 5, 5)) |
| 520 |
|
tmp[0, :] = 296. |
| 521 |
|
tmp[1, :] = 292. |
| 522 |
|
tmp[2, :] = 290. |
| 523 |
|
tmp[3, :] = 288. |
| 524 |
|
tmpk = tmp * units.kelvin |
| 525 |
|
isentlev = [296.] * units.kelvin |
|
@@ 468-486 (lines=19) @@
|
| 465 |
|
"""Test calculation of isentropic pressure function.""" |
| 466 |
|
lev = [100000., 95000., 90000., 85000.] * units.Pa |
| 467 |
|
tmp = np.ones((4, 5, 5)) |
| 468 |
|
tmp[0, :] = 296. |
| 469 |
|
tmp[1, :] = 292. |
| 470 |
|
tmp[2, :] = 290 |
| 471 |
|
tmp[3, :] = 288. |
| 472 |
|
tmpk = tmp * units.kelvin |
| 473 |
|
isentlev = [296.] * units.kelvin |
| 474 |
|
isentprs = isentropic_interpolation(isentlev, lev, tmpk) |
| 475 |
|
trueprs = 1000. * units.hPa |
| 476 |
|
assert_almost_equal(isentprs[0].shape, (1, 5, 5), 3) |
| 477 |
|
assert_almost_equal(isentprs[0], trueprs, 3) |
| 478 |
|
|
| 479 |
|
|
| 480 |
|
def test_isentropic_pressure_p_increase(): |
| 481 |
|
"""Test calculation of isentropic pressure function, p increasing order.""" |
| 482 |
|
lev = [85000, 90000., 95000., 100000.] * units.Pa |
| 483 |
|
tmp = np.ones((4, 5, 5)) |
| 484 |
|
tmp[0, :] = 288. |
| 485 |
|
tmp[1, :] = 290. |
| 486 |
|
tmp[2, :] = 292. |
| 487 |
|
tmp[3, :] = 296. |
| 488 |
|
tmpk = tmp * units.kelvin |
| 489 |
|
isentlev = [296.] * units.kelvin |