Code Duplication    Length = 13-13 lines in 5 locations

metpy/calc/tests/test_thermo.py 5 locations

@@ 488-500 (lines=13) @@
485
    assert_almost_equal(isentprs[1][1], truerh, 3)
486
487
488
def test_isentropic_pressure_tmp_out_interp():
489
    """Test calculation of isentropic pressure function, temperature output."""
490
    lev = [100000., 95000., 90000., 85000.] * units.Pa
491
    tmp = np.ones((4, 5, 5))
492
    tmp[0, :] = 296.
493
    tmp[1, :] = 292.
494
    tmp[2, :] = 290.
495
    tmp[3, :] = 288.
496
    tmpk = tmp * units.kelvin
497
    isentlev = [296., 297.] * units.kelvin
498
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, tmpk_out=True)
499
    truetmp = 291.4579 * units.kelvin
500
    assert_almost_equal(isentprs[1][1], truetmp, 3)
501
502
503
def test_isentropic_pressure_3d_error():
@@ 452-464 (lines=13) @@
449
    assert_almost_equal(isentprs[1], truerh, 3)
450
451
452
def test_isentropic_pressure_interp():
453
    """Test calculation of isentropic pressure function."""
454
    lev = [100000., 95000., 90000., 85000.] * units.Pa
455
    tmp = np.ones((4, 5, 5))
456
    tmp[0, :] = 296.
457
    tmp[1, :] = 292.
458
    tmp[2, :] = 290
459
    tmp[3, :] = 288.
460
    tmpk = tmp * units.kelvin
461
    isentlev = [296., 297] * units.kelvin
462
    isentprs = isentropic_interpolation(isentlev, lev, tmpk)
463
    trueprs = 936.18057 * units.hPa
464
    assert_almost_equal(isentprs[0][1], trueprs, 3)
465
466
467
def test_isentropic_pressure_adition_args_interp():
@@ 416-428 (lines=13) @@
413
    assert_almost_equal(isentprs[1], truerh, 3)
414
415
416
def test_isentropic_pressure_tmp_out():
417
    """Test calculation of isentropic pressure function, temperature output."""
418
    lev = [100000., 95000., 90000., 85000.] * units.Pa
419
    tmp = np.ones((4, 5, 5))
420
    tmp[0, :] = 296.
421
    tmp[1, :] = 292.
422
    tmp[2, :] = 290.
423
    tmp[3, :] = 288.
424
    tmpk = tmp * units.kelvin
425
    isentlev = [296.] * units.kelvin
426
    isentprs = isentropic_interpolation(isentlev, lev, tmpk, tmpk_out=True)
427
    truetmp = 296. * units.kelvin
428
    assert_almost_equal(isentprs[1], truetmp, 3)
429
430
431
def test_isentropic_pressure_p_increase_rh_out():
@@ 380-392 (lines=13) @@
377
    assert_almost_equal(isentprs[0], trueprs, 3)
378
379
380
def test_isentropic_pressure_p_increase():
381
    """Test calculation of isentropic pressure function, p increasing order."""
382
    lev = [85000, 90000., 95000., 100000.] * units.Pa
383
    tmp = np.ones((4, 5, 5))
384
    tmp[0, :] = 288.
385
    tmp[1, :] = 290.
386
    tmp[2, :] = 292.
387
    tmp[3, :] = 296.
388
    tmpk = tmp * units.kelvin
389
    isentlev = [296.] * units.kelvin
390
    isentprs = isentropic_interpolation(isentlev, lev, tmpk)
391
    trueprs = 1000. * units.hPa
392
    assert_almost_equal(isentprs[0], trueprs, 3)
393
394
395
def test_isentropic_pressure_adition_args():
@@ 365-377 (lines=13) @@
362
    assert_almost_equal(rh, 82.7145 * units.percent, 3)
363
364
365
def test_isentropic_pressure():
366
    """Test calculation of isentropic pressure function."""
367
    lev = [100000., 95000., 90000., 85000.] * units.Pa
368
    tmp = np.ones((4, 5, 5))
369
    tmp[0, :] = 296.
370
    tmp[1, :] = 292.
371
    tmp[2, :] = 290
372
    tmp[3, :] = 288.
373
    tmpk = tmp * units.kelvin
374
    isentlev = [296.] * units.kelvin
375
    isentprs = isentropic_interpolation(isentlev, lev, tmpk)
376
    trueprs = 1000. * units.hPa
377
    assert_almost_equal(isentprs[0], trueprs, 3)
378
379
380
def test_isentropic_pressure_p_increase():