-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Center the coordinates to pixels for rasterio backend #1468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
1a8c6f1
2bc35a8
55a2a27
8691766
aeeef43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,10 @@ def open_rasterio(filename, chunks=None, cache=None, lock=None): | |
|
|
||
| This should work with any file that rasterio can open (most often: | ||
| geoTIFF). The x and y coordinates are generated automatically from the | ||
| file's geoinformation. | ||
| file's geoinformation, shifted to the center of each pixel (see | ||
| `"PixelIsArea" Raster Space | ||
| <http://web.archive.org/web/20160326194152/http://remotesensing.org/geotiff/spec/geotiff2.5.html#2.5.2>`_ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for looking into this. Isn't there a better ref than on the web archive?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Happy to help @fmaussion . The web archive link is used by the GeoTIFF website (first link here: http://trac.osgeo.org/geotiff). A quick Google search didn't yield anything better. |
||
| for more information). | ||
|
|
||
| Parameters | ||
| ---------- | ||
|
|
@@ -132,8 +135,12 @@ def open_rasterio(filename, chunks=None, cache=None, lock=None): | |
| dx, dy = riods.res[0], -riods.res[1] | ||
| x0 = riods.bounds.right if dx < 0 else riods.bounds.left | ||
| y0 = riods.bounds.top if dy < 0 else riods.bounds.bottom | ||
| coords['y'] = np.linspace(start=y0, num=ny, stop=(y0 + (ny - 1) * dy)) | ||
| coords['x'] = np.linspace(start=x0, num=nx, stop=(x0 + (nx - 1) * dx)) | ||
| coords['y'] = np.linspace(start=y0 + dy/2, | ||
| num=ny, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: unnecessary linebreak
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was just to satisfy |
||
| stop=(y0 + (ny - 1) * dy) + dy/2) | ||
| coords['x'] = np.linspace(start=x0 + dx/2, | ||
| num=nx, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: unnecessary linebreak
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was just to satisfy |
||
| stop=(x0 + (nx - 1) * dx) + dx/2) | ||
|
|
||
| # Attributes | ||
| attrs = {} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should rather appear in "Bug fixes" I think