Code Duplication    Length = 19-19 lines in 3 locations

metpy/calc/tests/test_thermo.py 3 locations

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