added covarage
This commit is contained in:
@@ -1,6 +1,31 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from itur.models import itu676
|
||||
|
||||
from app.core.geo import GeoPoint, haversine
|
||||
|
||||
|
||||
def p676_gas_attenuation(freq_hz: float, distance_km: float) -> float:
|
||||
if freq_hz <= 0:
|
||||
raise ValueError("freq_hz must be positive")
|
||||
if distance_km < 0:
|
||||
raise ValueError("distance_km must be non-negative")
|
||||
raise NotImplementedError("ITU-R P.676 gas attenuation requires pycraf integration")
|
||||
if distance_km == 0:
|
||||
return 0.0
|
||||
|
||||
freq_ghz = freq_hz / 1_000_000_000
|
||||
attenuation = itu676.gaseous_attenuation_terrestrial_path(
|
||||
distance_km,
|
||||
freq_ghz,
|
||||
0,
|
||||
7.5,
|
||||
1013,
|
||||
288,
|
||||
"exact",
|
||||
)
|
||||
return float(attenuation.value)
|
||||
|
||||
|
||||
def atmospheric_loss_between(tx: GeoPoint, rx: GeoPoint, freq_hz: float) -> float:
|
||||
distance_km = haversine(tx, rx) / 1000.0
|
||||
return p676_gas_attenuation(freq_hz, distance_km)
|
||||
|
||||
Reference in New Issue
Block a user