|
@@ 589-600 (lines=12) @@
|
| 586 |
|
isentropic_interpolation(isentlev, lev, tmpk) |
| 587 |
|
|
| 588 |
|
|
| 589 |
|
def test_isentropic_pressure_data_warning(): |
| 590 |
|
"""Test of isentropic pressure function, warning for non-meteorological data.""" |
| 591 |
|
lev = [1000., 950., 900., 850.] * units.Pa |
| 592 |
|
tmp = np.ones((4, 5, 5)) |
| 593 |
|
tmp[0, :] = 296. |
| 594 |
|
tmp[1, :] = 292. |
| 595 |
|
tmp[2, :] = 290. |
| 596 |
|
tmp[3, :] = 288. |
| 597 |
|
tmpk = tmp * units.kelvin |
| 598 |
|
isentlev = [296., 297.] * units.kelvin |
| 599 |
|
with pytest.warns(Warning): |
| 600 |
|
isentropic_interpolation(isentlev, lev, tmpk) |
| 601 |
|
|
|
@@ 575-586 (lines=12) @@
|
| 572 |
|
isentropic_interpolation(isentlev, lev, tmpk) |
| 573 |
|
|
| 574 |
|
|
| 575 |
|
def test_isentropic_pressure_data_bounds_error(): |
| 576 |
|
"""Test calculation of isentropic pressure function, error for data out of bounds.""" |
| 577 |
|
lev = [100000., 95000., 90000., 85000.] * units.Pa |
| 578 |
|
tmp = np.ones((4, 5, 5)) |
| 579 |
|
tmp[0, :] = 296. |
| 580 |
|
tmp[1, :] = 292. |
| 581 |
|
tmp[2, :] = 290. |
| 582 |
|
tmp[3, :] = 288. |
| 583 |
|
tmpk = tmp * units.kelvin |
| 584 |
|
isentlev = [296., 350.] * units.kelvin |
| 585 |
|
with pytest.raises(ValueError): |
| 586 |
|
isentropic_interpolation(isentlev, lev, tmpk) |
| 587 |
|
|
| 588 |
|
|
| 589 |
|
def test_isentropic_pressure_data_warning(): |
|
@@ 561-572 (lines=12) @@
|
| 558 |
|
assert_almost_equal(isentprs[1][1], truetmp, 3) |
| 559 |
|
|
| 560 |
|
|
| 561 |
|
def test_isentropic_pressure_3d_error(): |
| 562 |
|
"""Test calculation of isentropic pressure function, error for input data not 3-D.""" |
| 563 |
|
lev = [100000., 95000., 90000., 85000.] * units.Pa |
| 564 |
|
tmp = np.ones((4, 5,)) |
| 565 |
|
tmp[0, :] = 296. |
| 566 |
|
tmp[1, :] = 292. |
| 567 |
|
tmp[2, :] = 290. |
| 568 |
|
tmp[3, :] = 288. |
| 569 |
|
tmpk = tmp * units.kelvin |
| 570 |
|
isentlev = [296., 297.] * units.kelvin |
| 571 |
|
with pytest.raises(ValueError): |
| 572 |
|
isentropic_interpolation(isentlev, lev, tmpk) |
| 573 |
|
|
| 574 |
|
|
| 575 |
|
def test_isentropic_pressure_data_bounds_error(): |