home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

2 rows where user = 411196 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

type 2

  • issue 1
  • pull 1

state 1

  • closed 2

repo 1

  • xarray 2
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
1033225587 PR_kwDOAMm_X84tiDCA 5884 Handle single `PathLike` objects in `open_mfdataset()` pmav99 411196 closed 0     3 2021-10-22T06:27:44Z 2021-10-26T20:18:13Z 2021-10-26T14:49:25Z CONTRIBUTOR   0 pydata/xarray/pulls/5884
  • [x] Closes #5881
  • [x] Tests added
  • [x] Passes pre-commit run --all-files
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [ ] New functions/methods are listed in api.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5884/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1032233673 I_kwDOAMm_X849hqLJ 5881 `open_mfdataset` does not handle single `pathlib.Path` objects but handles single `str` just fine pmav99 411196 closed 0     2 2021-10-21T08:56:20Z 2021-10-26T14:49:25Z 2021-10-26T14:49:25Z CONTRIBUTOR      

What happened:

An exception was raised

What you expected to happen:

That a dataset object would be created.

Minimal Complete Verifiable Example:

```python from pathlib import Path

import xarray as xr

dataset = "xarray/tests/data/example_1.nc"

with xr.open_mfdataset(dataset) as actual: assert isinstance(actual, xr.Dataset)

with xr.open_mfdataset(Path(dataset)) as actual: assert isinstance(actual, xr.Dataset) # this fails with the following traceback Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/panos/Prog/git/xarray/xarray/backends/api.py", line 869, in open_mfdataset paths = [str(p) if isinstance(p, Path) else p for p in paths] TypeError: 'PosixPath' object is not iterable ```

Anything else we need to know?:

This seems to be fixing it, but I am not familiar with the codebase to know if this is the proper way to fix it

diff diff --git a/xarray/backends/api.py b/xarray/backends/api.py index 6d73946b..596ac249 100644 --- a/xarray/backends/api.py +++ b/xarray/backends/api.py @@ -838,6 +838,8 @@ def open_mfdataset( .. [1] http://xarray.pydata.org/en/stable/dask.html .. [2] http://xarray.pydata.org/en/stable/dask.html#chunking-and-performance """ + if isinstance(paths, Path): + paths = paths.as_posix() if isinstance(paths, str): if is_remote_uri(paths) and engine == "zarr": try:

Environment:

Output of <tt>xr.show_versions()</tt> ``` >>> xr.show_versions() INSTALLED VERSIONS ------------------ commit: 07de257c5884df49335496ee6347fb633a7c302c python: 3.9.7 (default, Aug 31 2021, 13:28:12) [GCC 11.1.0] python-bits: 64 OS: Linux OS-release: 5.14.12-arch1-1 machine: x86_64 processor: byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.0 libnetcdf: 4.7.4 xarray: 999 pandas: 1.3.4 numpy: 1.21.3 scipy: None netCDF4: 1.5.7 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.5.1 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2021.09.1 distributed: None matplotlib: None cartopy: None seaborn: None numbagg: None fsspec: 2021.10.1 cupy: None pint: None sparse: None setuptools: 57.4.0 pip: 21.3 conda: None pytest: 6.2.5 IPython: None sphinx: None ```
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5881/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 24.983ms · About: xarray-datasette