-
Notifications
You must be signed in to change notification settings - Fork 115
Geographical polygon filter #78
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
base: develop
Are you sure you want to change the base?
Geographical polygon filter #78
Conversation
|
@SamuelTrahanNOAA great! thanks Samuel this is in public JCSDA and would need to be brought into internal, I can do this on your behalf. Also would make sense to add a ctest possibly, and just leverage another existing ctest. If it's brought in would it make sense that this is something to pass along to @guoqing-noaa (adding the ctest) |
|
It needs a ctest, but the ctests won't run on the machine I've been using for development. I'm moving to another machine that might be able to run the ctests. Once I can run ctests, I'll add one for this filter. |
Description
Filters observations that are outside of a polygon on the sphere. Supports convex and concave polygons, including dateline-crossing, pole-crossing, and polygons that span more than half the sphere. It has been tested with a full domain boundary containing about twelve thousand vertices, and with polygons as small as three vertices.
The implementation uses boost::geometry::within, in the cs::geographic coordinate system. Calculations are done in double precision with degrees.
Note that, like all template-heavy calculations, automatic inlining is critical for performance. With GCC, I saw a factor of 20 difference in performance of boost::geometry::within between inlining and non-inlining compilation. This won't matter for small polygons and a few observations, but it'll matter for a full domain boundary and many thousands of observations.
Example:
The inside point determines which side of the polygon is inside. Vertex longitudes and latitudes specify the polygon.
All points outside the polygon are flagged. Hence, in this example, all observations outside the polygon will be removed from the obs space.
The behavior at the exact polygon boundary will be inconsistent, so it is best to expand the polygon if you want the edges to be included.
Issue(s) addressed
No issues have been submitted; this development came about due to internal discussions.
Dependencies
None
Impact
None
Checklist