Last active
August 29, 2015 14:10
-
-
Save sixy6e/f9d28ecf57a5b0788737 to your computer and use it in GitHub Desktop.
reading an image subset and returning a geobox instead of separate geotransform and projection items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from GriddedGeoBox import GriddedGeoBox | |
from io import read_subset | |
import rasterio | |
fname = '/g/data/v10/eoancillarydata/Land_Sea_Rasters/WORLDzone56.tif' | |
ds = rasterio.open(fname) | |
gb = GriddedGeoBox.from_dataset(ds) | |
gb.origin | |
ds.get_transform() | |
q = read_subset(fname, gb.convert_coordinates((100,100)), gb.convert_coordinates((200,100)), gb.convert_coordinates((200,200)), gb.convert_coordinates((100,200))) | |
q[1] | |
q[-1].origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The geobox changes the UL origin which subsequently changes any pixel to map conversions.