|
@@ 316-328 (lines=13) @@
|
| 313 |
|
assert_almost_equal(isentprs[0][1], trueprs, 3) |
| 314 |
|
|
| 315 |
|
|
| 316 |
|
def test_isentropic_pressure_p_increase(): |
| 317 |
|
"""Test calculation of isentropic pressure function, p increasing order.""" |
| 318 |
|
lev = [85000, 90000., 95000., 100000.] * units.Pa |
| 319 |
|
tmp = np.ones((4, 5, 5)) |
| 320 |
|
tmp[0, :] = 288. |
| 321 |
|
tmp[1, :] = 290. |
| 322 |
|
tmp[2, :] = 292. |
| 323 |
|
tmp[3, :] = 296. |
| 324 |
|
tmpk = tmp * units.kelvin |
| 325 |
|
isentlev = [296.] * units.kelvin |
| 326 |
|
isentprs = get_isentropic_pressure(isentlev, lev, tmpk) |
| 327 |
|
trueprs = 1000. * units.hPa |
| 328 |
|
assert_almost_equal(isentprs[0][1], trueprs, 3) |
| 329 |
|
|
| 330 |
|
|
| 331 |
|
def test_isentropic_pressure_adition_args(): |
|
@@ 352-364 (lines=13) @@
|
| 349 |
|
assert_almost_equal(isentprs[1][0][1], truerh, 3) |
| 350 |
|
|
| 351 |
|
|
| 352 |
|
def test_isentropic_pressure_tmp_out(): |
| 353 |
|
"""Test calculation of isentropic pressure function, temperature output.""" |
| 354 |
|
lev = [100000., 95000., 90000., 85000.] * units.Pa |
| 355 |
|
tmp = np.ones((4, 5, 5)) |
| 356 |
|
tmp[0, :] = 296. |
| 357 |
|
tmp[1, :] = 292. |
| 358 |
|
tmp[2, :] = 290. |
| 359 |
|
tmp[3, :] = 288. |
| 360 |
|
tmpk = tmp * units.kelvin |
| 361 |
|
isentlev = [296.] * units.kelvin |
| 362 |
|
isentprs = get_isentropic_pressure(isentlev, lev, tmpk, tmpk_out=True) |
| 363 |
|
truetmp = 296. * units.kelvin |
| 364 |
|
assert_almost_equal(isentprs[1][1][0], truetmp, 3) |
| 365 |
|
|