home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 271000579 and user = 10050469 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 1

  • fmaussion · 5 ✖

issue 1

  • Incorrect y-coordinates for non-georeferenced data from open_rasterio · 5 ✖

author_association 1

  • MEMBER 5
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
343770118 https://github.com/pydata/xarray/issues/1686#issuecomment-343770118 https://api.github.com/repos/pydata/xarray/issues/1686 MDEyOklzc3VlQ29tbWVudDM0Mzc3MDExOA== fmaussion 10050469 2017-11-12T21:38:16Z 2017-11-12T21:38:16Z MEMBER

Testing against all files used in the rasterio test base yields following results:

```python import numpy as np import rasterio import xarray as xr from affine import Affine from glob import glob import os

Test all files from rasterio's test base

rdir = '/home/mowglie/Downloads/rasterio-master/tests/data/*.tif' ok = [] for path in glob(rdir): ds = xr.open_rasterio(path) rio = rasterio.open(path, mode='r')

# Get geo coords
T0 = rio.transform
T1 = T0 * Affine.translation(0.5, 0.5)
rc2xy = lambda r, c: (c, r) * T1

xy0r = rc2xy(0, 0)
xy0x = (ds['x'].values[0], ds['y'].values[0])
xy1r = rc2xy(rio.height-1, rio.width-1)
xy1x = (ds['x'].values[-1], ds['y'].values[-1])

t1 = np.allclose(xy0r, xy0x)
t2 = np.allclose(xy1r, xy1x)
if t1 and t2:
    print(os.path.basename(path) + ': OK')
else:
    print(os.path.basename(path) + ': NOT OK', xy0r, xy0x, xy1r, xy1x)

```

Out:

shade.tif: OK rgb_lzw.tif: OK rgb_deflate.tif: OK rgb4.tif: OK RGBA.byte.tif: OK world.rgb.tif: OK world.byte.tif: OK alpha.tif: OK rgb1.tif: OK RGB.byte.tif: OK float_nan.tif: NOT OK (50.0, 50.0) (50.0, 250.0) (250.0, 150.0) (250.0, 350.0) float.tif: NOT OK (50.0, 50.0) (50.0, 250.0) (250.0, 150.0) (250.0, 350.0) rgb3.tif: OK rgb2.tif: OK The two files which are not working also miss a proper crs and transform, but still we should be consistent with what rasterio is doing :-(

At least I think that the majority of "standard" files are working properly with our current code.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Incorrect y-coordinates for non-georeferenced data from open_rasterio 271000579
343765561 https://github.com/pydata/xarray/issues/1686#issuecomment-343765561 https://api.github.com/repos/pydata/xarray/issues/1686 MDEyOklzc3VlQ29tbWVudDM0Mzc2NTU2MQ== fmaussion 10050469 2017-11-12T20:35:27Z 2017-11-12T20:35:27Z MEMBER

It looks like we could use rasterio's Affine object for this: https://stackoverflow.com/questions/27861197/how-to-i-get-the-coordinates-of-a-cell-in-a-geotif

Will have a look at it

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Incorrect y-coordinates for non-georeferenced data from open_rasterio 271000579
343762924 https://github.com/pydata/xarray/issues/1686#issuecomment-343762924 https://api.github.com/repos/pydata/xarray/issues/1686 MDEyOklzc3VlQ29tbWVudDM0Mzc2MjkyNA== fmaussion 10050469 2017-11-12T20:00:21Z 2017-11-12T20:00:21Z MEMBER

I'm afraid I don't know rasterio well enough to be able to take a decision here. However the fact that rasterio throws a warning when using your code above is not a good sign, and I don't think we have to take action in xarray (yet).

I am however also not super happy with this bit of code here: https://github.com/pydata/xarray/blob/014b7898a65d9406a0e9af0ab7166702b6e977b3/xarray/backends/rasterio_.py#L136-L142

It works for all the cases I've encountered until now, but it feels like this logic should be available in rasterio already.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Incorrect y-coordinates for non-georeferenced data from open_rasterio 271000579
341747311 https://github.com/pydata/xarray/issues/1686#issuecomment-341747311 https://api.github.com/repos/pydata/xarray/issues/1686 MDEyOklzc3VlQ29tbWVudDM0MTc0NzMxMQ== fmaussion 10050469 2017-11-03T16:01:45Z 2017-11-03T16:01:45Z MEMBER

OK, I will investigate but this might have to wait for next week. Also, I'll do some more georeferencing tests offline (we can easily check with external tools if what we are doing is correct or not)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Incorrect y-coordinates for non-georeferenced data from open_rasterio 271000579
341744624 https://github.com/pydata/xarray/issues/1686#issuecomment-341744624 https://api.github.com/repos/pydata/xarray/issues/1686 MDEyOklzc3VlQ29tbWVudDM0MTc0NDYyNA== fmaussion 10050469 2017-11-03T15:53:05Z 2017-11-03T15:54:00Z MEMBER

I'm not quite sure if the xarray code is quite correct for georefenced data

We don't test for correct georeferencing in the xarray codebase but I did a bunch of tests locally and it seemed to work well (at least I don't expect such a logical flaw as data being completely upside down or shifted by 2). e.g. http://xarray.pydata.org/en/latest/auto_gallery/plot_rasterio.html#sphx-glr-auto-gallery-plot-rasterio-py

For your example something seems to go wrong though. What version of rasterio are you using?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Incorrect y-coordinates for non-georeferenced data from open_rasterio 271000579

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