Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interpolate_na: Add max_gap support. #3302

Merged
merged 35 commits into from
Nov 15, 2019
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ad6f35b
interpolate_na: Add maxgap support.
dcherian Sep 8, 2019
9275d89
Add docs.
dcherian Sep 12, 2019
47a7cf5
Add requires_bottleneck to test.
dcherian Sep 12, 2019
711b2a9
Review comments.
dcherian Sep 12, 2019
4cad630
maxgap → max_gap
dcherian Sep 13, 2019
02b93c9
Update xarray/core/dataarray.py
dcherian Sep 12, 2019
da6c5f3
Update xarray/core/dataset.py
dcherian Sep 12, 2019
e1880e3
update whats-new
dcherian Sep 13, 2019
6c7a869
update computation.rst
dcherian Sep 13, 2019
49854e9
Better support uniformly spaced coordinates. Split legnths, interp test
dcherian Sep 13, 2019
6a86692
Raise error for max_gap and irregularly spaced coordinates + test
dcherian Sep 13, 2019
6e7e2f5
rework.
dcherian Oct 1, 2019
b74dead
Use pandas checks for index duplication and monotonicity.
dcherian Oct 3, 2019
a139042
Progress + add datetime.
dcherian Oct 3, 2019
8b150a4
nicer error message
dcherian Oct 4, 2019
45d3c28
A few fstrings.
dcherian Oct 21, 2019
980f475
finish up timedelta max_gap.
dcherian Oct 21, 2019
312ea14
Merge remote-tracking branch 'upstream/master' into interp-na-maxgap
dcherian Oct 21, 2019
6e857f0
fix whats-new
dcherian Oct 21, 2019
6f54616
small fixes.
dcherian Oct 22, 2019
db0c5f3
fix dan's test.
dcherian Oct 22, 2019
1127c61
remove redundant test.
dcherian Oct 22, 2019
4e27c94
nicer error message.
dcherian Oct 23, 2019
179eff1
Add xfailed cftime tests
dcherian Oct 24, 2019
c12e1da
Merge remote-tracking branch 'upstream/master' into interp-na-maxgap
dcherian Oct 24, 2019
9de946f
better error checking and tests.
dcherian Oct 25, 2019
a411cc2
typing.
dcherian Oct 25, 2019
fde2c14
Merge remote-tracking branch 'upstream/master' into interp-na-maxgap
dcherian Oct 25, 2019
4bda699
update docstrings
dcherian Oct 25, 2019
4acdd3b
scipy intersphinx
dcherian Oct 25, 2019
cb3a3f1
Merge branch 'master' into interp-na-maxgap
dcherian Oct 25, 2019
ac7aeeb
Merge remote-tracking branch 'upstream/master' into interp-na-maxgap
dcherian Nov 2, 2019
d9410b1
fix tests
dcherian Nov 4, 2019
d844ba7
add bottleneck testing decorator.
dcherian Nov 4, 2019
2381a80
Merge branch 'master' into interp-na-maxgap
dcherian Nov 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
dcherian committed Nov 4, 2019
commit d9410b13acc048774f017f9779842999ab531473
6 changes: 3 additions & 3 deletions xarray/core/missing.py
Original file line number Diff line number Diff line change
@@ -291,14 +291,14 @@ def interp_na(

if isinstance(max_gap, str):
try:
max_gap = pd.to_timedelta(max_gap).to_numpy()
max_gap = pd.to_timedelta(max_gap)
except ValueError:
raise ValueError(
f"Could not convert {max_gap!r} to a pandas timedelta using pandas.to_timedelta"
f"Could not convert {max_gap!r} to timedelta64 using pandas.to_timedelta"
)

if isinstance(max_gap, pd.Timedelta):
max_gap = max_gap.to_numpy()
max_gap = np.timedelta64(max_gap.value, "ns")

max_gap = np.timedelta64(max_gap, "ns").astype(np.float64)

2 changes: 1 addition & 1 deletion xarray/tests/test_missing.py
Original file line number Diff line number Diff line change
@@ -496,7 +496,7 @@ def test_interpolate_na_max_gap_errors(da_time):
with raises_regex(TypeError, "Expected integer or floating point"):
da_time.interpolate_na("t", max_gap="1H", use_coordinate=False)

with raises_regex(ValueError, "Could not convert 'huh' to a "):
with raises_regex(ValueError, "Could not convert 'huh' to timedelta64"):
da_time.interpolate_na("t", max_gap="huh")