Code Duplication    Length = 19-19 lines in 3 locations

metpy/calc/tests/test_thermo.py 3 locations

@@ 540-558 (lines=19) @@
537
    assert_almost_equal(isentprs[0][1], trueprs, 3)
538
539
540
def test_isentropic_pressure_adition_args_interp():
541
    """Test calculation of isentropic pressure function, additional args."""
542
    lev = [100000., 95000., 90000., 85000.] * units.Pa
543
    tmp = np.ones((4, 5, 5))
544
    tmp[0, :] = 296.
545
    tmp[1, :] = 292.
546
    tmp[2, :] = 290.
547
    tmp[3, :] = 288.
548
    rh = np.ones((4, 5, 5))
549
    rh[0, :] = 100.
550
    rh[1, :] = 80.
551
    rh[2, :] = 40.
552
    rh[3, :] = 20.
553
    relh = rh * units.percent
554
    tmpk = tmp * units.kelvin
555
    isentlev = [296., 297.] * units.kelvin
556
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh)
557
    truerh = 69.171 * units.percent
558
    assert_almost_equal(isentprs[1][1], truerh, 3)
559
560
561
def test_isentropic_pressure_tmp_out_interp():
@@ 504-522 (lines=19) @@
501
    assert_almost_equal(isentprs[1], truetmp, 3)
502
503
504
def test_isentropic_pressure_p_increase_rh_out():
505
    """Test calculation of isentropic pressure function, p increasing order."""
506
    lev = [85000., 90000., 95000., 100000.] * units.Pa
507
    tmp = np.ones((4, 5, 5))
508
    tmp[0, :] = 288.
509
    tmp[1, :] = 290.
510
    tmp[2, :] = 292.
511
    tmp[3, :] = 296.
512
    tmpk = tmp * units.kelvin
513
    rh = np.ones((4, 5, 5))
514
    rh[0, :] = 20.
515
    rh[1, :] = 40.
516
    rh[2, :] = 80.
517
    rh[3, :] = 100.
518
    relh = rh * units.percent
519
    isentlev = 296. * units.kelvin
520
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh)
521
    truerh = 100. * units.percent
522
    assert_almost_equal(isentprs[1], truerh, 3)
523
524
525
def test_isentropic_pressure_interp():
@@ 468-486 (lines=19) @@
465
    assert_almost_equal(isentprs[0], trueprs, 3)
466
467
468
def test_isentropic_pressure_adition_args():
469
    """Test calculation of isentropic pressure function, additional args."""
470
    lev = [100000., 95000., 90000., 85000.] * units.Pa
471
    tmp = np.ones((4, 5, 5))
472
    tmp[0, :] = 296.
473
    tmp[1, :] = 292.
474
    tmp[2, :] = 290.
475
    tmp[3, :] = 288.
476
    rh = np.ones((4, 5, 5))
477
    rh[0, :] = 100.
478
    rh[1, :] = 80.
479
    rh[2, :] = 40.
480
    rh[3, :] = 20.
481
    relh = rh * units.percent
482
    tmpk = tmp * units.kelvin
483
    isentlev = [296.] * units.kelvin
484
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, relh)
485
    truerh = 100. * units.percent
486
    assert_almost_equal(isentprs[1], truerh, 3)
487
488
489
def test_isentropic_pressure_tmp_out():