Completed
Pull Request — master (#487)
by
unknown
58s
created

test_precipitable_water()   A

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
c 1
b 0
f 1
dl 0
loc 7
rs 9.4285
1
# Copyright (c) 2008-2017 MetPy Developers.
2
# Distributed under the terms of the BSD 3-Clause License.
3
# SPDX-License-Identifier: BSD-3-Clause
4
"""Test the `indices` module."""
5
6
from datetime import datetime
7
8
from metpy.calc import precipitable_water
9
from metpy.io import get_upper_air_data
10
from metpy.io.upperair import UseSampleData
11
from metpy.testing import assert_array_equal
12
from metpy.units import units
13
14
15
def test_precipitable_water():
16
    """Test precipitable water with observed sounding."""
17
    with UseSampleData():
18
        data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
19
    pw = precipitable_water(data.variables['dewpoint'][:], data.variables['pressure'][:])
20
    truth = (0.8899441949243486 * units('inches')).to('millimeters')
21
    assert_array_equal(pw, truth)
22