17 lines
575 B
Python
17 lines
575 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from app.services.raster_base import RasterService
|
|
|
|
|
|
class CanopyService(RasterService):
|
|
def __init__(self, data_dir: str | Path, cache_size: int = 16) -> None:
|
|
super().__init__(data_dir, cache_size=cache_size)
|
|
|
|
def get_canopy_height(self, lat: float, lng: float) -> float:
|
|
return max(0.0, self.get_value(lat, lng, default=0.0))
|
|
|
|
def get_canopy_heights(self, coordinates: list[tuple[float, float]]) -> list[float]:
|
|
return [max(0.0, value) for value in self.get_values(coordinates, default=0.0)]
|