id,node_id,number,state,locked,title,user,body,created_at,updated_at,closed_at,merged_at,merge_commit_sha,assignee,milestone,draft,head,base,author_association,auto_merge,repo,url,merged_by 300576778,MDExOlB1bGxSZXF1ZXN0MzAwNTc2Nzc4,3159,closed,0,Initialize empty or full DataArray,23618263," I attempted to implement what has been asked for in #277 as an effort to contribute to this project. This PR adds the ability to initialize a DataArray with a constant value, including `np.nan`. Also, if `data = None` then it is initialized as `np.empty` to take advantage of its speed for big arrays. ```python >> foo = xr.DataArray(None, coords=[range(3), range(4)]) >> foo array([[4.673257e-310, 0.000000e+000, 0.000000e+000, 0.000000e+000], [0.000000e+000, 0.000000e+000, 0.000000e+000, 0.000000e+000], [0.000000e+000, 0.000000e+000, 0.000000e+000, 0.000000e+000]]) Coordinates: * dim_0 (dim_0) int64 0 1 2 * dim_1 (dim_1) int64 0 1 2 3 ``` - [x] Closes #878, #277 - [x] Tests added - [x] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API Regarding the tests, I am not sure how to test the creation of an empty DataArray with `data=None` since the values changes between calls of `np.empty`. This is the reason I only added the test for the constant value.",2019-07-24T06:21:50Z,2019-08-27T16:28:04Z,2019-08-26T20:36:36Z,2019-08-26T20:36:36Z,3c020e58d3bf40101b0f4968f155e4eaa9d70e62,,,0,2c0c634b2cc9f935745499c0bced6642afa21814,e3b3bed2c2e27eb74adc2b7f80c365c2928cd78b,CONTRIBUTOR,,13221727,https://github.com/pydata/xarray/pull/3159, 311663986,MDExOlB1bGxSZXF1ZXN0MzExNjYzOTg2,3271,closed,0,Raise proper error for scalar array when coords is a dict,23618263," As explained here https://github.com/pydata/xarray/pull/3159#discussion_r316230281 , when a user uses a scalar array to build a `DataArray` with `coords` given as a dictionary the error is not self explanatory. ```python >>> xr.DataArray(np.array(1), coords={'x': np.arange(4), 'y': 'a'}, dims=['x']) ... KeyError: 'x' ``` This PR makes sure that when `data` is a scalar array and `dims` is not empty, it sets the shape to `(0,)` to make it fail with the proper raise message ```python >>> xr.DataArray(np.array(1), coords={'x': np.arange(4), 'y': 'a'}, dims=['x']) ... ValueError: conflicting sizes for dimension 'x': length 0 on the data but length 4 on coordinate 'x' ``` - [x] Test updated - [x] Passes `black . && mypy . && flake8` - [ ] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API (is this needed for a change like this?) ",2019-08-28T04:29:02Z,2019-08-29T17:23:20Z,2019-08-29T17:09:00Z,2019-08-29T17:09:00Z,f8647183c49c806896a2c94d12c5df56cb7f389e,,,0,f42f73f23812a2498cca2b618d1fe5323ff60e96,8969b5a974723dc13ce93db1e878f791764f539e,CONTRIBUTOR,,13221727,https://github.com/pydata/xarray/pull/3271, 313757220,MDExOlB1bGxSZXF1ZXN0MzEzNzU3MjIw,3278,closed,0,"Add head, tail and thin methods",23618263," I feel like there's room for improvement in the docstrings, any change or suggestion is welcome! - [x] Closes #319 - [x] Tests added - [x] Passes `black . && mypy . && flake8` - [x] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API ",2019-09-03T20:41:42Z,2019-09-05T05:49:36Z,2019-09-05T04:22:24Z,2019-09-05T04:22:24Z,5c6aebccf4eeedbe9de186836a0913f00ea157db,,,0,db841dac2723b431698a17851069d3c29122b730,683aaf66bb84d380f2f8c37b4e2c49a17e7148b9,CONTRIBUTOR,,13221727,https://github.com/pydata/xarray/pull/3278, 315714263,MDExOlB1bGxSZXF1ZXN0MzE1NzE0MjYz,3298,closed,0,"Accept int value in head, thin and tail",23618263," Related #3278 This PR makes the methods `head`, `thin` and `tail` for both `DataArray` and `Dataset` accept a single integer value as a parameter. If no parameter is given, then it defaults to 5. - [x] Tests added - [x] Passes `black . && mypy . && flake8` ",2019-09-09T21:00:41Z,2019-09-15T07:05:58Z,2019-09-14T21:46:16Z,2019-09-14T21:46:16Z,7fb3b19d47e81afc5f7ff8506f1daeb3906b0fae,,,0,4fec603705653e070a2f00661f22f638c14711cd,69c7e01e5167a3137c285cb50d1978252bb8bcbf,CONTRIBUTOR,,13221727,https://github.com/pydata/xarray/pull/3298, 317656713,MDExOlB1bGxSZXF1ZXN0MzE3NjU2NzEz,3309,closed,0,Fix DataArray api doc,23618263," Seems like I forgot to point `head`, `tail` and `thin` to the right direction in the `DataArray` api documentation",2019-09-15T17:36:46Z,2019-09-15T21:22:30Z,2019-09-15T20:27:31Z,2019-09-15T20:27:31Z,1ce91051e3751a65dbbbc7c5ff3e1a2f00ea6ee5,,,0,f7df873071aecbda271677573f50a2de44c7a8c1,7fb3b19d47e81afc5f7ff8506f1daeb3906b0fae,CONTRIBUTOR,,13221727,https://github.com/pydata/xarray/pull/3309, 352553493,MDExOlB1bGxSZXF1ZXN0MzUyNTUzNDkz,3615,closed,0,Minor docstring fixes,23618263,"Really minor docstring fixes, just added 's' at the end of `kwarg` and deleted ` Default n = 5` from `thin` method's docstring since it doesn't have a default value.",2019-12-12T18:33:27Z,2019-12-12T19:13:41Z,2019-12-12T18:48:50Z,2019-12-12T18:48:50Z,23d76b44cb879337f2e6c33c3f32bdd12f0efbe9,,,0,b76e550336ef48461a0418e46354d96a466071d9,2ee89c36a7ed512a221d38e09e7637429ced22d3,CONTRIBUTOR,,13221727,https://github.com/pydata/xarray/pull/3615, 477613549,MDExOlB1bGxSZXF1ZXN0NDc3NjEzNTQ5,4402,closed,0,Use a copy of dask_gufuc_kwargs,23618263," - [x] Closes #4399 - [ ] Tests added - [x] Passes `isort . && black . && mypy . && flake8` - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` Following the suggestion of @kmuehlbauer, I am using just a shallow copy since a deep one is not required.",2020-09-02T06:52:07Z,2020-09-04T15:57:19Z,2020-09-04T15:57:19Z,2020-09-04T15:57:19Z,3530ad14e2abd587b0f5e618d7c433fedbc2a33f,,,0,024a46152872ac19ffa3cf960d496d6e5acdb0d0,2acd0fc6563c3ad57f16e6ee804d592969419938,CONTRIBUTOR,,13221727,https://github.com/pydata/xarray/pull/4402,