Closed
Description
2020-01-07T19:19:39.0297443Z =================================== FAILURES ===================================
2020-01-07T19:19:39.0495451Z _________________ test_timedeltaindex_add_cftimeindex[365_day] _________________
2020-01-07T19:19:39.0496702Z
2020-01-07T19:19:39.0498391Z calendar = '365_day'
2020-01-07T19:19:39.0499052Z
2020-01-07T19:19:39.0500036Z @requires_cftime
2020-01-07T19:19:39.0500669Z @pytest.mark.parametrize("calendar", _CFTIME_CALENDARS)
2020-01-07T19:19:39.0501986Z def test_timedeltaindex_add_cftimeindex(calendar):
2020-01-07T19:19:39.0502556Z a = xr.cftime_range("2000", periods=5, calendar=calendar)
2020-01-07T19:19:39.0503384Z deltas = pd.TimedeltaIndex([timedelta(days=2) for _ in range(5)])
2020-01-07T19:19:39.0503635Z result = deltas + a
2020-01-07T19:19:39.0504330Z expected = a.shift(2, "D")
2020-01-07T19:19:39.0505283Z assert result.equals(expected)
2020-01-07T19:19:39.0506265Z > assert isinstance(result, CFTimeIndex)
2020-01-07T19:19:39.0507151Z E AssertionError: assert False
2020-01-07T19:19:39.0508329Z E + where False = isinstance(Index([2000-01-03 00:00:00, 2000-01-04 00:00:00, 2000-01-05 00:00:00,\n 2000-01-06 00:00:00, 2000-01-07 00:00:00],\n dtype='object'), CFTimeIndex)
2020-01-07T19:19:39.0509344Z
2020-01-07T19:19:39.0510351Z xarray/tests/test_cftimeindex.py:724: AssertionError
2020-01-07T19:19:39.0510935Z _________________ test_timedeltaindex_add_cftimeindex[360_day] _________________
2020-01-07T19:19:39.0511748Z
2020-01-07T19:19:39.0513201Z calendar = '360_day'
2020-01-07T19:19:39.0513958Z
2020-01-07T19:19:39.0514197Z @requires_cftime
2020-01-07T19:19:39.0515571Z @pytest.mark.parametrize("calendar", _CFTIME_CALENDARS)
2020-01-07T19:19:39.0517319Z def test_timedeltaindex_add_cftimeindex(calendar):
2020-01-07T19:19:39.0517575Z a = xr.cftime_range("2000", periods=5, calendar=calendar)
2020-01-07T19:19:39.0517798Z deltas = pd.TimedeltaIndex([timedelta(days=2) for _ in range(5)])
2020-01-07T19:19:39.0519155Z result = deltas + a
2020-01-07T19:19:39.0519385Z expected = a.shift(2, "D")
2020-01-07T19:19:39.0519619Z assert result.equals(expected)
2020-01-07T19:19:39.0520075Z > assert isinstance(result, CFTimeIndex)
2020-01-07T19:19:39.0520252Z E AssertionError: assert False
2020-01-07T19:19:39.0520850Z E + where False = isinstance(Index([2000-01-03 00:00:00, 2000-01-04 00:00:00, 2000-01-05 00:00:00,\n 2000-01-06 00:00:00, 2000-01-07 00:00:00],\n dtype='object'), CFTimeIndex)
2020-01-07T19:19:39.0521907Z
2020-01-07T19:19:39.0522818Z xarray/tests/test_cftimeindex.py:724: AssertionError
2020-01-07T19:19:39.0523212Z _________________ test_timedeltaindex_add_cftimeindex[julian] __________________
2020-01-07T19:19:39.0524673Z
2020-01-07T19:19:39.0525157Z calendar = 'julian'
2020-01-07T19:19:39.0525992Z
2020-01-07T19:19:39.0526232Z @requires_cftime
2020-01-07T19:19:39.0526834Z @pytest.mark.parametrize("calendar", _CFTIME_CALENDARS)
2020-01-07T19:19:39.0531142Z def test_timedeltaindex_add_cftimeindex(calendar):
2020-01-07T19:19:39.0531602Z a = xr.cftime_range("2000", periods=5, calendar=calendar)
2020-01-07T19:19:39.0531897Z deltas = pd.TimedeltaIndex([timedelta(days=2) for _ in range(5)])
2020-01-07T19:19:39.0532131Z result = deltas + a
2020-01-07T19:19:39.0532351Z expected = a.shift(2, "D")
2020-01-07T19:19:39.0532597Z assert result.equals(expected)
2020-01-07T19:19:39.0532824Z > assert isinstance(result, CFTimeIndex)
2020-01-07T19:19:39.0533279Z E AssertionError: assert False
2020-01-07T19:19:39.0534006Z E + where False = isinstance(Index([2000-01-03 00:00:00, 2000-01-04 00:00:00, 2000-01-05 00:00:00,\n 2000-01-06 00:00:00, 2000-01-07 00:00:00],\n dtype='object'), CFTimeIndex)
2020-01-07T19:19:39.0534981Z
2020-01-07T19:19:39.0535242Z xarray/tests/test_cftimeindex.py:724: AssertionError
2020-01-07T19:19:39.0536707Z ________________ test_timedeltaindex_add_cftimeindex[all_leap] _________________
2020-01-07T19:19:39.0537052Z
2020-01-07T19:19:39.0538274Z calendar = 'all_leap'
2020-01-07T19:19:39.0538679Z
2020-01-07T19:19:39.0538864Z @requires_cftime
2020-01-07T19:19:39.0539011Z @pytest.mark.parametrize("calendar", _CFTIME_CALENDARS)
2020-01-07T19:19:39.0539145Z def test_timedeltaindex_add_cftimeindex(calendar):
2020-01-07T19:19:39.0539272Z a = xr.cftime_range("2000", periods=5, calendar=calendar)
2020-01-07T19:19:39.0539413Z deltas = pd.TimedeltaIndex([timedelta(days=2) for _ in range(5)])
2020-01-07T19:19:39.0539531Z result = deltas + a
2020-01-07T19:19:39.0539644Z expected = a.shift(2, "D")
2020-01-07T19:19:39.0539783Z assert result.equals(expected)
2020-01-07T19:19:39.0539916Z > assert isinstance(result, CFTimeIndex)
2020-01-07T19:19:39.0540048Z E AssertionError: assert False
2020-01-07T19:19:39.0540781Z E + where False = isinstance(Index([2000-01-03 00:00:00, 2000-01-04 00:00:00, 2000-01-05 00:00:00,\n 2000-01-06 00:00:00, 2000-01-07 00:00:00],\n dtype='object'), CFTimeIndex)
2020-01-07T19:19:39.0540948Z
2020-01-07T19:19:39.0541089Z xarray/tests/test_cftimeindex.py:724: AssertionError
2020-01-07T19:19:39.0541346Z _________________ test_timedeltaindex_add_cftimeindex[366_day] _________________
2020-01-07T19:19:39.0541454Z
2020-01-07T19:19:39.0542123Z calendar = '366_day'
2020-01-07T19:19:39.0542355Z
2020-01-07T19:19:39.0542476Z @requires_cftime
2020-01-07T19:19:39.0542613Z @pytest.mark.parametrize("calendar", _CFTIME_CALENDARS)
2020-01-07T19:19:39.0542733Z def test_timedeltaindex_add_cftimeindex(calendar):
2020-01-07T19:19:39.0542852Z a = xr.cftime_range("2000", periods=5, calendar=calendar)
2020-01-07T19:19:39.0543006Z deltas = pd.TimedeltaIndex([timedelta(days=2) for _ in range(5)])
2020-01-07T19:19:39.0543123Z result = deltas + a
2020-01-07T19:19:39.0543239Z expected = a.shift(2, "D")
2020-01-07T19:19:39.0543372Z assert result.equals(expected)
2020-01-07T19:19:39.0543499Z > assert isinstance(result, CFTimeIndex)
2020-01-07T19:19:39.0543616Z E AssertionError: assert False
2020-01-07T19:19:39.0544641Z E + where False = isinstance(Index([2000-01-03 00:00:00, 2000-01-04 00:00:00, 2000-01-05 00:00:00,\n 2000-01-06 00:00:00, 2000-01-07 00:00:00],\n dtype='object'), CFTimeIndex)
2020-01-07T19:19:39.0545191Z
2020-01-07T19:19:39.0545399Z xarray/tests/test_cftimeindex.py:724: AssertionError
2020-01-07T19:19:39.0545554Z ________________ test_timedeltaindex_add_cftimeindex[gregorian] ________________
2020-01-07T19:19:39.0545679Z
2020-01-07T19:19:39.0546078Z calendar = 'gregorian'
2020-01-07T19:19:39.0546251Z
2020-01-07T19:19:39.0546622Z @requires_cftime
2020-01-07T19:19:39.0546774Z @pytest.mark.parametrize("calendar", _CFTIME_CALENDARS)
2020-01-07T19:19:39.0546940Z def test_timedeltaindex_add_cftimeindex(calendar):
2020-01-07T19:19:39.0547086Z a = xr.cftime_range("2000", periods=5, calendar=calendar)
2020-01-07T19:19:39.0547379Z deltas = pd.TimedeltaIndex([timedelta(days=2) for _ in range(5)])
2020-01-07T19:19:39.0547529Z result = deltas + a
2020-01-07T19:19:39.0547669Z expected = a.shift(2, "D")
2020-01-07T19:19:39.0547989Z assert result.equals(expected)
2020-01-07T19:19:39.0548101Z > assert isinstance(result, CFTimeIndex)
2020-01-07T19:19:39.0548210Z E AssertionError: assert False
2020-01-07T19:19:39.0548869Z E + where False = isinstance(Index([2000-01-03 00:00:00, 2000-01-04 00:00:00, 2000-01-05 00:00:00,\n 2000-01-06 00:00:00, 2000-01-07 00:00:00],\n dtype='object'), CFTimeIndex)
2020-01-07T19:19:39.0549023Z
2020-01-07T19:19:39.0549154Z xarray/tests/test_cftimeindex.py:724: AssertionError
2020-01-07T19:19:39.0549296Z ___________ test_timedeltaindex_add_cftimeindex[proleptic_gregorian] ___________
2020-01-07T19:19:39.0549400Z
2020-01-07T19:19:39.0549680Z calendar = 'proleptic_gregorian'
2020-01-07T19:19:39.0550189Z
2020-01-07T19:19:39.0550314Z @requires_cftime
2020-01-07T19:19:39.0550430Z @pytest.mark.parametrize("calendar", _CFTIME_CALENDARS)
2020-01-07T19:19:39.0550568Z def test_timedeltaindex_add_cftimeindex(calendar):
2020-01-07T19:19:39.0550686Z a = xr.cftime_range("2000", periods=5, calendar=calendar)
2020-01-07T19:19:39.0550806Z deltas = pd.TimedeltaIndex([timedelta(days=2) for _ in range(5)])
2020-01-07T19:19:39.0550946Z result = deltas + a
2020-01-07T19:19:39.0551062Z expected = a.shift(2, "D")
2020-01-07T19:19:39.0551198Z assert result.equals(expected)
2020-01-07T19:19:39.0551337Z > assert isinstance(result, CFTimeIndex)
2020-01-07T19:19:39.0551452Z E AssertionError: assert False
2020-01-07T19:19:39.0552276Z E + where False = isinstance(Index([2000-01-03 00:00:00, 2000-01-04 00:00:00, 2000-01-05 00:00:00,\n 2000-01-06 00:00:00, 2000-01-07 00:00:00],\n dtype='object'), CFTimeIndex)
2020-01-07T19:19:39.0552425Z
2020-01-07T19:19:39.0552548Z xarray/tests/test_cftimeindex.py:724: AssertionError
2020-01-07T19:19:39.0552973Z ____ test_cf_datetime_nan[num_dates1-days since 2000-01-01-expected_list1] _____
2020-01-07T19:19:39.0553281Z
2020-01-07T19:19:39.0553765Z num_dates = [nan, 0], units = 'days since 2000-01-01'
2020-01-07T19:19:39.0554887Z expected_list = ['NaT', '2000-01-01T00:00:00Z']
2020-01-07T19:19:39.0555104Z
2020-01-07T19:19:39.0555251Z @arm_xfail
2020-01-07T19:19:39.0555406Z @requires_cftime
2020-01-07T19:19:39.0555551Z @pytest.mark.parametrize(
2020-01-07T19:19:39.0555693Z ["num_dates", "units", "expected_list"],
2020-01-07T19:19:39.0555849Z [
2020-01-07T19:19:39.0556225Z ([np.nan], "days since 2000-01-01", ["NaT"]),
2020-01-07T19:19:39.0556674Z ([np.nan, 0], "days since 2000-01-01", ["NaT", "2000-01-01T00:00:00Z"]),
2020-01-07T19:19:39.0556881Z (
2020-01-07T19:19:39.0557026Z [np.nan, 0, 1],
2020-01-07T19:19:39.0557374Z "days since 2000-01-01",
2020-01-07T19:19:39.0558208Z ["NaT", "2000-01-01T00:00:00Z", "2000-01-02T00:00:00Z"],
2020-01-07T19:19:39.0558355Z ),
2020-01-07T19:19:39.0558466Z ],
2020-01-07T19:19:39.0558591Z )
2020-01-07T19:19:39.0559984Z def test_cf_datetime_nan(num_dates, units, expected_list):
2020-01-07T19:19:39.0560153Z with warnings.catch_warnings():
2020-01-07T19:19:39.0560559Z warnings.filterwarnings("ignore", "All-NaN")
2020-01-07T19:19:39.0560733Z actual = coding.times.decode_cf_datetime(num_dates, units)
2020-01-07T19:19:39.0561076Z # use pandas because numpy will deprecate timezone-aware conversions
2020-01-07T19:19:39.0561235Z expected = pd.to_datetime(expected_list)
2020-01-07T19:19:39.0561532Z > assert_array_equal(expected, actual)
2020-01-07T19:19:39.0561669Z E AssertionError:
2020-01-07T19:19:39.0561785Z E Arrays are not equal
2020-01-07T19:19:39.0561899Z E
2020-01-07T19:19:39.0562138Z E Mismatched elements: 2 / 2 (100%)
2020-01-07T19:19:39.0562505Z E x: array([NaT, Timestamp('2000-01-01 00:00:00+0000', tz='UTC')], dtype=object)
2020-01-07T19:19:39.0563375Z E y: array([ 'NaT', '2000-01-01T00:00:00.000000000'],
2020-01-07T19:19:39.0563710Z E dtype='datetime64[ns]')
2020-01-07T19:19:39.0564285Z
2020-01-07T19:19:39.0564914Z xarray/tests/test_coding_times.py:455: AssertionError
2020-01-07T19:19:39.0565686Z ____ test_cf_datetime_nan[num_dates2-days since 2000-01-01-expected_list2] _____
2020-01-07T19:19:39.0565858Z
2020-01-07T19:19:39.0566229Z num_dates = [nan, 0, 1], units = 'days since 2000-01-01'
2020-01-07T19:19:39.0566709Z expected_list = ['NaT', '2000-01-01T00:00:00Z', '2000-01-02T00:00:00Z']
2020-01-07T19:19:39.0566894Z
2020-01-07T19:19:39.0567039Z @arm_xfail
2020-01-07T19:19:39.0567178Z @requires_cftime
2020-01-07T19:19:39.0567320Z @pytest.mark.parametrize(
2020-01-07T19:19:39.0567486Z ["num_dates", "units", "expected_list"],
2020-01-07T19:19:39.0567660Z [
2020-01-07T19:19:39.0568035Z ([np.nan], "days since 2000-01-01", ["NaT"]),
2020-01-07T19:19:39.0568760Z ([np.nan, 0], "days since 2000-01-01", ["NaT", "2000-01-01T00:00:00Z"]),
2020-01-07T19:19:39.0569295Z (
2020-01-07T19:19:39.0569436Z [np.nan, 0, 1],
2020-01-07T19:19:39.0569737Z "days since 2000-01-01",
2020-01-07T19:19:39.0570253Z ["NaT", "2000-01-01T00:00:00Z", "2000-01-02T00:00:00Z"],
2020-01-07T19:19:39.0570426Z ),
2020-01-07T19:19:39.0570560Z ],
2020-01-07T19:19:39.0570962Z )
2020-01-07T19:19:39.0571083Z def test_cf_datetime_nan(num_dates, units, expected_list):
2020-01-07T19:19:39.0571247Z with warnings.catch_warnings():
2020-01-07T19:19:39.0571569Z warnings.filterwarnings("ignore", "All-NaN")
2020-01-07T19:19:39.0571732Z actual = coding.times.decode_cf_datetime(num_dates, units)
2020-01-07T19:19:39.0572075Z # use pandas because numpy will deprecate timezone-aware conversions
2020-01-07T19:19:39.0572306Z expected = pd.to_datetime(expected_list)
2020-01-07T19:19:39.0572449Z > assert_array_equal(expected, actual)
2020-01-07T19:19:39.0572573Z E AssertionError:
2020-01-07T19:19:39.0572694Z E Arrays are not equal
2020-01-07T19:19:39.0572812Z E
2020-01-07T19:19:39.0572933Z E Mismatched elements: 3 / 3 (100%)
2020-01-07T19:19:39.0573443Z E x: array([NaT, Timestamp('2000-01-01 00:00:00+0000', tz='UTC'),
2020-01-07T19:19:39.0573826Z E Timestamp('2000-01-02 00:00:00+0000', tz='UTC')], dtype=object)
2020-01-07T19:19:39.0575539Z E y: array([ 'NaT', '2000-01-01T00:00:00.000000000',
2020-01-07T19:19:39.0576050Z E '2000-01-02T00:00:00.000000000'], dtype='datetime64[ns]')
2020-01-07T19:19:39.0576213Z
2020-01-07T19:19:39.0576721Z xarray/tests/test_coding_times.py:455: AssertionError