-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add broadcast_like. #3086
Add broadcast_like. #3086
Conversation
In principle, it feels like it would be better to have both |
Codecov Report
@@ Coverage Diff @@
## master #3086 +/- ##
==========================================
- Coverage 95.99% 95.98% -0.02%
==========================================
Files 63 63
Lines 12792 12809 +17
==========================================
+ Hits 12280 12295 +15
- Misses 512 514 +2 |
data = _set_dims(array.variable) | ||
coords = OrderedDict(array.coords) | ||
coords.update(common_coords) | ||
return DataArray(data, coords, data.dims, name=array.name, |
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.
Could potentially use ._replace
, and then only supply the changed items (but not a big deal)
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.
Not sure what you mean
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.
i.e. return array._replace(data, coords)
So array
keeps its type if someone inherited from DataArray
and we're not coupled to specific DataArray properties if those ever change
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.
I agree, but let's save this for a later refactor.
I'm merging this now, so @DavidMertz can put his doc/test improvements on top of it. |
thanks @dcherian ! |
Sounds good. @DavidMertz's docs/tests are much better! |
* master: (68 commits) enable sphinx.ext.napoleon (pydata#3180) remove type annotations from autodoc method signatures (pydata#3179) Fix regression: IndexVariable.copy(deep=True) casts dtype=U to object (pydata#3095) Fix distributed.Client.compute applied to DataArray (pydata#3173) More annotations in Dataset (pydata#3112) Hotfix for case of combining identical non-monotonic coords (pydata#3151) changed url for rasterio network test (pydata#3162) to_zarr(append_dim='dim0') doesn't need mode='a' (pydata#3123) BUG: fix+test groupby on empty DataArray raises StopIteration (pydata#3156) Temporarily remove pynio from py36 CI build (pydata#3157) missing 'about' field (pydata#3146) Fix h5py version printing (pydata#3145) Remove the matplotlib=3.0 constraint from py36.yml (pydata#3143) disable codecov comments (pydata#3140) Merge broadcast_like docstrings, analyze implementation problem (pydata#3130) Update whats-new for pydata#3125 and pydata#2334 (pydata#3135) Fix tests on big-endian systems (pydata#3125) XFAIL tests failing on ARM (pydata#2334) Add broadcast_like. (pydata#3086) Better docs and errors about expand_dims() view (pydata#3114) ...
whats-new.rst
for all changes andapi.rst
for new API