-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Refactor (part of) dataset.py to use explicit indexes #2696
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
Conversation
xarray/core/dataset.py
Outdated
@@ -244,6 +250,10 @@ def _assert_empty(args, msg='%s'): | |||
raise ValueError(msg % args) | |||
|
|||
|
|||
def _none_or_copy(arg): | |||
return arg if arg is None else arg.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, but given that we define __copy__
on xarray objects, could this be copy.copy(arg)
, and be dispatched appropriately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually only used on builtin types like dict
or OrderedDict
. So indeed this is a safe (and superior) approach.
I'm going to merge this shortly, unless there are any objections. |
* master: typo in whats_new (pydata#2763) Update computation.py to use Python 3 function signatures (pydata#2756) add h5netcdf+dask tests (pydata#2737) Fix name loss when masking (pydata#2749) fix datetime_to_numeric and Variable._to_numeric (pydata#2668) Fix mypy errors (pydata#2753) enable internal plotting with cftime datetime (pydata#2665) remove references to cyordereddict (pydata#2750) BUG: Pass kwargs to the FileManager for pynio engine (pydata#2380) (pydata#2732) reintroduce pynio/rasterio/iris to py36 test env (pydata#2738) Fix CRS being WKT instead of PROJ.4 (pydata#2715) Refactor (part of) dataset.py to use explicit indexes (pydata#2696)
This is part of the larger project in #1603
None of this should change public APIs: we're simply making updating indexes explicit (via the
indexes
dict) rather than implicit (through variables).