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/7304#issuecomment-1334017475,https://api.github.com/repos/pydata/xarray/issues/7304,1334017475,IC_kwDOAMm_X85Pg33D,2448579,2022-12-01T16:18:16Z,2022-12-01T16:18:16Z,MEMBER,Thanks @weiji14 !,"{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 1, ""rocket"": 0, ""eyes"": 0}",,1458347938
https://github.com/pydata/xarray/pull/7304#issuecomment-1330782936,https://api.github.com/repos/pydata/xarray/issues/7304,1330782936,IC_kwDOAMm_X85PUiLY,23487320,2022-11-29T15:00:21Z,2022-11-29T15:09:15Z,CONTRIBUTOR,"> It loos reasonable to me. I'm not sure if the warning is needed or not - we don't expect anyone to see it, or if they do, necessarily do anything about it. It's not unusual for code interacting with a file-like object to move the file pointer.
Hmm, in that case, I'm leaning towards removing the warning. The file pointer is reset anyway after reading the magic byte number, and that hasn't caused any issues (as mentioned in https://github.com/pydata/xarray/issues/6813#issuecomment-1205503288), so it should be more or less safe. Let me push another commit. Edit: done at 929cb62977d630a00ace9747bc86066555b83d0d.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1458347938
https://github.com/pydata/xarray/pull/7304#issuecomment-1330736962,https://api.github.com/repos/pydata/xarray/issues/7304,1330736962,IC_kwDOAMm_X85PUW9C,6042212,2022-11-29T14:30:43Z,2022-11-29T14:30:43Z,CONTRIBUTOR,"It loos reasonable to me. I'm not sure if the warning is needed or not - we don't expect anyone to see it, or if they do, necessarily do anything about it. It's not unusual for code interacting with a file-like object to move the file pointer.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1458347938
https://github.com/pydata/xarray/pull/7304#issuecomment-1330064201,https://api.github.com/repos/pydata/xarray/issues/7304,1330064201,IC_kwDOAMm_X85PRytJ,2448579,2022-11-29T04:31:22Z,2022-11-29T04:31:22Z,MEMBER,@martindurant do you have time to take a look here please?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1458347938
https://github.com/pydata/xarray/pull/7304#issuecomment-1322461240,https://api.github.com/repos/pydata/xarray/issues/7304,1322461240,IC_kwDOAMm_X85O0yg4,23487320,2022-11-21T18:10:20Z,2022-11-21T18:13:07Z,CONTRIBUTOR,"Traceback from the 2 test failures at https://github.com/pydata/xarray/actions/runs/3516849430/jobs/5893926099#step:9:252
```python-traceback
=================================== FAILURES ===================================
____________________ TestH5NetCDFFileObject.test_open_twice ____________________
[gw2] linux -- Python 3.10.7 /home/runner/micromamba-root/envs/xarray-tests/bin/python
self =
def test_open_twice(self) -> None:
expected = create_test_data()
expected.attrs[""foo""] = ""bar""
> with pytest.raises(ValueError, match=r""read/write pointer not at the start""):
E Failed: DID NOT RAISE
/home/runner/work/xarray/xarray/xarray/tests/test_backends.py:3034: Failed
___________________ TestH5NetCDFFileObject.test_open_fileobj ___________________
[gw2] linux -- Python 3.10.7 /home/runner/micromamba-root/envs/xarray-tests/bin/python
self =
@requires_scipy
def test_open_fileobj(self) -> None:
# open in-memory datasets instead of local file paths
expected = create_test_data().drop_vars(""dim3"")
expected.attrs[""foo""] = ""bar""
with create_tmp_file() as tmp_file:
expected.to_netcdf(tmp_file, engine=""h5netcdf"")
with open(tmp_file, ""rb"") as f:
with open_dataset(f, engine=""h5netcdf"") as actual:
assert_identical(expected, actual)
f.seek(0)
with open_dataset(f) as actual:
assert_identical(expected, actual)
f.seek(0)
with BytesIO(f.read()) as bio:
with open_dataset(bio, engine=""h5netcdf"") as actual:
assert_identical(expected, actual)
f.seek(0)
with pytest.raises(TypeError, match=""not a valid NetCDF 3""):
open_dataset(f, engine=""scipy"")
# TODO: this additional open is required since scipy seems to close the file
# when it fails on the TypeError (though didn't when we used
# `raises_regex`?). Ref https://github.com/pydata/xarray/pull/5191
with open(tmp_file, ""rb"") as f:
f.seek(8)
with pytest.raises(
ValueError,
match=""match in any of xarray's currently installed IO"",
):
> with pytest.warns(
RuntimeWarning,
match=re.escape(""'h5netcdf' fails while guessing""),
):
E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted.
E Regex: 'h5netcdf'\ fails\ while\ guessing
E Emitted warnings: [ UserWarning('cannot guess the engine, file-like object read/write pointer not at the start of the file, so resetting file pointer to zero. If this does not work, please close and reopen, or use a context manager'),
E RuntimeWarning(""deallocating CachingFileManager(, <_io.BufferedReader name='/tmp/tmpoxdfl12i/temp-720.nc'>, mode='r', kwargs={'invalid_netcdf': None, 'decode_vlen_strings': True}, manager_id='b62ec6c8-b328-409c-bc5d-bbab265bea51'), but file is not already closed. This may indicate a bug."")]
/home/runner/work/xarray/xarray/xarray/tests/test_backends.py:3076: Failed
=========================== short test summary info ============================
FAILED xarray/tests/test_backends.py::TestH5NetCDFFileObject::test_open_twice - Failed: DID NOT RAISE
FAILED xarray/tests/test_backends.py::TestH5NetCDFFileObject::test_open_fileobj - Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted.
Regex: 'h5netcdf'\ fails\ while\ guessing
Emitted warnings: [ UserWarning('cannot guess the engine, file-like object read/write pointer not at the start of the file, so resetting file pointer to zero. If this does not work, please close and reopen, or use a context manager'),
RuntimeWarning(""deallocating CachingFileManager(, <_io.BufferedReader name='/tmp/tmpoxdfl12i/temp-720.nc'>, mode='r', kwargs={'invalid_netcdf': None, 'decode_vlen_strings': True}, manager_id='b62ec6c8-b328-409c-bc5d-bbab265bea51'), but file is not already closed. This may indicate a bug."")]
= 2 failed, 14608 passed, 1190 skipped, 203 xfailed, 73 xpassed, 54 warnings in 581.98s (0:09:41) =
```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1458347938