home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1210268984

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/4285#issuecomment-1210268984 https://api.github.com/repos/pydata/xarray/issues/4285 1210268984 IC_kwDOAMm_X85IIz04 14371165 2022-08-10T07:24:55Z 2022-08-10T07:25:24Z MEMBER

If that point is negotiable, I could introduce an ak.shape_dtype(array) function that returns a shape and dtype if array has the right properties and raise an exception if it doesn't. That would be more normal: you're asking if it satisfies a specific constraint, and if so, to get some information about it. Then we would also be able to deal with the fact that

* some people are going to want the `shape` to specify the maximum of "var" dimensions (what you asked for): "virtually padding",

* some people are going to want the `shape` to specify the minimum of "var" dimensions because that tells you what upper bounds are legal to slice: "virtually truncating",

* and some people are going to want the string `"var"` or maybe `None` or maybe `np.nan` in place of "var" dimensions because no integer is correct. Then they would have to deal with the fact that this `shape` is not a tuple of integers.

Getting non-ints out of .shape is not uncommon already.

dask, which is one of our favorite duck arrays, uses np.nan to imply undefined shape (-> tuple(int | type(np.nan), ...)), which happens EVERY time a dask array is masked. I don't think it would be super strange to get -> tuple(int | type(np.nan) | Literal["var"], ...) out of awkwards shape.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  667864088
Powered by Datasette · Queries took 0.65ms · About: xarray-datasette