-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* convert to accessors Use accessors instead of a Dataset subclass, should be more stable for future xarray versions
- Loading branch information
Showing
18 changed files
with
1,357 additions
and
1,418 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ xarray >= 0.20.0 | |
numba >= 0.53 | ||
numexpr | ||
filelock | ||
sphinx-autosummary-accessors |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import xarray as xr | ||
|
||
|
||
def register_dataset_method(func): | ||
def wrapper(dataset): | ||
def f(*args, **kwargs): | ||
return func(dataset, *args, **kwargs) | ||
|
||
return f | ||
|
||
wrapper.__doc__ = func.__doc__ | ||
return xr.register_dataset_accessor(func.__name__)(wrapper) | ||
|
||
|
||
def register_dataarray_method(func): | ||
def wrapper(dataarray): | ||
def f(*args, **kwargs): | ||
return func(dataarray, *args, **kwargs) | ||
|
||
return f | ||
|
||
wrapper.__doc__ = func.__doc__ | ||
return xr.register_dataarray_accessor(func.__name__)(wrapper) | ||
|
||
|
||
def register_dataarray_staticmethod(func): | ||
return xr.register_dataarray_accessor(func.__name__)(func) | ||
|
||
|
||
def register_dataset_staticmethod(func): | ||
return xr.register_dataset_accessor(func.__name__)(func) |
Oops, something went wrong.