pull_requests: 1273200948
This data as json
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1273200948 | PR_kwDOAMm_X85L44E0 | 7619 | closed | 0 | don't use `issubdtype` to check for integer dtypes in `polyval` | 99545557 | <!-- Feel free to remove check-list items aren't relevant to your change --> # Why While running the "make" command for building the documentation, I had the following error : (I am on Windows 11 and using Anaconda Prompt as my CLI) ``` WARNING: ources... [ 98%] user-guide/computation >>>------------------------------------------------------------------------- Exception in C:\Users\91942\xarray\doc\user-guide\computation.rst at block ending on line 466 Specify :okexcept: as an option in the ipython:: block to suppress this message --------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[83], line 1 ----> 1 xr.polyval(coord=x, coeffs=out.polyfit_coefficients) File ~\anaconda3\envs\xarray-docs\lib\site-packages\xarray\core\computation.py:1958, in polyval(coord, coeffs, degree_dim) 1954 raise ValueError( 1955 f"Dimension `{degree_dim}` should be a coordinate variable with labels." 1956 ) 1957 if not np.issubdtype(coeffs[degree_dim].dtype, int): -> 1958 raise ValueError( 1959 f"Dimension `{degree_dim}` should be of integer dtype. Received {coeffs[degree_dim].dtype} instead." 1960 ) 1961 max_deg = coeffs[degree_dim].max().item() 1962 coeffs = coeffs.reindex( 1963 {degree_dim: np.arange(max_deg + 1)}, fill_value=0, copy=False 1964 ) ValueError: Dimension `degree` should be of integer dtype. Received int64 instead. ``` In the file computation.py(present in xarray/core), the program raises an error if the function `np.issubdtype()` returns false. Here, it wanted `coeffs[degree_dim]` to be of `int` data type (windows default `int` data type is `int32`) , but it was of `int64` datatype, and as the documentation of `np.issubdtype()` states [here](https://numpy.org/doc/stable/reference/generated/numpy.issubdtype.html) : "Similar types of different sizes are not subdtypes of each other" so the function returned false and the program raised an error. To fix this error, I have changed the following : # What I replaced the `np.issubdtype` call with `obj.dtype.kind not in "i"` to check if `coeffs[degree_dim]` is a general signed integer data type. | 2023-03-13T12:24:57Z | 2023-03-22T19:54:46Z | 2023-03-22T19:54:45Z | 2023-03-22T19:54:45Z | 1e361ccb9123fe25acfd9e3364c911c1eec7d9db | 0 | dfad7a5d1483a83dfef1b73ee9c7296494e0b669 | ed09383bf8be56ad9dccd86a3ba7ffab8b2b11a0 | CONTRIBUTOR | { "enabled_by": { "login": "headtr1ck", "id": 43316012, "node_id": "MDQ6VXNlcjQzMzE2MDEy", "avatar_url": "https://avatars.githubusercontent.com/u/43316012?v=4", "gravatar_id": "", "url": "https://api.github.com/users/headtr1ck", "html_url": "https://github.com/headtr1ck", "followers_url": "https://api.github.com/users/headtr1ck/followers", "following_url": "https://api.github.com/users/headtr1ck/following{/other_user}", "gists_url": "https://api.github.com/users/headtr1ck/gists{/gist_id}", "starred_url": "https://api.github.com/users/headtr1ck/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/headtr1ck/subscriptions", "organizations_url": "https://api.github.com/users/headtr1ck/orgs", "repos_url": "https://api.github.com/users/headtr1ck/repos", "events_url": "https://api.github.com/users/headtr1ck/events{/privacy}", "received_events_url": "https://api.github.com/users/headtr1ck/received_events", "type": "User", "site_admin": false }, "merge_method": "squash", "commit_title": "Allow all integer dtypes in `polyval` (#7619)", "commit_message": "* Fixed unneeded ValueError\r\n\r\n* [pre-commit.ci] auto fixes from pre-commit.com hooks\r\n\r\nfor more information, see https://pre-commit.ci\r\n\r\n* Fixed unneeded ValueError\r\n\r\n* Revert \"Merge\"\r\n\r\nThis reverts commit 87a82a25e3bbd0d11b0a9ca5bd384918abdb8298, reversing\r\nchanges made to fb27a96537355aa7f56f30de186a13a06edc8cb2.\r\n\r\n* add to whats-new\r\n\r\n* add tests\r\n\r\n---------\r\n\r\nCo-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>\r\nCo-authored-by: dcherian <deepak@cherian.net>\r\nCo-authored-by: Tom Nicholas <thomas.nicholas@columbia.edu>\r\nCo-authored-by: Michael Niklas <mick.niklas@gmail.com>" } |
13221727 | https://github.com/pydata/xarray/pull/7619 |
Links from other tables
- 1 row from pull_requests_id in labels_pull_requests