home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 577832822

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/pull/3706#issuecomment-577832822 https://api.github.com/repos/pydata/xarray/issues/3706 577832822 MDEyOklzc3VlQ29tbWVudDU3NzgzMjgyMg== 14808389 2020-01-23T19:18:38Z 2020-01-23T19:18:38Z MEMBER

the easiest way to fix identical would be to pass a equiv function that forwards to duck_array_ops.array_equiv but also checks the units: ```python def units_equiv(a, b): if hasattr(a, "units") or hasattr(b, "units"): units_a = getattr(a, "units", None) units_b = getattr(b, "units", None)

registry = getattr(units_a, "_REGISTRY", None) or getattr(b, "_REGISTRY", None)

units_a = units_a or registry.dimensionless
units_b = units_b or registry.dimensionless

return units_a == units_b
else:
# no units at all
return True

def equiv_with_units(a, b): return duck_array_ops.array_equiv(a, b) and units_equiv(a, b) `` However, I'm out of ideas on how to automatically use that (I'd like to avoid having to calla.identical(b, equiv=equiv_with_units)`).


There is also rolling_window that strips the units due to calling numpy.lib.stride_tricks.as_strided, but I don't know how to fix that unless we rewrite _rolling_window or dispatch differently in rolling_window.

There seems to have been some work to add a function named numpy.rolling_window or numpy.sliding_window that could then be overridden by pint, but I think that effort has stalled?

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