Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create
GeoSeries.contains_properly
method using point_in_polygon. (#…
…749) This PR closes the above named issues relating to creating a .contains method and, more importantly, resolving boundary case inconsistency with `point_in_polygon`. ~As it stands the colinearity test I've added to `is_point_in_polygon` doubles the runtime of brute-force `point_in_polygon` and has no visible effect on the runtime of `quadtree_point_in_polygon`.~ ~- Note I need to double check the above benchmark, having set this project down for the last few weeks.~ This depends on #750, please do not review the C++ code here until that PR is merged. Please do review the python code. ## Benchmark Benchmark results are in, looks like there's no measurable speed difference between 22.12 pre-boundary exclusion and our current implementation: ``` (rapids) rapids@compose:~/cuspatial/python/cuspatial/benchmarks$ pytest api/bench_api.py::bench_point_in_polygon ================================================== test session starts =================================================== platform linux -- Python 3.8.15, pytest-7.2.0, pluggy-1.0.0 benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000) rootdir: /home/tcomer/mnt/NVIDIA/rapids-docker/cuspatial/python/cuspatial/benchmarks, configfile: pytest.ini plugins: cov-4.0.0, benchmark-4.0.0, cases-3.6.13, xdist-3.0.2, anyio-3.6.2, hypothesis-6.58.1 collected 1 item api/bench_api.py . [100%] ---------------------------------------------- benchmark: 1 tests --------------------------------------------- Name (time in s) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations --------------------------------------------------------------------------------------------------------------- bench_point_in_polygon 1.9636 1.9749 1.9678 0.0043 1.9660 0.0045 1;0 0.5082 5 1 --------------------------------------------------------------------------------------------------------------- Legend: Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile. OPS: Operations Per Second, computed as 1 / Mean =================================================== 1 passed in 16.28s =================================================== (rapids) rapids@compose:~/cuspatial/python/cuspatial/benchmarks$ git status On branch feature/GeoSeries.contains ``` vs `branch-22.12` ``` (rapids) rapids@compose:~/cuspatial/python/cuspatial/benchmarks$ pytest api/bench_api.py::bench_point_in_polygon ================================== test session starts =================================== platform linux -- Python 3.8.15, pytest-7.2.0, pluggy-1.0.0 benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000) rootdir: /home/tcomer/mnt/NVIDIA/rapids-docker/cuspatial/python/cuspatial/benchmarks, configfile: pytest.ini plugins: cov-4.0.0, benchmark-4.0.0, cases-3.6.13, xdist-3.0.2, anyio-3.6.2, hypothesis-6.58.1 collected 1 item api/bench_api.py . [100%] ---------------------------------------------- benchmark: 1 tests --------------------------------------------- Name (time in s) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations --------------------------------------------------------------------------------------------------------------- bench_point_in_polygon 1.9516 1.9843 1.9730 0.0126 1.9760 0.0127 1;0 0.5068 5 1 --------------------------------------------------------------------------------------------------------------- Legend: Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile. OPS: Operations Per Second, computed as 1 / Mean =================================== 1 passed in 16.61s =================================== (rapids) rapids@compose:~/cuspatial/python/cuspatial/benchmarks$ git status On branch benchmark/branch-22.12 ``` ## Still adding: - [x] Detailed description of xfail result. - [x] Self-review existing `.contains` implementation in python. - [x] Update `.contains` docs when necessary. - [x] Benchmark again and document here. - [x] Move binops_with_quadtree.py to next branch. - [x] `.contains` Examples Authors: - H. Thomson Comer (https://github.com/thomcom) Approvers: - Michael Wang (https://github.com/isVoid) - Mark Harris (https://github.com/harrism) URL: #749
- Loading branch information