home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1621385466

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1621385466 PR_kwDOAMm_X85L44E0 7619 don't use `issubdtype` to check for integer dtypes in `polyval` 99545557 closed 0     3 2023-03-13T12:24:57Z 2023-03-22T19:54:46Z 2023-03-22T19:54:45Z CONTRIBUTOR   0 pydata/xarray/pulls/7619

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 functionnp.issubdtype()returns false. Here, it wantedcoeffs[degree_dim]to be ofintdata type (windows defaultintdata type isint32) , but it was ofint64datatype, and as the documentation ofnp.issubdtype()` states here : "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.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7619/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 1 row from issues_id in issues_labels
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 239.561ms · About: xarray-datasette