spencerahill / aospy

Python package for automated analysis and management of gridded climate data
Apache License 2.0
83 stars 12 forks source link

Need to fix warnings due to recent updates to dependencies #323

Closed spencerahill closed 5 years ago

spencerahill commented 5 years ago

Haven't had much time for aospy dev for a while now, and when I just ran the test suite on my local machine I got a slew of warnings and a few test failures (all of which relate to warnings).

I'm intending to get back into aospy dev in the coming months, as I'll be using it for a new science project pretty extensively, so I think fixing these will be a good way to shake the rust off.

Log of test failures:

==================================================================== test session starts =====================================================================
platform darwin -- Python 3.7.2, pytest-5.0.1, py-1.8.0, pluggy-0.12.0
rootdir: /Users/shill/Dropbox/py/aospy, inifile: setup.cfg
plugins: cov-2.6.1
collected 600 items

test_automate.py ....................................                                                                                                  [  6%]
test_calc_basic.py ................................................................................................................................... [ 27%]
.......................................                                                                                                                [ 34%]
test_data_loader.py .................................................................................................................................F [ 56%]
FFF...............................                                                                                                                     [ 61%]
test_region.py ...............                                                                                                                         [ 64%]
test_run.py ...                                                                                                                                        [ 64%]
test_tutorial.py .                                                                                                                                     [ 64%]
test_utils_io.py .                                                                                                                                     [ 65%]
test_utils_longitude.py ..............................................................................                                                 [ 78%]
test_utils_times.py .................................................................................................................................  [ 99%]
test_utils_vertcoord.py ...                                                                                                                            [100%]

========================================================================== FAILURES ==========================================================================
_________________________________________________________ test_load_variable_does_not_warn[datetime] _________________________________________________________

load_variable_data_loader = <aospy.data_loader.NestedDictDataLoader object at 0x123e98390>, start_date = datetime.datetime(5, 1, 1, 0, 0)
end_date = datetime.datetime(5, 12, 31, 0, 0)

    @pytest.mark.filterwarnings('ignore:CFTimeIndex.data is deprecated')
    @pytest.mark.parametrize(['start_date', 'end_date'],
                             _LOAD_VAR_DATE_RANGES.values(),
                             ids=list(_LOAD_VAR_DATE_RANGES.keys()))
    def test_load_variable_does_not_warn(load_variable_data_loader,
                                         start_date, end_date):
        with warnings.catch_warnings(record=True) as warnlog:
            load_variable_data_loader.load_variable(
                condensation_rain,
                start_date, end_date,
                intvl_in='monthly')
>       assert len(warnlog) == 0
E       assert 2 == 0
E        +  where 2 = len([<warnings.WarningMessage object at 0x11a87b390>, <warnings.WarningMessage object at 0x11a997780>])

test_data_loader.py:600: AssertionError
________________________________________________________ test_load_variable_does_not_warn[datetime64] ________________________________________________________

load_variable_data_loader = <aospy.data_loader.NestedDictDataLoader object at 0x136527b38>, start_date = numpy.datetime64('0005-01-01')
end_date = numpy.datetime64('0005-12-31')

    @pytest.mark.filterwarnings('ignore:CFTimeIndex.data is deprecated')
    @pytest.mark.parametrize(['start_date', 'end_date'],
                             _LOAD_VAR_DATE_RANGES.values(),
                             ids=list(_LOAD_VAR_DATE_RANGES.keys()))
    def test_load_variable_does_not_warn(load_variable_data_loader,
                                         start_date, end_date):
        with warnings.catch_warnings(record=True) as warnlog:
            load_variable_data_loader.load_variable(
                condensation_rain,
                start_date, end_date,
                intvl_in='monthly')
>       assert len(warnlog) == 0
E       assert 2 == 0
E        +  where 2 = len([<warnings.WarningMessage object at 0x123e98da0>, <warnings.WarningMessage object at 0x12f485a58>])

test_data_loader.py:600: AssertionError
__________________________________________________________ test_load_variable_does_not_warn[cftime] __________________________________________________________

load_variable_data_loader = <aospy.data_loader.NestedDictDataLoader object at 0x1310c5dd8>, start_date = cftime.DatetimeNoLeap(5, 1, 1, 0, 0, 0, 0, 5, 1)
end_date = cftime.DatetimeNoLeap(5, 12, 31, 0, 0, 0, 0, 5, 365)

    @pytest.mark.filterwarnings('ignore:CFTimeIndex.data is deprecated')
    @pytest.mark.parametrize(['start_date', 'end_date'],
                             _LOAD_VAR_DATE_RANGES.values(),
                             ids=list(_LOAD_VAR_DATE_RANGES.keys()))
    def test_load_variable_does_not_warn(load_variable_data_loader,
                                         start_date, end_date):
        with warnings.catch_warnings(record=True) as warnlog:
            load_variable_data_loader.load_variable(
                condensation_rain,
                start_date, end_date,
                intvl_in='monthly')
>       assert len(warnlog) == 0
E       assert 2 == 0
E        +  where 2 = len([<warnings.WarningMessage object at 0x12c551160>, <warnings.WarningMessage object at 0x11a8844e0>])

test_data_loader.py:600: AssertionError
___________________________________________________________ test_load_variable_does_not_warn[str] ____________________________________________________________

load_variable_data_loader = <aospy.data_loader.NestedDictDataLoader object at 0x12b270b70>, start_date = '0005', end_date = '0005'

    @pytest.mark.filterwarnings('ignore:CFTimeIndex.data is deprecated')
    @pytest.mark.parametrize(['start_date', 'end_date'],
                             _LOAD_VAR_DATE_RANGES.values(),
                             ids=list(_LOAD_VAR_DATE_RANGES.keys()))
    def test_load_variable_does_not_warn(load_variable_data_loader,
                                         start_date, end_date):
        with warnings.catch_warnings(record=True) as warnlog:
            load_variable_data_loader.load_variable(
                condensation_rain,
                start_date, end_date,
                intvl_in='monthly')
>       assert len(warnlog) == 0
E       assert 2 == 0
E        +  where 2 = len([<warnings.WarningMessage object at 0x125339860>, <warnings.WarningMessage object at 0x12b26b400>])

test_data_loader.py:600: AssertionError