home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 526754376

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
526754376 MDU6SXNzdWU1MjY3NTQzNzY= 3558 optimizing xarray operations for lazy array equality test 2448579 closed 0     0 2019-11-21T18:01:51Z 2020-02-24T18:26:30Z 2020-02-24T18:26:30Z MEMBER      

TLDR: I think we want A.sel(x=A.x).equals(A) to pass lazily. It doesn't do so currently.

Currently if I do A.sel(x=A.x), this sticks in a getitem call in the dask graph which breaks our lazy array equality optimization. Here's an example

``` python

A = xr.DataArray(np.arange(100), dims="x", coords={"x": np.arange(100)}).chunk({"x": 1}) A.sel(x=A.x).variable.equals(A, equiv=xr.core.duck_array_ops.lazy_array_equiv) None ```

Questions:

  1. Where is the best place to do this? In sel or isel? Both? Sticking the following in sel makes the above check return True which is what we want: ``` python if self._indexes: equals = [] for index in indexers: equals.append(indexers[index].to_index().equals(self._indexes[index]))

        if all(equals):
            return self
    

    ```

    This doesn't handle slice objects though so that makes me think we'd want to add something similar to isel too. 2. What is the behaviour we want? A.sel(x=A.x).equals(A) or A.sel(x=A.x) is A? 3. Doing the latter will mean changing _to_temp_dataset and _from_temp_dataset which suggests the constraint A._from_temp_dataset(A._to_temp_dataset()) is A? But this seems too strong to me. Do we only want to lazily satisfy an equals constraint rather than an identical constraint? 4. It seems like we'll want to add such short-circuits in many places (I have not checked all of these): sortby, broadcast, align, reindex (transpose does this now).

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

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.582ms · About: xarray-datasette