Skip to content
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

Bug in regrid.py #3

Open
binh-vu opened this issue Jun 23, 2020 · 0 comments
Open

Bug in regrid.py #3

binh-vu opened this issue Jun 23, 2020 · 0 comments

Comments

@binh-vu
Copy link

binh-vu commented Jun 23, 2020

The get_raster_bounds in topoflow36.utils.regrid returns incorrect bounds for some GeoTIFF files. The problem is in these lines:

ulx, xres, xskew, uly, yskew, yres  = ds.GetGeoTransform()
lrx = ulx + (ds.RasterXSize * xres)
lry = uly + (ds.RasterYSize * yres)

The function ds.GetGeoTransform from GDAL does not always return the upper left corner of the raster. Instead, it return an affine transformation from a corner of the raster, with delta x and delta y (i.e., xres and yres), and in the case of GLDAS tiff files, ds.GetGeoTransform returns the lower left corner instead of upper left corner. Hence the function get_raster_bounds returns incorrect boundary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant