Code Duplication    Length = 19-19 lines in 3 locations

metpy/calc/tests/test_thermo.py 3 locations

@@ 467-485 (lines=19) @@
464
    assert_almost_equal(isentprs[0][1], trueprs, 3)
465
466
467
def test_isentropic_pressure_adition_args_interp():
468
    """Test calculation of isentropic pressure function, additional args."""
469
    lev = [100000., 95000., 90000., 85000.] * units.Pa
470
    tmp = np.ones((4, 5, 5))
471
    tmp[0, :] = 296.
472
    tmp[1, :] = 292.
473
    tmp[2, :] = 290.
474
    tmp[3, :] = 288.
475
    rh = np.ones((4, 5, 5))
476
    rh[0, :] = 100.
477
    rh[1, :] = 80.
478
    rh[2, :] = 40.
479
    rh[3, :] = 20.
480
    relh = rh * units.percent
481
    tmpk = tmp * units.kelvin
482
    isentlev = [296., 297.] * units.kelvin
483
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh)
484
    truerh = 69.15897 * units.percent
485
    assert_almost_equal(isentprs[1][1], truerh, 3)
486
487
488
def test_isentropic_pressure_tmp_out_interp():
@@ 431-449 (lines=19) @@
428
    assert_almost_equal(isentprs[1], truetmp, 3)
429
430
431
def test_isentropic_pressure_p_increase_rh_out():
432
    """Test calculation of isentropic pressure function, p increasing order."""
433
    lev = [85000., 90000., 95000., 100000.] * units.Pa
434
    tmp = np.ones((4, 5, 5))
435
    tmp[0, :] = 288.
436
    tmp[1, :] = 290.
437
    tmp[2, :] = 292.
438
    tmp[3, :] = 296.
439
    tmpk = tmp * units.kelvin
440
    rh = np.ones((4, 5, 5))
441
    rh[0, :] = 20.
442
    rh[1, :] = 40.
443
    rh[2, :] = 80.
444
    rh[3, :] = 100.
445
    relh = rh * units.percent
446
    isentlev = [296.] * units.kelvin
447
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh)
448
    truerh = 100. * units.percent
449
    assert_almost_equal(isentprs[1], truerh, 3)
450
451
452
def test_isentropic_pressure_interp():
@@ 395-413 (lines=19) @@
392
    assert_almost_equal(isentprs[0], trueprs, 3)
393
394
395
def test_isentropic_pressure_adition_args():
396
    """Test calculation of isentropic pressure function, additional args."""
397
    lev = [100000., 95000., 90000., 85000.] * units.Pa
398
    tmp = np.ones((4, 5, 5))
399
    tmp[0, :] = 296.
400
    tmp[1, :] = 292.
401
    tmp[2, :] = 290.
402
    tmp[3, :] = 288.
403
    rh = np.ones((4, 5, 5))
404
    rh[0, :] = 100.
405
    rh[1, :] = 80.
406
    rh[2, :] = 40.
407
    rh[3, :] = 20.
408
    relh = rh * units.percent
409
    tmpk = tmp * units.kelvin
410
    isentlev = [296.] * units.kelvin
411
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh)
412
    truerh = 100. * units.percent
413
    assert_almost_equal(isentprs[1], truerh, 3)
414
415
416
def test_isentropic_pressure_tmp_out():