Skip to content

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

Merged
merged 5 commits into from
Feb 6, 2019

Conversation

shoyer
Copy link
Member

@shoyer shoyer commented Jan 21, 2019

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).

@@ -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()
Copy link
Collaborator

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?

Copy link
Member Author

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.

@shoyer
Copy link
Member Author

shoyer commented Feb 5, 2019

I'm going to merge this shortly, unless there are any objections.

@shoyer shoyer merged commit e677b7a into pydata:master Feb 6, 2019
@shoyer shoyer deleted the dataset-explicit-indexes branch February 6, 2019 16:07
@jhamman jhamman mentioned this pull request Feb 7, 2019
3 tasks
dcherian pushed a commit to yohai/xarray that referenced this pull request Feb 14, 2019
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants