Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
WPSDataset: Wraps GDAL dataset and provides common wps operations #4010
WPSDataset: Wraps GDAL dataset and provides common wps operations #4010
Changes from 14 commits
cb34951
ce44646
dd0e474
9fde9d9
5b64343
b882601
c68db6d
d00fb4c
ac5e04e
0fd5c84
e8295dd
0c4e81a
c61c121
738c910
ad6cd85
9178451
2cd62a9
c982144
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Maybe @brettedw can chime in, but I think there are some subtleties we need to be cautious of here when setting the extent and xRes/yRes in WarpOptions.
If we're warping a raster with a geographic coordinate system (think coordinates are lat/lon in degrees) to a projected coordinate system (coordinates are in feet or meters as measured from an arbitrary point) and vice versa, we're going to run into problems I think.
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.
Interesting, this was pulled over from
wps/api/app/utils/geospatial.py
Line 43 in 6b15aa7
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.
Yeah, I didn't notice the issue with the original implementation. I caught it as I was generating those test files. I created the first test file in EPSG4326 which uses lat/lon coordinates and has x and y resolution measured in degrees. I basically used the
warp_to_match
code to then create the EPSG3857 test file but I kept getting errors about not having enough disk space. The problem was that I was taking the x/y res in degrees which was very small (0.003333333333067) and passing that in to gdal.Warp which then tries to create an output raster where the x/y resolution is 0.003333333333067 metres!Additionally, I ran into problems with the 4326 extent not making sense in the 3857 spatial reference.
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.
I'm going to do a quick test and see if specifying a source spatial reference works around the issue.
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.
Boo...specifying the
srcSRS
WarpOption
doesn't help.ERROR 3: 3005_lats.tif: Free disk space available is 478468026368 bytes, whereas 635088851384008 are at least necessary.
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.
Riiiiiight, ya that's an interesting one. Gonna have to think about a solution to that one. Maybe for now we can just implement some sort of check to see if both datasets are in geographic or projected. My brain can't do that right now but maybe we have something like this to use as a check (I don't know if this works, came from chatgippity):
Otherwise maybe we have to do some units conversion of meters to degrees? Need to think on that one
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.
Oh, I think I figured out one path forward, but we might want to dev chat next week. Right now when this warps, we don't specify the dimensions of the array. We can use
height
andwidth
parameters inWarpOptions
and set those toself.band.YSize
andself.band.XSize
. Also, we can keep theoutputBounds
and pass inoutputBoundsSRS
. Untested as of yet, but my brain is done.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.
My brain is working again (sort of). Specifying the number of pixels for height and width might not be a good idea afterall. I think it could lead to non-square pixels when re-projecting.