home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 343770118

This data as json

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
Powered by Datasette · Queries took 0.479ms · About: xarray-datasette