added covarage
This commit is contained in:
@@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from app.config import get_settings
|
||||
from app.core.geo import PathPoint
|
||||
from app.core.landcover import LandcoverNotConfiguredError, landcover_path
|
||||
from app.core.vegetation import P833Coefficients, p833_attenuation
|
||||
from app.core.vegetation import p833_attenuation, p833_coefficients_for_class
|
||||
|
||||
|
||||
def vegetation_loss_along(
|
||||
@@ -27,13 +27,16 @@ def vegetation_loss_along(
|
||||
except LandcoverNotConfiguredError:
|
||||
return 0.0
|
||||
|
||||
coefficients = P833Coefficients(
|
||||
gamma_db_per_m=settings.p833_gamma_db_per_m,
|
||||
max_attenuation_db=settings.p833_max_attenuation_db,
|
||||
)
|
||||
dominant_class = "unknown"
|
||||
if path.segments:
|
||||
dominant_class = max(
|
||||
path.segments,
|
||||
key=lambda segment: segment.to_m - segment.from_m,
|
||||
).class_name
|
||||
|
||||
return p833_attenuation(
|
||||
depth_m=path.vegetation_depth_m,
|
||||
freq_hz=freq_hz,
|
||||
forest_type="unknown",
|
||||
coefficients=coefficients,
|
||||
forest_type=dominant_class,
|
||||
coefficients=p833_coefficients_for_class(dominant_class),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user