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/issues/1686#issuecomment-343770118,https://api.github.com/repos/pydata/xarray/issues/1686,343770118,MDEyOklzc3VlQ29tbWVudDM0Mzc3MDExOA==,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}",,271000579
https://github.com/pydata/xarray/issues/1686#issuecomment-343765561,https://api.github.com/repos/pydata/xarray/issues/1686,343765561,MDEyOklzc3VlQ29tbWVudDM0Mzc2NTU2MQ==,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}",,271000579
https://github.com/pydata/xarray/issues/1686#issuecomment-343762924,https://api.github.com/repos/pydata/xarray/issues/1686,343762924,MDEyOklzc3VlQ29tbWVudDM0Mzc2MjkyNA==,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}",,271000579
https://github.com/pydata/xarray/issues/1686#issuecomment-341747311,https://api.github.com/repos/pydata/xarray/issues/1686,341747311,MDEyOklzc3VlQ29tbWVudDM0MTc0NzMxMQ==,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}",,271000579
https://github.com/pydata/xarray/issues/1686#issuecomment-341744624,https://api.github.com/repos/pydata/xarray/issues/1686,341744624,MDEyOklzc3VlQ29tbWVudDM0MTc0NDYyNA==,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}",,271000579