home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

3 rows where type = "issue" and user = 4414299 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 1

  • issue · 3 ✖

state 1

  • closed 3

repo 1

  • xarray 3
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
359446339 MDU6SXNzdWUzNTk0NDYzMzk= 2412 Inconsistent signature of `apply` maaleske 4414299 closed 0     0 2018-09-12T11:57:06Z 2018-12-24T17:50:20Z 2018-12-24T17:50:20Z CONTRIBUTOR      

Dataset.apply allows passing positional arguments to func as args=(), whereas DataArrayGroupBy.apply and DatasetGroupBy.apply do not. The documentation also incorrectly suggests that the reverse is true:

Dataset.apply: https://github.com/pydata/xarray/blob/4de8dbc3b1de461c0c9d3b002e55d60b46d2e6d2/xarray/core/dataset.py#L2832-L2840

DataArrayGroupBy.apply: https://github.com/pydata/xarray/blob/4de8dbc3b1de461c0c9d3b002e55d60b46d2e6d2/xarray/core/groupby.py#L473-L478

DatasetGroupBy.apply: https://github.com/pydata/xarray/blob/4de8dbc3b1de461c0c9d3b002e55d60b46d2e6d2/xarray/core/groupby.py#L580-L585

I feel that funcs passed to GroupBy objects are generally equally deserving of positional arguments, and I don't see a reason why this isn't the case.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2412/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
259057144 MDU6SXNzdWUyNTkwNTcxNDQ= 1582 Rasterio tags are not accessible through open_rasterio maaleske 4414299 closed 0     5 2017-09-20T06:48:18Z 2018-03-16T18:48:46Z 2017-12-12T14:38:53Z CONTRIBUTOR      

The problem

When opening an ENVI file directly using rasterio, (some) metadata from the header file is available through tags(): python import rasterio src = rasterio.open(file) src.tags() # dict of metadata for the whole array src.tags(1) # same for band 1 Opening the same file through open_rasterio, the metadata is not carried through to the returned DataArray, neither as attributes nor as coordinates (which is the use case I'm interested in, since the metadata usually contains corresponding wavelengths for the bands).

Solutions?

I don't know what kind of data tags() might contain in general. For my use case, parsing the tags for each band as coordinates is necessary at some point. It might be better generally if the tags are stored as an attribute and munged afterwards, but this is complicated by the fact that there's tags for the whole file as well as for separate bands.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1582/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
271000579 MDU6SXNzdWUyNzEwMDA1Nzk= 1686 Incorrect y-coordinates for non-georeferenced data from open_rasterio maaleske 4414299 closed 0     8 2017-11-03T14:39:21Z 2018-01-26T13:50:54Z 2018-01-26T13:50:54Z CONTRIBUTOR      

For a non-georeferenced dataset, open_rasterio() results in y-coordinates from the raster height to two times the height, instead of the expected 0 .. height range:

```python import numpy as np import rasterio from xarray import open_rasterio

tmp_file = 'no_transform.tif' nx, ny, nz = 4, 3, 3 data = np.arange(nxnynz, dtype=rasterio.float32).reshape(nz, ny, nx) with rasterio.open( tmp_file, 'w', driver='GTiff', height=ny, width=nx, count=nz, dtype=rasterio.float32) as s: s.write(data)

open_rasterio(tmp_file) ```

<xarray.DataArray (band: 3, y: 3, x: 4)>
array( ... )
Coordinates:
  * band     (band) int64 1 2 3
  * y        (y) float64 3.5 4.5 5.5
  * x        (x) float64 0.5 1.5 2.5 3.5
Attributes:
     res:        (1.0, -1.0)
     is_tiled:   0
     transform:  (0.0, 1.0, 0.0, 0.0, 0.0, 1.0)

Passing transform=from_origin(0,3,1,1) (from rasterio.transforms) to rasterio.open() in the above code seems to give the expected result with y running down from 2.5:

<xarray.DataArray (band: 3, y: 3, x: 4)>
array( ... )
Coordinates:
  * band     (band) int64 1 2 3
  * y        (y) float64 2.5 1.5 0.5
  * x        (x) float64 0.5 1.5 2.5 3.5
Attributes:
    res:        (1.0, 1.0)
    is_tiled:   0
    transform:  (0.0, 1.0, 0.0, 3.0, 0.0, -1.0)

I'm not sure whether there's something amiss in the xarray coordinate calculations or the rasterio default transform logic. Looking at the code, I feel like there's some mismatch between the rasterio res property logic and the xarray coordinate generation (namely, the sign of res[1]):

https://github.com/mapbox/rasterio/blob/fcd361c49cca9c4ad32a2ac1f5d66b967f4b6cd4/rasterio/_base.pyx#L611-L619

https://github.com/pydata/xarray/blob/f83361c76b6aa8cdba8923080bb6b98560cf3a96/xarray/backends/rasterio_.py#L131-L139

I'm not quite sure if the xarray code is quite correct for georefenced data, since it doesn't utilize the given coordinate transform. I don't' have files to test it with though.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1686/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 1436.153ms · About: xarray-datasette