home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

10 rows where author_association = "CONTRIBUTOR" and user = 31376402 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

issue 5

  • Allows numpy.bool_ attrs when writing with h5netcdf engine 3
  • Display coords' units for slice plots 3
  • bug or unclear definition of combine_attrs with xr.merge() 2
  • Tests fail when installing h5netcdf without netcdf4 1
  • Added support for numpy.bool_ 1

user 1

  • caenrigen · 10 ✖

author_association 1

  • CONTRIBUTOR · 10 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
948958184 https://github.com/pydata/xarray/pull/5847#issuecomment-948958184 https://api.github.com/repos/pydata/xarray/issues/5847 IC_kwDOAMm_X844j_Po caenrigen 31376402 2021-10-21T19:59:18Z 2021-10-21T20:00:04Z CONTRIBUTOR

Hi @Illviljan @keewis,

I have added tests and marked them as xfail

Accoriding to pytest docs

A skip means that you expect your test to pass only if some conditions are met, otherwise pytest should skip running the test altogether. Common examples are skipping windows-only tests on non-windows platforms, or skipping tests that depend on an external resource which is not available at the moment (for example a database).

An xfail means that you expect a test to fail for some reason. A common example is a test for a feature not yet implemented, or a bug not yet fixed. When a test passes despite being expected to fail (marked with pytest.mark.xfail), it’s an xpass and will be reported in the test summary.

This case seems exactly what xfail is meant for. But feel free to change this.


Do the slice plots work with non-dimension coordinates? If so, we should maybe add a test with pint for that, too: units in non-dimension coordinates are not stripped.

It seems so, but it raises a pint warning despite the code producing the intended figure:

```python import xarray as xr import numpy as np import matplotlib.pyplot as plt import pytest pint = pytest.importorskip("pint") unit_registry = pint.UnitRegistry(force_ndarray=True)

coord_unit, coord_attrs = (unit_registry.m, {})

def test_units_in_slice_line_plot_labels_isel(): arr = xr.DataArray( name="var_a", data=np.array([[1, 2], [3, 4]]), coords=dict( a=("x", np.array([5, 6]) * coord_unit, coord_attrs), b=("y", np.array([7, 8])), ), dims=("x", "y"), ) arr.isel(x=0).plot(marker="o") assert plt.gca().get_title() == "a = 5 [meter]" return arr

test_units_in_slice_line_plot_labels_isel() ```


I would appreciate a lot if we keep the scope of this PR to what I have contributed so far, I am running out of bandwidth in the project I am involved and won't be able to add much more to this PR.

Kind regards, Victor

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Display coords' units for slice plots 1021396447
944278576 https://github.com/pydata/xarray/pull/5847#issuecomment-944278576 https://api.github.com/repos/pydata/xarray/issues/5847 IC_kwDOAMm_X844SIww caenrigen 31376402 2021-10-15T13:01:32Z 2021-10-15T13:02:24Z CONTRIBUTOR

Just checked and this cannot be tested for pint units, there is already a comment in there explaining this:

```python

TODO make coord a Quantity once unit-aware indexes supported"

``` Since the slice units come from a coordinate these units can't be pint units (at least not yet).

I added a new test for the units in the title of a slice line plot, also added the same comment about pint units.

Who should I ping for the PR approval?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Display coords' units for slice plots 1021396447
944208315 https://github.com/pydata/xarray/pull/5847#issuecomment-944208315 https://api.github.com/repos/pydata/xarray/issues/5847 IC_kwDOAMm_X844R3m7 caenrigen 31376402 2021-10-15T11:01:17Z 2021-10-15T11:01:17Z CONTRIBUTOR

This is great, thanks @caenrigen !

It just needs a couple of tests - ideally one for basic behaviour like you've shown in your example (which should probably live here), and another checking that it works with pint units like we added in #5561.

Hi @TomNicholas!

Thank you for the input and guidance, will work on adding the tests 🙂

Cheers

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Display coords' units for slice plots 1021396447
872210975 https://github.com/pydata/xarray/issues/5436#issuecomment-872210975 https://api.github.com/repos/pydata/xarray/issues/5436 MDEyOklzc3VlQ29tbWVudDg3MjIxMDk3NQ== caenrigen 31376402 2021-07-01T12:37:52Z 2021-07-01T12:37:52Z CONTRIBUTOR

@keewis thank you for the reply

To fix this, I would vote for not using promote_attrs=True in merge (low confidence vote, though, I'm sure there was a reason for that). We could also try to allow specifying separate strategies for main object and variables, but that looks somewhat complicated (and I'm still not sure what syntax we could use for that).

Does this mean that my workaround is not fully working as I would like it to? (I want it to basically do nothing to the attrs)

Is it possible at the moment to pass promote_attrs=False to xr.merge()?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bug or unclear definition of combine_attrs with xr.merge() 911513701
871681764 https://github.com/pydata/xarray/issues/5436#issuecomment-871681764 https://api.github.com/repos/pydata/xarray/issues/5436 MDEyOklzc3VlQ29tbWVudDg3MTY4MTc2NA== caenrigen 31376402 2021-06-30T19:49:24Z 2021-06-30T19:49:24Z CONTRIBUTOR

Hey guys! First of all thank you for the work on maintaining this package 😃

I am running into the same issue and it is partially blocking an open-source package (used in experimental quantum computing) from adopting the latest version of xarray.

For our typical dataset this happens:

