-
Notifications
You must be signed in to change notification settings - Fork 37
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
floating-point issues when extract
ing the edge of a grid cell
#876
Comments
Ahh damn. Does it work if we don't convert to vectors? |
I tried just taking |
Yeah vectors are much faster. But I think there are other things in that method we need to keep, we can just remove the collector part |
Probably shiftlocus would also give issues - how badly do we need that? Otherwise we can keep it for polygons but not for points? |
Shiflocus is a no-op for points. But for intervals it would be a lot of work to handle rasterizing all variants |
Hmm...wouldn't you just need |
Not sure what you mean there... Rasterization uses y values to make edges, x values during scans. At some point you need to check when you cross them. It also uses them in bresenham. So there are multiple points you just have to get values out of twice precision ranges and put them in something faster to access. We could go and write all of that to handle all combinations. But then you need tests for them all. One day we can do exact arithmetic on them I guess... But it's very far from my top priority |
But this is only for lines and polygons, not for points, right? In practice this whole issue would only really comes up if the points you are extracting are somehow derived from |
I just checked what |
I guess the DimPoints are Start locus? That is likely the main problem. Very prone to switching which interval a point is in. Probably we do need a separate path for points. |
It is, but |
I mean Center won't have this problem because DimPoints values are not near interval edges. But yes, we need to go through and specialise on Start/Center/End everywhere and not convert. We also need to not add steps to make intervals, but always use the two adjacent lookup values and bounds. Then we need to tests it all. I don't see this being a super fun time for anyone, but does need to happen at some stage. |
In the example below, we extracting from a raster defined by its edges, and in half the cases we don't get the correct cell. In lots of cases we also get
missing
, sometimes when extracting from the middle of the Raster!I encountered this in a case where I
Rasters.sample
some points from one raster and thenextract
them from another with identical dimensions. Which probably isn't too crazy of a use case.I did a little bit of digging and what is going on here is that the Raster dimensions get converted from a range to a vector of values by
_prepare_for_burning
, and that allows for floating point issues to become a thing.The text was updated successfully, but these errors were encountered: