home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 378898407

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
378898407 MDU6SXNzdWUzNzg4OTg0MDc= 2550 Include filename or path in open_mfdataset 4806877 closed 0     19 2018-11-08T20:13:31Z 2018-12-30T01:00:36Z 2018-12-30T01:00:36Z CONTRIBUTOR      

When reading from multiple files, sometimes there is information encoded in the filename. For example in these grib files the time: ./ST4.2018092500.01h, ./ST4.2018092501.01h. It seems like a generally useful thing would be to allow the passing of a kwargs (such as path_as_coord or something) that would define a set of coords with one for the data from each file.

I think the code change would be small:

python if path_as_coord: ds = ds.assign_coords(path=file_name)

In use it would be like:

```python

xr.open_mfdataset(['./ST4.2018092500.01h', './ST4.2018092501.01h'], engine='pynio', concat_dim='path') <xarray.Dataset> Dimensions: (x: 881, y: 1121, time: 2) Coordinates: lat (x, y) float32 23.116999 ... 45.618984 lon (x, y) float32 -119.023 ... -59.954613 * path (path) <U20 './ST4.2018092500.01h' './ST4.2018092501.01h' Dimensions without coordinates: x, y Data variables: var_0 (time, x, y) float32 dask.array<shape=(2, 881, 1121), chunksize=(1, 881, 1121)> var_1 (time, x, y) float32 dask.array<shape=(2, 881, 1121), chunksize=(1, 881, 1121)> ```

For context I have implemented something similar in dask: https://github.com/dask/dask/pull/3908

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2550/reactions",
    "total_count": 3,
    "+1": 3,
    "-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
  • 19 rows from issue in issue_comments
Powered by Datasette · Queries took 316.074ms · About: xarray-datasette