-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use getitem_with_mask in reindex_variables (#1847)
* WIP: use getitem_with_mask in reindex_variables * Fix dtype promotion for where * Add whats new * Fix flake8 * Fix test_align_dtype and bool+str promotion * tests and docstring for dtypes.result_type * More dtype promotion fixes, including for concat
- Loading branch information
Showing
11 changed files
with
234 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ | |
"netcdf4": [""], | ||
"scipy": [""], | ||
"bottleneck": ["", null], | ||
"dask": ["", null], | ||
"dask": [""], | ||
}, | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
import numpy as np | ||
import xarray as xr | ||
|
||
from . import requires_dask | ||
|
||
|
||
class Reindex(object): | ||
def setup(self): | ||
data = np.random.RandomState(0).randn(1000, 100, 100) | ||
self.ds = xr.Dataset({'temperature': (('time', 'x', 'y'), data)}, | ||
coords={'time': np.arange(1000), | ||
'x': np.arange(100), | ||
'y': np.arange(100)}) | ||
|
||
def time_1d_coarse(self): | ||
self.ds.reindex(time=np.arange(0, 1000, 5)).load() | ||
|
||
def time_1d_fine_all_found(self): | ||
self.ds.reindex(time=np.arange(0, 1000, 0.5), method='nearest').load() | ||
|
||
def time_1d_fine_some_missing(self): | ||
self.ds.reindex(time=np.arange(0, 1000, 0.5), method='nearest', | ||
tolerance=0.1).load() | ||
|
||
def time_2d_coarse(self): | ||
self.ds.reindex(x=np.arange(0, 100, 2), y=np.arange(0, 100, 2)).load() | ||
|
||
def time_2d_fine_all_found(self): | ||
self.ds.reindex(x=np.arange(0, 100, 0.5), y=np.arange(0, 100, 0.5), | ||
method='nearest').load() | ||
|
||
def time_2d_fine_some_missing(self): | ||
self.ds.reindex(x=np.arange(0, 100, 0.5), y=np.arange(0, 100, 0.5), | ||
method='nearest', tolerance=0.1).load() | ||
|
||
|
||
class ReindexDask(Reindex): | ||
def setup(self): | ||
requires_dask() | ||
super(ReindexDask, self).setup() | ||
self.ds = self.ds.chunk({'time': 100}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.