|
@@ 246-254 (lines=9) @@
|
| 243 |
|
assert_array_almost_equal(y_layer, y_truth, 5) |
| 244 |
|
|
| 245 |
|
|
| 246 |
|
def test_get_layer_with_bottom(): |
| 247 |
|
"""Tests get_layer functionality with bottom specified.""" |
| 248 |
|
p = np.arange(1000, 10, -100) * units.hPa |
| 249 |
|
y = np.linspace(25, -50, len(p)) * units.degC |
| 250 |
|
p_layer, y_layer = get_layer(p, y, bottom=2 * units.km, depth=3 * units.km) |
| 251 |
|
p_truth = np.array([532.062440, 600.0, 700.0, 783.969948]) * units.hPa |
| 252 |
|
y_truth = np.array([-13.994796, -8.333333, 0, 6.997495]) * units.degC |
| 253 |
|
assert_array_almost_equal(p_layer, p_truth, 5) |
| 254 |
|
assert_array_almost_equal(y_layer, y_truth, 5) |
| 255 |
|
|
|
@@ 235-243 (lines=9) @@
|
| 232 |
|
assert_array_almost_equal(y_layer, y_truth, 5) |
| 233 |
|
|
| 234 |
|
|
| 235 |
|
def test_get_layer_no_interpolation(): |
| 236 |
|
"""Tests get_layer functionality with interpolation off.""" |
| 237 |
|
p = np.arange(1000, 10, -100) * units.hPa |
| 238 |
|
y = np.linspace(25, -50, len(p)) * units.degC |
| 239 |
|
p_layer, y_layer = get_layer(p, y, depth=150 * units.hPa, interpolate=False) |
| 240 |
|
p_truth = np.array([1000, 900]) * units.hPa |
| 241 |
|
y_truth = np.array([25.0, 16.666666]) * units.degC |
| 242 |
|
assert_array_almost_equal(p_layer, p_truth, 5) |
| 243 |
|
assert_array_almost_equal(y_layer, y_truth, 5) |
| 244 |
|
|
| 245 |
|
|
| 246 |
|
def test_get_layer_with_bottom(): |
|
@@ 224-232 (lines=9) @@
|
| 221 |
|
get_layer(p, y, depth=-100 * units.hPa, bottom=600 * units.hPa) |
| 222 |
|
|
| 223 |
|
|
| 224 |
|
def test_get_layer_defaults(): |
| 225 |
|
"""Tests get_layer default functionality.""" |
| 226 |
|
p = np.arange(1000, 10, -100) * units.hPa |
| 227 |
|
y = np.linspace(25, -50, len(p)) * units.degC |
| 228 |
|
p_layer, y_layer = get_layer(p, y, depth=150 * units.hPa) |
| 229 |
|
p_truth = np.array([850, 900, 1000]) * units.hPa |
| 230 |
|
y_truth = np.array([12.499999, 16.666666, 25.0]) * units.degC |
| 231 |
|
assert_array_almost_equal(p_layer, p_truth, 5) |
| 232 |
|
assert_array_almost_equal(y_layer, y_truth, 5) |
| 233 |
|
|
| 234 |
|
|
| 235 |
|
def test_get_layer_no_interpolation(): |