Code Duplication    Length = 9-9 lines in 3 locations

metpy/calc/tests/test_thermo.py 3 locations

@@ 385-393 (lines=9) @@
382
    assert_almost_equal(cin, -89.8073512 * units('joule / kilogram'), 6)
383
384
385
def test_cape_cin_no_lfc():
386
    """Tests that CAPE is zero with no LFC."""
387
    p = np.array([959., 779.2, 751.3, 724.3, 700., 269.]) * units.mbar
388
    temperature = np.array([22.2, 24.6, 22., 20.4, 18., -10.]) * units.celsius
389
    dewpoint = np.array([19., -11.2, -10.8, -10.4, -10., -53.2]) * units.celsius
390
    parcel_prof = parcel_profile(p, temperature[0], dewpoint[0]).to('degC')
391
    cape, cin = cape_cin(p, temperature, dewpoint, parcel_prof)
392
    assert_almost_equal(cape, 0.0 * units('joule / kilogram'), 6)
393
    assert_almost_equal(cin, 0.0 * units('joule / kilogram'), 6)
394
395
396
def test_find_append_zero_crossings():
@@ 374-382 (lines=9) @@
371
    assert_almost_equal(cape, 58.0368212 * units('joule / kilogram'), 6)
372
    assert_almost_equal(cin, -89.8073512 * units('joule / kilogram'), 6)
373
374
def test_cape_cin_no_el():
375
    """Tests that CAPE works with no EL."""
376
    p = np.array([959., 779.2, 751.3, 724.3]) * units.mbar
377
    temperature = np.array([22.2, 14.6, 12., 9.4]) * units.celsius
378
    dewpoint = np.array([19., -11.2, -10.8, -10.4]) * units.celsius
379
    parcel_prof = parcel_profile(p, temperature[0], dewpoint[0]).to('degC')
380
    cape, cin = cape_cin(p, temperature, dewpoint, parcel_prof)
381
    assert_almost_equal(cape, 0.08750805 * units('joule / kilogram'), 6)
382
    assert_almost_equal(cin, -89.8073512 * units('joule / kilogram'), 6)
383
384
385
def test_cape_cin_no_lfc():
@@ 364-372 (lines=9) @@
361
    assert_almost_equal(rh, 82.7145 * units.percent, 3)
362
363
364
def test_cape_cin():
365
    """Tests the basic CAPE and CIN calculation."""
366
    p = np.array([959., 779.2, 751.3, 724.3, 700., 269.]) * units.mbar
367
    temperature = np.array([22.2, 14.6, 12., 9.4, 7., -38.]) * units.celsius
368
    dewpoint = np.array([19., -11.2, -10.8, -10.4, -10., -53.2]) * units.celsius
369
    parcel_prof = parcel_profile(p, temperature[0], dewpoint[0]).to('degC')
370
    cape, cin = cape_cin(p, temperature, dewpoint, parcel_prof)
371
    assert_almost_equal(cape, 58.0368212 * units('joule / kilogram'), 6)
372
    assert_almost_equal(cin, -89.8073512 * units('joule / kilogram'), 6)
373
374
def test_cape_cin_no_el():
375
    """Tests that CAPE works with no EL."""