aei-link-clearance 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aei_link_clearance-0.1.0/LICENSE +204 -0
- aei_link_clearance-0.1.0/PKG-INFO +129 -0
- aei_link_clearance-0.1.0/README.md +104 -0
- aei_link_clearance-0.1.0/pyproject.toml +37 -0
- aei_link_clearance-0.1.0/setup.cfg +4 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance/__init__.py +34 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance/batch.py +181 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance/elevation.py +52 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance/explain.py +46 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance/fresnel.py +32 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance/geometry.py +60 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance/py.typed +0 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance/terrain.py +221 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance.egg-info/PKG-INFO +129 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance.egg-info/SOURCES.txt +23 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance.egg-info/dependency_links.txt +1 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance.egg-info/requires.txt +12 -0
- aei_link_clearance-0.1.0/src/aei_link_clearance.egg-info/top_level.txt +1 -0
- aei_link_clearance-0.1.0/tests/test_batch.py +43 -0
- aei_link_clearance-0.1.0/tests/test_explain.py +67 -0
- aei_link_clearance-0.1.0/tests/test_fresnel.py +32 -0
- aei_link_clearance-0.1.0/tests/test_geojson.py +67 -0
- aei_link_clearance-0.1.0/tests/test_geometry.py +34 -0
- aei_link_clearance-0.1.0/tests/test_near_threshold.py +36 -0
- aei_link_clearance-0.1.0/tests/test_terrain.py +29 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the
|
|
44
|
+
purposes of this License, Derivative Works shall not include works
|
|
45
|
+
that remain separable from, or merely link (or bind by name) to the
|
|
46
|
+
interfaces of, the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including the
|
|
49
|
+
original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright
|
|
52
|
+
owner or by an individual or Legal Entity authorized to submit on
|
|
53
|
+
behalf of the copyright owner. For the purposes of this definition,
|
|
54
|
+
"submitted" means any form of electronic, verbal, or written
|
|
55
|
+
communication sent to the Licensor or its representatives,
|
|
56
|
+
including but not limited to communication on electronic mailing
|
|
57
|
+
lists, source code control systems, and issue tracking systems that
|
|
58
|
+
are managed by, or on behalf of, the Licensor for the purpose of
|
|
59
|
+
discussing and improving the Work, but excluding communication that
|
|
60
|
+
is conspicuously marked or otherwise designated in writing by the
|
|
61
|
+
copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have
|
|
78
|
+
made, use, offer to sell, sell, import, and otherwise transfer the
|
|
79
|
+
Work, where such license applies only to those patent claims
|
|
80
|
+
licensable by such Contributor that are necessarily infringed by
|
|
81
|
+
their Contribution(s) alone or by combination of their
|
|
82
|
+
Contribution(s) with the Work to which such Contribution(s) was
|
|
83
|
+
submitted. If You institute patent litigation against any entity
|
|
84
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging
|
|
85
|
+
that the Work or a Contribution incorporated within the Work
|
|
86
|
+
constitutes direct or contributory patent infringement, then any
|
|
87
|
+
patent licenses granted to You under this License for that Work
|
|
88
|
+
shall terminate as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
96
|
+
Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing
|
|
142
|
+
the origin of the Work and reproducing the content of the NOTICE
|
|
143
|
+
file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or
|
|
150
|
+
conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS
|
|
151
|
+
FOR A PARTICULAR PURPOSE. You are solely responsible for
|
|
152
|
+
determining the appropriateness of using or redistributing the
|
|
153
|
+
Work and assume any risks associated with Your exercise of
|
|
154
|
+
permissions under this License.
|
|
155
|
+
|
|
156
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
157
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
158
|
+
unless required by applicable law (such as deliberate and grossly
|
|
159
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
160
|
+
liable to You for damages, including any direct, indirect, special,
|
|
161
|
+
incidental, or consequential damages of any character arising as a
|
|
162
|
+
result of this License or out of the use or inability to use the
|
|
163
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
164
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
165
|
+
other commercial damages or losses), even if such Contributor
|
|
166
|
+
has been advised of the possibility of such damages.
|
|
167
|
+
|
|
168
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
169
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
170
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
171
|
+
or other liability obligations and/or rights consistent with this
|
|
172
|
+
License. However, in accepting such obligations, You may act only
|
|
173
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
174
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
175
|
+
defend, and hold each Contributor harmless for any liability
|
|
176
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
177
|
+
of your accepting any such warranty or additional liability.
|
|
178
|
+
|
|
179
|
+
END OF TERMS AND CONDITIONS
|
|
180
|
+
|
|
181
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
182
|
+
|
|
183
|
+
To apply the Apache License to your work, attach the following
|
|
184
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
185
|
+
replaced with your own identifying information. (Don't include
|
|
186
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
187
|
+
comment syntax for the file format. We also recommend that a
|
|
188
|
+
file or class name and description of purpose be included on the
|
|
189
|
+
same "printed page" as the copyright notice for easier
|
|
190
|
+
identification within third-party archives.
|
|
191
|
+
|
|
192
|
+
Copyright 2026 AID Edge Inc.
|
|
193
|
+
|
|
194
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
195
|
+
you may not use this file except in compliance with the License.
|
|
196
|
+
You may obtain a copy of the License at
|
|
197
|
+
|
|
198
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
199
|
+
|
|
200
|
+
Unless required by applicable law or agreed to in writing, software
|
|
201
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
202
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
203
|
+
See the License for the specific language governing permissions and
|
|
204
|
+
limitations under the License.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aei-link-clearance
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Batch microwave link terrain clearance and margin-based risk ranking, built on aei-geo-features.
|
|
5
|
+
Author: AID Edge Inc.
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Keywords: microwave,point-to-point,fresnel-zone,terrain-clearance,link-budget
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Telecommunications Industry
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: aei-geo-features>=0.1.4
|
|
16
|
+
Provides-Extra: elevation
|
|
17
|
+
Requires-Dist: requests>=2.31; extra == "elevation"
|
|
18
|
+
Provides-Extra: batch
|
|
19
|
+
Requires-Dist: pandas>=1.5; extra == "batch"
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
22
|
+
Requires-Dist: requests>=2.31; extra == "dev"
|
|
23
|
+
Requires-Dist: pandas>=1.5; extra == "dev"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# aei-link-clearance
|
|
27
|
+
|
|
28
|
+
Batch microwave link terrain-clearance and margin-based risk ranking. Built
|
|
29
|
+
on top of [`aei-geo-features`](https://github.com/AIDEdgeInc-Lab/aei-geo-features)
|
|
30
|
+
(distance, coordinate validation) via a real package dependency, not a
|
|
31
|
+
copy -- this package adds only what aei-geo-features deliberately excludes:
|
|
32
|
+
bearing/azimuth, elevation-profile sampling, Fresnel-zone geometry, and
|
|
33
|
+
earth-curvature-adjusted terrain clearance.
|
|
34
|
+
|
|
35
|
+
## What this is not
|
|
36
|
+
|
|
37
|
+
- Not "is this link clear right now" -- single-link planning checklists
|
|
38
|
+
already exist (Pathloss, uptowhere.com). This batch-processes many
|
|
39
|
+
candidate links and ranks them by clearance margin, surfacing
|
|
40
|
+
low-margin links as elevated risk even when they're technically
|
|
41
|
+
"clear" under a binary pass/fail.
|
|
42
|
+
- Not a predictor. No time-series or change-detection data exists in this
|
|
43
|
+
version -- it does not forecast future obstruction.
|
|
44
|
+
- Not a claim of compliance with any named standard. Described here as
|
|
45
|
+
"based on standard microwave link engineering practice," with sources
|
|
46
|
+
below -- not "ITU-R P.530 compliant."
|
|
47
|
+
- Not a replacement for a site survey or professional link design.
|
|
48
|
+
|
|
49
|
+
## Methodology
|
|
50
|
+
|
|
51
|
+
**Fresnel zone radius** -- ITU-R P.526 diffraction theory, general form
|
|
52
|
+
`r_n = sqrt(n * lambda * d1 * d2 / (d1 + d2))`. This package uses the
|
|
53
|
+
practical engineering form (first zone, n=1, d in km, f in GHz, r in m):
|
|
54
|
+
|
|
55
|
+
r1 = 17.3 * sqrt(d1 * d2 / (f * (d1 + d2)))
|
|
56
|
+
|
|
57
|
+
Cross-checked at the path midpoint against the well-known
|
|
58
|
+
`8.656 * sqrt(D/f)` constant (matches exactly) and against a live,
|
|
59
|
+
independent implementation (uptowhere.com's calculator) -- see the
|
|
60
|
+
validation check below.
|
|
61
|
+
|
|
62
|
+
**k-factor** -- 4/3, the ITU-R P.530 median/standard-atmosphere value for
|
|
63
|
+
temperate climates, exposed as a parameter (`k_factor=` on
|
|
64
|
+
`analyze_link()`), not hardcoded. Earth bulge: `h = d1*d2 / (2*k*R)`,
|
|
65
|
+
R = 6371 km (the same Earth-radius constant `aei_geo_features` uses).
|
|
66
|
+
|
|
67
|
+
**Clearance criterion** -- >=60% of the first Fresnel zone clear is
|
|
68
|
+
standard microwave link engineering practice (converging, consistent
|
|
69
|
+
citations across RF engineering references), not an ITU-R-numbered
|
|
70
|
+
compliance figure -- described as such throughout this package. Bands used
|
|
71
|
+
throughout: **clear** >=60%, **marginal** 30-60%,
|
|
72
|
+
**obstructed** <30%. The 30% marginal/obstructed split is a
|
|
73
|
+
judgement call, not independently sourced -- see the comment at
|
|
74
|
+
`terrain.OBSTRUCTED_THRESHOLD`.
|
|
75
|
+
|
|
76
|
+
**Elevation data** -- Open-Meteo Elevation API, backed by Copernicus DEM
|
|
77
|
+
GLO-90 (90 m resolution, global, free, batched, no API key). **This is a
|
|
78
|
+
Digital Surface Model, not a bare-earth DEM** -- it may already reflect
|
|
79
|
+
tree canopy or rooftop height in some areas. Treat results accordingly, and
|
|
80
|
+
verify against a survey before relying on them.
|
|
81
|
+
|
|
82
|
+
**Open-Meteo's free tier (used here) is licensed for non-commercial use only
|
|
83
|
+
(data: CC-BY 4.0, attribution required). Any commercial use of this feature
|
|
84
|
+
requires you to obtain your own paid Open-Meteo subscription
|
|
85
|
+
(https://open-meteo.com/en/pricing) -- this package does not include or
|
|
86
|
+
imply one.**
|
|
87
|
+
|
|
88
|
+
## Validation check (against uptowhere.com/line-of-sight-calculator)
|
|
89
|
+
|
|
90
|
+
Three real Southern Ontario coordinate pairs, all at 5.8 GHz (the closest
|
|
91
|
+
frequency both tools support), k=4/3 in both:
|
|
92
|
+
|
|
93
|
+
| Case | Path | This package | uptowhere.com | Agreement |
|
|
94
|
+
|---|---|---|---|---|
|
|
95
|
+
| 1: clear, urban, short | CN Tower area, 1.22 km, 30 m/30 m towers | clear, ratio 6.78, F1(midpoint) 3.97 m | clear, 100% F1 clear, F1(midpoint) 4.0 m | **Exact match** on distance, F1 formula, and verdict |
|
|
96
|
+
| 2: obstructed, escarpment | Niagara Escarment crossing, 14.46 km, 15 m/15 m towers | obstructed, ground 62.2 m above sightline at 4.43 km, F1 12.6 m / required 7.55 m | blocked, ground 76 m above sightline at 4.35 km, F1 13 m / required 7.5 m | Same verdict, F1/required nearly identical; obstruction **magnitude** differs by ~14 m |
|
|
97
|
+
| 3: marginal (this pkg) / blocked (theirs) | Same escarpment path, 83 m/83 m towers | marginal, ratio 0.76, clearance +5.8 m (LOS geometrically clear) | blocked, ground 7.6 m above sightline | **Verdict disagreement** -- same ~13-14 m gap as case 2, same location |
|
|
98
|
+
|
|
99
|
+
**Diagnosis**: bearing, the Fresnel formula, and the earth-curvature
|
|
100
|
+
geometry are independently verified correct (case 1's exact formula match;
|
|
101
|
+
case 2's near-identical F1/required figures; both tools agree on bearing
|
|
102
|
+
and total distance). The remaining ~13-14 m gap in cases 2/3, consistent
|
|
103
|
+
in both magnitude and location, is attributable to **elevation data
|
|
104
|
+
source**, not a bug: this package uses Copernicus DEM GLO-90 (90 m),
|
|
105
|
+
uptowhere.com uses AWS Terrain Tiles (~30 m) -- two different DEM products
|
|
106
|
+
that commonly diverge by this much on steep, sharp local relief like an
|
|
107
|
+
escarpment edge. Ruled out sampling density as the cause directly: doubling
|
|
108
|
+
this package's sample count (50 -> 100 points) changed the result by
|
|
109
|
+
<1 m, not ~14 m, so the gap isn't an artifact of under-sampling either.
|
|
110
|
+
|
|
111
|
+
**Conclusion**: the core geometry/clearance calculation is trustworthy.
|
|
112
|
+
The elevation-data layer carries real, now-quantified uncertainty
|
|
113
|
+
(order of 10-15 m at steep terrain features) that a real RF engineer
|
|
114
|
+
should be aware of before this is used for anything beyond a demo --
|
|
115
|
+
exactly what the mandatory DSM disclaimer exists to communicate, not
|
|
116
|
+
boilerplate.
|
|
117
|
+
|
|
118
|
+
## Install
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
pip install aei-link-clearance # from PyPI (once published)
|
|
122
|
+
pip install -e . # core library, depends only on aei-geo-features
|
|
123
|
+
pip install -e ".[elevation]" # + requests, for the Open-Meteo client (see the Open-Meteo licensing notice above)
|
|
124
|
+
pip install -e ".[dev]" # + pytest
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# aei-link-clearance
|
|
2
|
+
|
|
3
|
+
Batch microwave link terrain-clearance and margin-based risk ranking. Built
|
|
4
|
+
on top of [`aei-geo-features`](https://github.com/AIDEdgeInc-Lab/aei-geo-features)
|
|
5
|
+
(distance, coordinate validation) via a real package dependency, not a
|
|
6
|
+
copy -- this package adds only what aei-geo-features deliberately excludes:
|
|
7
|
+
bearing/azimuth, elevation-profile sampling, Fresnel-zone geometry, and
|
|
8
|
+
earth-curvature-adjusted terrain clearance.
|
|
9
|
+
|
|
10
|
+
## What this is not
|
|
11
|
+
|
|
12
|
+
- Not "is this link clear right now" -- single-link planning checklists
|
|
13
|
+
already exist (Pathloss, uptowhere.com). This batch-processes many
|
|
14
|
+
candidate links and ranks them by clearance margin, surfacing
|
|
15
|
+
low-margin links as elevated risk even when they're technically
|
|
16
|
+
"clear" under a binary pass/fail.
|
|
17
|
+
- Not a predictor. No time-series or change-detection data exists in this
|
|
18
|
+
version -- it does not forecast future obstruction.
|
|
19
|
+
- Not a claim of compliance with any named standard. Described here as
|
|
20
|
+
"based on standard microwave link engineering practice," with sources
|
|
21
|
+
below -- not "ITU-R P.530 compliant."
|
|
22
|
+
- Not a replacement for a site survey or professional link design.
|
|
23
|
+
|
|
24
|
+
## Methodology
|
|
25
|
+
|
|
26
|
+
**Fresnel zone radius** -- ITU-R P.526 diffraction theory, general form
|
|
27
|
+
`r_n = sqrt(n * lambda * d1 * d2 / (d1 + d2))`. This package uses the
|
|
28
|
+
practical engineering form (first zone, n=1, d in km, f in GHz, r in m):
|
|
29
|
+
|
|
30
|
+
r1 = 17.3 * sqrt(d1 * d2 / (f * (d1 + d2)))
|
|
31
|
+
|
|
32
|
+
Cross-checked at the path midpoint against the well-known
|
|
33
|
+
`8.656 * sqrt(D/f)` constant (matches exactly) and against a live,
|
|
34
|
+
independent implementation (uptowhere.com's calculator) -- see the
|
|
35
|
+
validation check below.
|
|
36
|
+
|
|
37
|
+
**k-factor** -- 4/3, the ITU-R P.530 median/standard-atmosphere value for
|
|
38
|
+
temperate climates, exposed as a parameter (`k_factor=` on
|
|
39
|
+
`analyze_link()`), not hardcoded. Earth bulge: `h = d1*d2 / (2*k*R)`,
|
|
40
|
+
R = 6371 km (the same Earth-radius constant `aei_geo_features` uses).
|
|
41
|
+
|
|
42
|
+
**Clearance criterion** -- >=60% of the first Fresnel zone clear is
|
|
43
|
+
standard microwave link engineering practice (converging, consistent
|
|
44
|
+
citations across RF engineering references), not an ITU-R-numbered
|
|
45
|
+
compliance figure -- described as such throughout this package. Bands used
|
|
46
|
+
throughout: **clear** >=60%, **marginal** 30-60%,
|
|
47
|
+
**obstructed** <30%. The 30% marginal/obstructed split is a
|
|
48
|
+
judgement call, not independently sourced -- see the comment at
|
|
49
|
+
`terrain.OBSTRUCTED_THRESHOLD`.
|
|
50
|
+
|
|
51
|
+
**Elevation data** -- Open-Meteo Elevation API, backed by Copernicus DEM
|
|
52
|
+
GLO-90 (90 m resolution, global, free, batched, no API key). **This is a
|
|
53
|
+
Digital Surface Model, not a bare-earth DEM** -- it may already reflect
|
|
54
|
+
tree canopy or rooftop height in some areas. Treat results accordingly, and
|
|
55
|
+
verify against a survey before relying on them.
|
|
56
|
+
|
|
57
|
+
**Open-Meteo's free tier (used here) is licensed for non-commercial use only
|
|
58
|
+
(data: CC-BY 4.0, attribution required). Any commercial use of this feature
|
|
59
|
+
requires you to obtain your own paid Open-Meteo subscription
|
|
60
|
+
(https://open-meteo.com/en/pricing) -- this package does not include or
|
|
61
|
+
imply one.**
|
|
62
|
+
|
|
63
|
+
## Validation check (against uptowhere.com/line-of-sight-calculator)
|
|
64
|
+
|
|
65
|
+
Three real Southern Ontario coordinate pairs, all at 5.8 GHz (the closest
|
|
66
|
+
frequency both tools support), k=4/3 in both:
|
|
67
|
+
|
|
68
|
+
| Case | Path | This package | uptowhere.com | Agreement |
|
|
69
|
+
|---|---|---|---|---|
|
|
70
|
+
| 1: clear, urban, short | CN Tower area, 1.22 km, 30 m/30 m towers | clear, ratio 6.78, F1(midpoint) 3.97 m | clear, 100% F1 clear, F1(midpoint) 4.0 m | **Exact match** on distance, F1 formula, and verdict |
|
|
71
|
+
| 2: obstructed, escarpment | Niagara Escarment crossing, 14.46 km, 15 m/15 m towers | obstructed, ground 62.2 m above sightline at 4.43 km, F1 12.6 m / required 7.55 m | blocked, ground 76 m above sightline at 4.35 km, F1 13 m / required 7.5 m | Same verdict, F1/required nearly identical; obstruction **magnitude** differs by ~14 m |
|
|
72
|
+
| 3: marginal (this pkg) / blocked (theirs) | Same escarpment path, 83 m/83 m towers | marginal, ratio 0.76, clearance +5.8 m (LOS geometrically clear) | blocked, ground 7.6 m above sightline | **Verdict disagreement** -- same ~13-14 m gap as case 2, same location |
|
|
73
|
+
|
|
74
|
+
**Diagnosis**: bearing, the Fresnel formula, and the earth-curvature
|
|
75
|
+
geometry are independently verified correct (case 1's exact formula match;
|
|
76
|
+
case 2's near-identical F1/required figures; both tools agree on bearing
|
|
77
|
+
and total distance). The remaining ~13-14 m gap in cases 2/3, consistent
|
|
78
|
+
in both magnitude and location, is attributable to **elevation data
|
|
79
|
+
source**, not a bug: this package uses Copernicus DEM GLO-90 (90 m),
|
|
80
|
+
uptowhere.com uses AWS Terrain Tiles (~30 m) -- two different DEM products
|
|
81
|
+
that commonly diverge by this much on steep, sharp local relief like an
|
|
82
|
+
escarpment edge. Ruled out sampling density as the cause directly: doubling
|
|
83
|
+
this package's sample count (50 -> 100 points) changed the result by
|
|
84
|
+
<1 m, not ~14 m, so the gap isn't an artifact of under-sampling either.
|
|
85
|
+
|
|
86
|
+
**Conclusion**: the core geometry/clearance calculation is trustworthy.
|
|
87
|
+
The elevation-data layer carries real, now-quantified uncertainty
|
|
88
|
+
(order of 10-15 m at steep terrain features) that a real RF engineer
|
|
89
|
+
should be aware of before this is used for anything beyond a demo --
|
|
90
|
+
exactly what the mandatory DSM disclaimer exists to communicate, not
|
|
91
|
+
boilerplate.
|
|
92
|
+
|
|
93
|
+
## Install
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install aei-link-clearance # from PyPI (once published)
|
|
97
|
+
pip install -e . # core library, depends only on aei-geo-features
|
|
98
|
+
pip install -e ".[elevation]" # + requests, for the Open-Meteo client (see the Open-Meteo licensing notice above)
|
|
99
|
+
pip install -e ".[dev]" # + pytest
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "aei-link-clearance"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Batch microwave link terrain clearance and margin-based risk ranking, built on aei-geo-features."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "AID Edge Inc." }]
|
|
14
|
+
keywords = ["microwave", "point-to-point", "fresnel-zone", "terrain-clearance", "link-budget"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Telecommunications Industry",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Topic :: Scientific/Engineering",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"aei-geo-features>=0.1.4",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
elevation = ["requests>=2.31"]
|
|
27
|
+
batch = ["pandas>=1.5"]
|
|
28
|
+
dev = ["pytest>=7.0", "requests>=2.31", "pandas>=1.5"]
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.dynamic]
|
|
31
|
+
version = { attr = "aei_link_clearance.__version__" }
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src"]
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.package-data]
|
|
37
|
+
aei_link_clearance = ["py.typed"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""aei_link_clearance: batch microwave link terrain-clearance and
|
|
2
|
+
margin-based risk ranking.
|
|
3
|
+
|
|
4
|
+
Built on top of ``aei-geo-features`` (distance, coordinate validation) via a
|
|
5
|
+
real package dependency, not a copy -- this module adds only what
|
|
6
|
+
aei-geo-features deliberately excludes: bearing/azimuth, elevation-profile
|
|
7
|
+
sampling, Fresnel-zone geometry, and earth-curvature-adjusted terrain
|
|
8
|
+
clearance. See README.md for the methodology and its sources.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .explain import explain
|
|
12
|
+
from .fresnel import fresnel_radius_m
|
|
13
|
+
from .geometry import bearing_deg
|
|
14
|
+
from .terrain import (
|
|
15
|
+
LosStatus,
|
|
16
|
+
LinkClearanceResult,
|
|
17
|
+
ProfilePoint,
|
|
18
|
+
analyze_link,
|
|
19
|
+
earth_bulge_m,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
__version__ = "0.1.0"
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"__version__",
|
|
26
|
+
"bearing_deg",
|
|
27
|
+
"fresnel_radius_m",
|
|
28
|
+
"earth_bulge_m",
|
|
29
|
+
"analyze_link",
|
|
30
|
+
"explain",
|
|
31
|
+
"LinkClearanceResult",
|
|
32
|
+
"ProfilePoint",
|
|
33
|
+
"LosStatus",
|
|
34
|
+
]
|