python import xarray as xr import numpy as np x0 = xr.DataArray(data=np.ones(5), name="x0", attrs={ 'name': 'x', 'long_name': 'X position', 'units': 'm', 'batched': False}) y0 = xr.DataArray(data=np.ones(5), name="y0", attrs={ 'name': 'y', 'long_name': 'Y position', 'units': 'm', 'batched': True}) ds = xr.merge([x0, y0]) print(ds)

bash <xarray.Dataset> Dimensions: (dim_0: 5) Dimensions without coordinates: dim_0 Data variables: x0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0 y0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0 Attributes: name: x long_name: X position units: m batched: False

As default behavior this is totally unexpected because the variables attributes have nothing to do with the dataset itself. I am just trying to put all my data in a single container. (Am i using the wrong function for this?)

And second, combine_attrs has no option for "do nothing" which was the behavior in xarray 0.17.0. I noticed the current master brach allows passing a function but not sure if that solves the problem. The "drop" option indeed acts in very weird way, I tried it in the hope that it will drop attrs on the resulting dataset instead of affecting the attributes of the variables.

My suggestion is to do nothing by default, i.e. combine_attrs = None, simply does not try to combine the attribute in any way.

I understand there might be cases where combining the attributes makes sense, so maybe my suggestion only applies when only DataArrays objects are merged into a Dataset (If i recall correctly the "what's new" list, this will be already enforced in 0.18.3).

Hope my use case helps this discussion.


In the meantime the workaround seems to be: combine_attrs = "override" (because it will not (?) affect the attributes of the variables) + and wipe attrs afterwards with dataset.attrs = dict():

python import xarray as xr import numpy as np x0 = xr.DataArray(data=np.ones(5), name="x0", attrs={ 'name': 'x', 'long_name': 'X position', 'units': 'm', 'batched': False}) y0 = xr.DataArray(data=np.ones(5), name="y0", attrs={ 'name': 'y', 'long_name': 'Y position', 'units': 'm', 'batched': True}) ds = xr.merge([x0, y0]) ds.attrs = dict() print(ds) print("===") print(ds.x0)

```bash

<xarray.Dataset> Dimensions: (dim_0: 5) Dimensions without coordinates: dim_0 Data variables: x0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0 y0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0 === <xarray.DataArray 'x0' (dim_0: 5)> array([1., 1., 1., 1., 1.]) Dimensions without coordinates: dim_0 Attributes: name: x long_name: X position units: m batched: False ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bug or unclear definition of combine_attrs with xr.merge() 911513701
806479491 https://github.com/pydata/xarray/issues/4985#issuecomment-806479491 https://api.github.com/repos/pydata/xarray/issues/4985 MDEyOklzc3VlQ29tbWVudDgwNjQ3OTQ5MQ== caenrigen 31376402 2021-03-25T08:58:17Z 2021-03-25T08:58:17Z CONTRIBUTOR

@caenrigen thanks for the issue. Would you be up for fixing this with a PR?

Unfortunately out of bandwidth currently, this came out when addressing #4981 so I reported it as suggested.

For anyone facing the issue, installing netcdf4 solves the issue as a temporary fix

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Tests fail when installing h5netcdf without netcdf4 819937730
791375996 https://github.com/pydata/xarray/issues/4981#issuecomment-791375996 https://api.github.com/repos/pydata/xarray/issues/4981 MDEyOklzc3VlQ29tbWVudDc5MTM3NTk5Ng== caenrigen 31376402 2021-03-05T12:01:35Z 2021-03-05T12:01:35Z CONTRIBUTOR

Hey, guys!!

Does any of you have backends expertise? A review of PR #4986 from someone with knowledge on the topic would be appreciated so much 🥺 One collaborator already approves the hotfix but is waiting for an additional approval

Kind regards

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Allows numpy.bool_ attrs when writing with h5netcdf engine 819379617
788872922 https://github.com/pydata/xarray/issues/4981#issuecomment-788872922 https://api.github.com/repos/pydata/xarray/issues/4981 MDEyOklzc3VlQ29tbWVudDc4ODg3MjkyMg== caenrigen 31376402 2021-03-02T12:27:33Z 2021-03-05T12:00:23Z CONTRIBUTOR

Very cool to hear you're using xarray in your quantum computing framework!

This sounds like a reasonable change to me. A PR would indeed be very welcome!

PR created https://github.com/pydata/xarray/pull/4986

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Allows numpy.bool_ attrs when writing with h5netcdf engine 819379617
789263557 https://github.com/pydata/xarray/pull/4986#issuecomment-789263557 https://api.github.com/repos/pydata/xarray/issues/4986 MDEyOklzc3VlQ29tbWVudDc4OTI2MzU1Nw== caenrigen 31376402 2021-03-02T22:23:27Z 2021-03-02T22:23:27Z CONTRIBUTOR

@keewis thank you for the guidance! changes applied ✅ Looking forward to the merge 🤩

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Added support for numpy.bool_ 819967505
788846940 https://github.com/pydata/xarray/issues/4981#issuecomment-788846940 https://api.github.com/repos/pydata/xarray/issues/4981 MDEyOklzc3VlQ29tbWVudDc4ODg0Njk0MA== caenrigen 31376402 2021-03-02T11:42:43Z 2021-03-02T11:42:43Z CONTRIBUTOR

but the tests (without any changes to the code) fail on my local clone of the repo so it would be more difficult to go through a PR for this.

Can you post an issue about that with an error message?

You can always make your change, and open a PR, and have the CI check it :) . PRs are very welcome!

Done https://github.com/pydata/xarray/issues/4985

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Allows numpy.bool_ attrs when writing with h5netcdf engine 819379617

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 18.025ms · About: xarray-datasette