Skip to content

implement interp() #2104

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

Merged
merged 56 commits into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
91e6723
Start working
fujiisoup Apr 27, 2018
db89669
interp1d for numpy backed array.
fujiisoup May 3, 2018
921ecdc
interp1d for dask backed array.
fujiisoup May 3, 2018
6b198bd
Support scalar interpolation.
fujiisoup May 4, 2018
c4961b0
more docs
fujiisoup May 4, 2018
14404c9
flake8. Remove an unnecessary file.
fujiisoup May 4, 2018
78144e9
Remove non-unicode characters
fujiisoup May 4, 2018
7004f75
Merge branch 'master' into interp_at
fujiisoup May 5, 2018
b1360ee
refactoring...
fujiisoup May 7, 2018
642e6b3
flake8. whats new
fujiisoup May 7, 2018
3328128
Make tests skip if scipy is not installed
fujiisoup May 7, 2018
dfc347e
skipif -> skip
fujiisoup May 7, 2018
3284ad2
move skip into every function
fujiisoup May 7, 2018
c19e9dd
remove reuires_scipy
fujiisoup May 7, 2018
39a0005
refactoring exceptions.
fujiisoup May 7, 2018
6c77873
assert_equal -> assert_allclose
fujiisoup May 8, 2018
4ff8477
Remove unintended word.
fujiisoup May 8, 2018
0807652
More tests. More docs.
fujiisoup May 8, 2018
230aada
More docs.
fujiisoup May 8, 2018
0a4a196
Added a benchmark
fujiisoup May 8, 2018
359412a
doc. Remove *.png file.
fujiisoup May 9, 2018
281dc7f
add .load to benchmark with dask.
fujiisoup May 9, 2018
03ed045
add assume_sorted kwarg.
fujiisoup May 10, 2018
2530b24
Support dimension without coordinate
fujiisoup May 10, 2018
01243f1
flake8
fujiisoup May 10, 2018
b3c76d7
More docs. test for attrs.
fujiisoup May 10, 2018
7cfa56b
Merge branch 'master' into interp_at
fujiisoup May 11, 2018
82e04c5
Merge branch 'master' into interp_at
fujiisoup May 12, 2018
8c29a4b
Updates based on comments
fujiisoup May 17, 2018
d89a1bb
rename test
fujiisoup May 17, 2018
ed718d9
update docs
fujiisoup May 17, 2018
aec3bbc
Add transpose for python 2
fujiisoup May 17, 2018
0f17044
More strict ordering
fujiisoup May 17, 2018
d361508
Cleanup
fujiisoup May 19, 2018
05b4c8f
Update doc
fujiisoup May 19, 2018
d8ca99f
Add skipif in tests
fujiisoup May 20, 2018
7cf370f
Merge branch 'master' into interp_at
fujiisoup May 22, 2018
c0d796a
minor grammar/language edits in docs
shoyer May 25, 2018
7ab6eec
Merge branch 'master' into interp_at
fujiisoup May 29, 2018
f9a819a
Support dict arguments for interp.
fujiisoup May 29, 2018
21d4390
update based on comments
fujiisoup May 30, 2018
6b8f05e
Remove unused if-block
fujiisoup May 30, 2018
58b4c13
ValueError -> NotImpletedError. Doc improvement
fujiisoup May 30, 2018
63aa0b3
Using OrderedSet
fujiisoup May 31, 2018
92c4d27
Merge branch 'master' into interp_at
shoyer Jun 1, 2018
193bb88
Merge branch 'master' into interp_at
fujiisoup Jun 1, 2018
b671257
Drop object array after interpolation.
fujiisoup Jun 4, 2018
cf9351b
Merge remote-tracking branch 'origin/interp_at' into interp_at
fujiisoup Jun 4, 2018
f2dc499
Merge branch 'master' into interp_at
fujiisoup Jun 4, 2018
6e00999
flake8
fujiisoup Jun 4, 2018
91d92f6
Add keep_attrs keyword
fujiisoup Jun 6, 2018
86a3823
flake8 (reverted from commit 6e0099963a50dc622204a690a0058b4db527b8ef)
fujiisoup Jun 6, 2018
9512d13
flake8
fujiisoup Jun 7, 2018
4df36da
Remove keep_attrs keywords
fujiisoup Jun 7, 2018
ec8e709
Returns copy for not-interpolated variable.
fujiisoup Jun 7, 2018
60e2ca3
Fix docs
fujiisoup Jun 7, 2018
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
54 changes: 54 additions & 0 deletions asv_bench/benchmarks/interp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from __future__ import absolute_import, division, print_function

import numpy as np
import pandas as pd

import xarray as xr

from . import parameterized, randn, requires_dask

nx = 3000
long_nx = 30000000
ny = 2000
nt = 1000
window = 20

randn_xy = randn((nx, ny), frac_nan=0.1)
randn_xt = randn((nx, nt))
randn_t = randn((nt, ))
randn_long = randn((long_nx, ), frac_nan=0.1)


new_x_short = np.linspace(0.3 * nx, 0.7 * nx, 100)
new_x_long = np.linspace(0.3 * nx, 0.7 * nx, 1000)
new_y_long = np.linspace(0.1, 0.9, 1000)


class Interpolation(object):
def setup(self, *args, **kwargs):
self.ds = xr.Dataset(
{'var1': (('x', 'y'), randn_xy),
'var2': (('x', 't'), randn_xt),
'var3': (('t', ), randn_t)},
coords={'x': np.arange(nx),
'y': np.linspace(0, 1, ny),
't': pd.date_range('1970-01-01', periods=nt, freq='D'),
'x_coords': ('x', np.linspace(1.1, 2.1, nx))})

@parameterized(['method', 'is_short'],
(['linear', 'cubic'], [True, False]))
def time_interpolation(self, method, is_short):
new_x = new_x_short if is_short else new_x_long
self.ds.interp(x=new_x, method=method).load()

@parameterized(['method'],
(['linear', 'nearest']))
def time_interpolation_2d(self, method):
self.ds.interp(x=new_x_long, y=new_y_long, method=method).load()


class InterpolationDask(Interpolation):
def setup(self, *args, **kwargs):
requires_dask()
super(InterpolationDask, self).setup(**kwargs)
self.ds = self.ds.chunk({'t': 50})
Loading