Code Duplication    Length = 19-19 lines in 3 locations

metpy/calc/tests/test_thermo.py 3 locations

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