|
@@ 531-542 (lines=12) @@
|
| 528 |
|
isentropic_interpolation(isentlev, lev, tmpk) |
| 529 |
|
|
| 530 |
|
|
| 531 |
|
def test_isentropic_pressure_data_warning(): |
| 532 |
|
"""Test of isentropic pressure function, warning for non-meteorological data.""" |
| 533 |
|
lev = [1000., 950., 900., 850.] * units.Pa |
| 534 |
|
tmp = np.ones((4, 5, 5)) |
| 535 |
|
tmp[0, :] = 296. |
| 536 |
|
tmp[1, :] = 292. |
| 537 |
|
tmp[2, :] = 290. |
| 538 |
|
tmp[3, :] = 288. |
| 539 |
|
tmpk = tmp * units.kelvin |
| 540 |
|
isentlev = [296., 297.] * units.kelvin |
| 541 |
|
with pytest.warns(Warning): |
| 542 |
|
isentropic_interpolation(isentlev, lev, tmpk) |
| 543 |
|
|
|
@@ 517-528 (lines=12) @@
|
| 514 |
|
isentropic_interpolation(isentlev, lev, tmpk) |
| 515 |
|
|
| 516 |
|
|
| 517 |
|
def test_isentropic_pressure_data_bounds_error(): |
| 518 |
|
"""Test calculation of isentropic pressure function, error for data out of bounds.""" |
| 519 |
|
lev = [100000., 95000., 90000., 85000.] * units.Pa |
| 520 |
|
tmp = np.ones((4, 5, 5)) |
| 521 |
|
tmp[0, :] = 296. |
| 522 |
|
tmp[1, :] = 292. |
| 523 |
|
tmp[2, :] = 290. |
| 524 |
|
tmp[3, :] = 288. |
| 525 |
|
tmpk = tmp * units.kelvin |
| 526 |
|
isentlev = [296., 350.] * units.kelvin |
| 527 |
|
with pytest.raises(ValueError): |
| 528 |
|
isentropic_interpolation(isentlev, lev, tmpk) |
| 529 |
|
|
| 530 |
|
|
| 531 |
|
def test_isentropic_pressure_data_warning(): |
|
@@ 503-514 (lines=12) @@
|
| 500 |
|
assert_almost_equal(isentprs[1][1], truetmp, 3) |
| 501 |
|
|
| 502 |
|
|
| 503 |
|
def test_isentropic_pressure_3d_error(): |
| 504 |
|
"""Test calculation of isentropic pressure function, error for input data not 3-D.""" |
| 505 |
|
lev = [100000., 95000., 90000., 85000.] * units.Pa |
| 506 |
|
tmp = np.ones((4, 5,)) |
| 507 |
|
tmp[0, :] = 296. |
| 508 |
|
tmp[1, :] = 292. |
| 509 |
|
tmp[2, :] = 290. |
| 510 |
|
tmp[3, :] = 288. |
| 511 |
|
tmpk = tmp * units.kelvin |
| 512 |
|
isentlev = [296., 297.] * units.kelvin |
| 513 |
|
with pytest.raises(ValueError): |
| 514 |
|
isentropic_interpolation(isentlev, lev, tmpk) |
| 515 |
|
|
| 516 |
|
|
| 517 |
|
def test_isentropic_pressure_data_bounds_error(): |