home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 1705163672 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 2

  • mx-moth 3
  • kmuehlbauer 1

author_association 2

  • CONTRIBUTOR 3
  • MEMBER 1

issue 1

  • Use `numpy.can_cast` instead of casting and checking · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1543534474 https://github.com/pydata/xarray/pull/7834#issuecomment-1543534474 https://api.github.com/repos/pydata/xarray/issues/7834 IC_kwDOAMm_X85cAHeK mx-moth 132147 2023-05-11T08:07:58Z 2023-05-11T08:07:58Z CONTRIBUTOR

I thtew this pull request up before leaving the office so it would run all the tests. Turns out that np.can_cast is the wrong option here. It doesn't consider casting floats to integers safe even if all values are correctly representable. Another solution will have to be found.

I can investigate further on Monday, and combine this with the linked issues. Thanks for the extra context

-- Tim Heap @.***

On Thu, 11 May 2023, at 18:03, Kai Mühlbauer wrote:

@mx-moth https://github.com/mx-moth Yes, this casting should be fixed.

I'm adding a bit of context here, as this might need to be solved in combination with #7098 https://github.com/pydata/xarray/pull/7098 and #7827 https://github.com/pydata/xarray/pull/7827. #7098 https://github.com/pydata/xarray/pull/7098 removes undefined casting for decoding. In #7827 https://github.com/pydata/xarray/pull/7827 there are efforts to do this for encoding, too.

As cast_to_int_if_safe is called for encoding as well as decoding I'm not sure if all cases have been catched by these two PR.

One issue on decoding is that at least for datetime64 based times the calculated time_deltas are currently converted to float64 in the presence of NaT (although NaT can perfectly be expressed as int64). It would be great if you could try your PR on top of #7827 https://github.com/pydata/xarray/pull/7827 (which includes #7098 https://github.com/pydata/xarray/pull/7098) to see if that fixes the errors in this PR.

— Reply to this email directly, view it on GitHub https://github.com/pydata/xarray/pull/7834#issuecomment-1543526954, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAIM6WCCVWQRC7DY6YHKTXFSMMDANCNFSM6AAAAAAX5UZXZM. You are receiving this because you were mentioned.Message ID: @.***>

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Use `numpy.can_cast` instead of casting and checking 1705163672
1543526954 https://github.com/pydata/xarray/pull/7834#issuecomment-1543526954 https://api.github.com/repos/pydata/xarray/issues/7834 IC_kwDOAMm_X85cAFoq kmuehlbauer 5821660 2023-05-11T08:03:01Z 2023-05-11T08:03:01Z MEMBER

@mx-moth Yes, this casting should be fixed.

I'm adding a bit of context here, as this might need to be solved in combination with #7098 and #7827. #7098 removes undefined casting for decoding. In #7827 there are efforts to do this for encoding, too.

As cast_to_int_if_safe is called for encoding as well as decoding I'm not sure if all cases have been catched by these two PR.

One issue on decoding is that at least for datetime64 based times the calculated time_deltas are currently converted to float64 in the presence of NaT (although NaT can perfectly be expressed as int64). It would be great if you could try your PR on top of #7827 (which includes #7098) to see if that fixes the errors in this PR.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Use `numpy.can_cast` instead of casting and checking 1705163672
1543433057 https://github.com/pydata/xarray/pull/7834#issuecomment-1543433057 https://api.github.com/repos/pydata/xarray/issues/7834 IC_kwDOAMm_X85b_uth mx-moth 132147 2023-05-11T06:52:46Z 2023-05-11T06:52:46Z CONTRIBUTOR

Using latest xarray and numpy >= 1.24.0, the following code generates a warning. This function is called when saving datasets to disk using dataset.to_netcdf:

python import numpy as np from xarray.coding.times import cast_to_int_if_safe array = np.array([1., 2., np.nan]) cast_to_int_if_safe(array)

$HOME/projects/xarray/xarray/coding/times.py:619: RuntimeWarning: invalid value encountered in cast int_num = np.asarray(num, dtype=np.int64) array([ 1., 2., nan])

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Use `numpy.can_cast` instead of casting and checking 1705163672
1543417823 https://github.com/pydata/xarray/pull/7834#issuecomment-1543417823 https://api.github.com/repos/pydata/xarray/issues/7834 IC_kwDOAMm_X85b_q_f mx-moth 132147 2023-05-11T06:36:59Z 2023-05-11T06:36:59Z CONTRIBUTOR

Unsure if new tests need to be added, as the intention is that no behaviour changes except for the lack of warnings from numpy.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Use `numpy.can_cast` instead of casting and checking 1705163672

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 13.836ms · About: xarray-datasette