Code Duplication    Length = 19-19 lines in 3 locations

metpy/calc/tests/test_thermo.py 3 locations

@@ 526-544 (lines=19) @@
523
    assert_almost_equal(isentprs[0][1], trueprs, 3)
524
525
526
def test_isentropic_pressure_adition_args_interp():
527
    """Test calculation of isentropic pressure function, additional args."""
528
    lev = [100000., 95000., 90000., 85000.] * units.Pa
529
    tmp = np.ones((4, 5, 5))
530
    tmp[0, :] = 296.
531
    tmp[1, :] = 292.
532
    tmp[2, :] = 290.
533
    tmp[3, :] = 288.
534
    rh = np.ones((4, 5, 5))
535
    rh[0, :] = 100.
536
    rh[1, :] = 80.
537
    rh[2, :] = 40.
538
    rh[3, :] = 20.
539
    relh = rh * units.percent
540
    tmpk = tmp * units.kelvin
541
    isentlev = [296., 297.] * units.kelvin
542
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh)
543
    truerh = 69.171 * units.percent
544
    assert_almost_equal(isentprs[1][1], truerh, 3)
545
546
547
def test_isentropic_pressure_tmp_out_interp():
@@ 490-508 (lines=19) @@
487
    assert_almost_equal(isentprs[1], truetmp, 3)
488
489
490
def test_isentropic_pressure_p_increase_rh_out():
491
    """Test calculation of isentropic pressure function, p increasing order."""
492
    lev = [85000., 90000., 95000., 100000.] * units.Pa
493
    tmp = np.ones((4, 5, 5))
494
    tmp[0, :] = 288.
495
    tmp[1, :] = 290.
496
    tmp[2, :] = 292.
497
    tmp[3, :] = 296.
498
    tmpk = tmp * units.kelvin
499
    rh = np.ones((4, 5, 5))
500
    rh[0, :] = 20.
501
    rh[1, :] = 40.
502
    rh[2, :] = 80.
503
    rh[3, :] = 100.
504
    relh = rh * units.percent
505
    isentlev = [296.] * units.kelvin
506
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh)
507
    truerh = 100. * units.percent
508
    assert_almost_equal(isentprs[1], truerh, 3)
509
510
511
def test_isentropic_pressure_interp():
@@ 454-472 (lines=19) @@
451
    assert_almost_equal(isentprs[0], trueprs, 3)
452
453
454
def test_isentropic_pressure_adition_args():
455
    """Test calculation of isentropic pressure function, additional args."""
456
    lev = [100000., 95000., 90000., 85000.] * units.Pa
457
    tmp = np.ones((4, 5, 5))
458
    tmp[0, :] = 296.
459
    tmp[1, :] = 292.
460
    tmp[2, :] = 290.
461
    tmp[3, :] = 288.
462
    rh = np.ones((4, 5, 5))
463
    rh[0, :] = 100.
464
    rh[1, :] = 80.
465
    rh[2, :] = 40.
466
    rh[3, :] = 20.
467
    relh = rh * units.percent
468
    tmpk = tmp * units.kelvin
469
    isentlev = [296.] * units.kelvin
470
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh)
471
    truerh = 100. * units.percent
472
    assert_almost_equal(isentprs[1], truerh, 3)
473
474
475
def test_isentropic_pressure_tmp_out():