-
Notifications
You must be signed in to change notification settings - Fork 18
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
Round gridspec tilesize to fix floating point precision issue #180
base: develop
Are you sure you want to change the base?
Conversation
221fd8c
to
ea8d913
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #180 +/- ##
========================================
Coverage 95.44% 95.44%
========================================
Files 31 31
Lines 5534 5534
========================================
Hits 5282 5282
Misses 252 252 ☔ View full report in Codecov by Sentry. |
243f283
to
3005752
Compare
Why? |
Why the PR? See the test output without the fix. |
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.
The proposed solution is not a robust one. Issue it’s trying to solve is not explained in the pr and it feels like the real problem is some place else. Version updates are typically done as a separate commit in this repo
I agree. Not sure if there's a better approach, though.
I looked through the code and debugged pretty deep. This is where the problem is caused.
Ok, I'll explain it. Apologies...
Ok, I'll remove the version update. |
3005752
to
25e2f1f
Compare
Text updated to explain the reasoning @Kirill888. |
Unrelated build fixes should be a separate commit. We can NOT keep adding rounding in random places to support specific issues caused by use of EPSG 4326 |
Is there an actual problem, other than that the numbers look funny? |
Yeah, the gridspec drives the input and output grid for an analysis, so the coordinates of the geotiff that's being produced will be screwy too. |
But the fundamental issue is not the affine, it's the GridSpec, which is producing bad GeoBoxes with bad Affines. And the bad GridSpec is caused by the incorrect rounding on the tile size. It could be fixed after the fact, but that feels like hiding the underlying problem, to me.
Ok, fair. I can split that noise out. |
25e2f1f
to
ff8f323
Compare
Fixes an issue where small resolutions (i.e.,
0.003
) would lead to crazy coordinates in geoboxes for a gridspec, due to floating point issues.For example, if you create a gridspec like this, the transform has a rounding error with a very small number added at the end:
The issue is caused when calculating the tile size (the width and height of the tile, in units of the gridspec), which works like this:
The proposed fix is to round these numbers at
12
decimal places, which is enough to fix this problem and I hope doesn't cause issues in other areas. New test included an all other tests pass.