Code Duplication    Length = 13-13 lines in 5 locations

metpy/calc/tests/test_thermo.py 5 locations

@@ 546-558 (lines=13) @@
543
    assert_almost_equal(isentprs[1][1], truerh, 3)
544
545
546
def test_isentropic_pressure_tmp_out_interp():
547
    """Test calculation of isentropic pressure function, temperature output."""
548
    lev = [100000., 95000., 90000., 85000.] * units.Pa
549
    tmp = np.ones((4, 5, 5))
550
    tmp[0, :] = 296.
551
    tmp[1, :] = 292.
552
    tmp[2, :] = 290.
553
    tmp[3, :] = 288.
554
    tmpk = tmp * units.kelvin
555
    isentlev = [296., 297.] * units.kelvin
556
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, tmpk_out=True)
557
    truetmp = 291.4579 * units.kelvin
558
    assert_almost_equal(isentprs[1][1], truetmp, 3)
559
560
561
def test_isentropic_pressure_3d_error():
@@ 510-522 (lines=13) @@
507
    assert_almost_equal(isentprs[1], truerh, 3)
508
509
510
def test_isentropic_pressure_interp():
511
    """Test calculation of isentropic pressure function."""
512
    lev = [100000., 95000., 90000., 85000.] * units.Pa
513
    tmp = np.ones((4, 5, 5))
514
    tmp[0, :] = 296.
515
    tmp[1, :] = 292.
516
    tmp[2, :] = 290
517
    tmp[3, :] = 288.
518
    tmpk = tmp * units.kelvin
519
    isentlev = [296., 297] * units.kelvin
520
    isentprs = isentropic_interpolation(isentlev, lev, tmpk)
521
    trueprs = 936.18057 * units.hPa
522
    assert_almost_equal(isentprs[0][1], trueprs, 3)
523
524
525
def test_isentropic_pressure_adition_args_interp():
@@ 474-486 (lines=13) @@
471
    assert_almost_equal(isentprs[1], truerh, 3)
472
473
474
def test_isentropic_pressure_tmp_out():
475
    """Test calculation of isentropic pressure function, temperature output."""
476
    lev = [100000., 95000., 90000., 85000.] * units.Pa
477
    tmp = np.ones((4, 5, 5))
478
    tmp[0, :] = 296.
479
    tmp[1, :] = 292.
480
    tmp[2, :] = 290.
481
    tmp[3, :] = 288.
482
    tmpk = tmp * units.kelvin
483
    isentlev = [296.] * units.kelvin
484
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, tmpk_out=True)
485
    truetmp = 296. * units.kelvin
486
    assert_almost_equal(isentprs[1], truetmp, 3)
487
488
489
def test_isentropic_pressure_p_increase_rh_out():
@@ 438-450 (lines=13) @@
435
    assert_almost_equal(isentprs[0], trueprs, 3)
436
437
438
def test_isentropic_pressure_p_increase():
439
    """Test calculation of isentropic pressure function, p increasing order."""
440
    lev = [85000, 90000., 95000., 100000.] * units.Pa
441
    tmp = np.ones((4, 5, 5))
442
    tmp[0, :] = 288.
443
    tmp[1, :] = 290.
444
    tmp[2, :] = 292.
445
    tmp[3, :] = 296.
446
    tmpk = tmp * units.kelvin
447
    isentlev = [296.] * units.kelvin
448
    isentprs = isentropic_interpolation(isentlev, lev, tmpk)
449
    trueprs = 1000. * units.hPa
450
    assert_almost_equal(isentprs[0], trueprs, 3)
451
452
453
def test_isentropic_pressure_adition_args():
@@ 423-435 (lines=13) @@
420
    assert_almost_equal(ret[2], 19.0 * units.degC, 6)
421
422
423
def test_isentropic_pressure():
424
    """Test calculation of isentropic pressure function."""
425
    lev = [100000., 95000., 90000., 85000.] * units.Pa
426
    tmp = np.ones((4, 5, 5))
427
    tmp[0, :] = 296.
428
    tmp[1, :] = 292.
429
    tmp[2, :] = 290
430
    tmp[3, :] = 288.
431
    tmpk = tmp * units.kelvin
432
    isentlev = [296.] * units.kelvin
433
    isentprs = isentropic_interpolation(isentlev, lev, tmpk)
434
    trueprs = 1000. * units.hPa
435
    assert_almost_equal(isentprs[0], trueprs, 3)
436
437
438
def test_isentropic_pressure_p_increase():