Operation to check if two polygons overlap is inefficient
メンテナーはふだん 1 日以内に返信
@adybbroe がすでに取り組んでいます。
2021年7月20日 から。
評価
この issue はまだ評価されていません。
説明
Code Sample, a minimal, complete, and verifiable piece of code
I did a profiling of the below code. The input was a list of trollsched.satpass.Pass satellite passes with only two passes overlapping each other over the areas of interest.
The _bool_opermethod of SphPolygon class was called three times, each taking almost 5 seconds. In tot al the code ran for 19 seconds.
# Your code here
def derive_combined_coverage(passes, area_def):
"""From a sequence of satellite overpasses derived the total coverage of an area."""
npasses = len(passes)
if npasses == 0:
print("No passes in time window!")
return 0
area_boundary = AreaDefBoundary(area_def, frequency=100)
area_boundary = area_boundary.contour_poly
list_of_polygons = []
for mypass in passes:
list_of_polygons.append(mypass.boundary.contour_poly)
non_overlaps = GetNonOverlapUnions(list_of_polygons)
non_overlaps.merge()
polygons = non_overlaps.get_polygons()
pass_ids = non_overlaps.get_ids()
coverage = 0
for polygon in polygons:
isect = polygon.intersection(area_boundary)
if isect:
coverage = coverage + isect.area()
area_cov = coverage / area_boundary.area()
print("Area coverage = {0}".format(area_cov))
Problem description
In the newly merged PR #347 new functionality is added in order to for instance support the problem of deriving the total coverage of several (possibly overlapping) satellite overpasses over an area of interest. However, when checking if two polygons overlap in the function check_if_two_polygons_overlap a union is performed, and when performing this union operation with the _bool_oper method of the SphPolygon class a lot of (in this case) unnecessary calculations finding the new polygon is carried out. This takes time when we only need to know if the two polygons intersects.
In addition to solving this it would be beneficial to refactor the SphPolygon class a bit, so that the methods are smaller and do preferably only one thing.
Expected Output
Actual Result, Traceback if applicable
Versions of Python, package at hand and relevant dependencies
- 主要言語
- Python
- スター
- 388
- フォーク
- 104
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pytroll/pyresample のほかの issue
-
Geometry `__eq__` and `__hash__` violate Python's hash/equality contract再び着手できるかも @pnuu が 58 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug Priority-Medium
pytroll/pyresample#745 · コメント 1 件 · 担当者 3 名 ·
メンテナーはふだん 1 日以内に返信
-
Improve resampler x/y coordinate metadata再び着手できるかも @djhoese が 77 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug
pytroll/pyresample#739 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
pytroll/pyresample#698 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
pytroll/pyresample#694 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
gradient_search comb effect再び着手できるかも @mraspaud が 397 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
pytroll/pyresample#682 · コメント 7 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
pytroll/pyresample の issue をすべて見る
似ている issue
-
bug ready-for-dev
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
OpenHands/extensions#897 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
tensorflow/datasets#11253 ·
メンテナーはふだん 1 日以内に返信
-
fix(core): a config section with all keys commented out crashes startup対応中かも @Aryanbhargava18 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
kubeflow/mcp-server#512 ·
メンテナーはふだん 1 日以内に返信
-
Stop trusting the compromised eMudhra CA certificates対応中かも @anth-volk が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
PolicyEngine/uk-triple-lock#54 ·
メンテナーはふだん 1 日以内に返信
-
DBFS append mode silently overwrites existing files対応中かも @IlyaKhalafi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
fsspec/filesystem_spec#2429 ·
メンテナーはふだん 1 日以内に返信