Code Duplication    Length = 19-19 lines in 3 locations

metpy/calc/tests/test_thermo.py 3 locations

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