Source code for openmeteopy.options.elevation

from openmeteopy.utils.constants import *
from openmeteopy.utils.timezones import *
from .option import Option


[docs] class ElevationOptions(Option): API_PATH = "https://api.open-meteo.com/v1/elevation?" """ The API options accepts a WGS4 coordinate and other weather variables . Time always starts at 0:00 today and contains 168 hours. """ def __init__(self, latitude, longitude): """ Args: latitude (float): Latitude (Geographical WGS84 coordiante of the location). longitude (float): Longitude (Geographical WGS84 coordiante of the location). Raises: ValueError: Raises when latitude is not between -90 and 90 degrees. ValueError: Raises when longitude is not between -180 and 180 degrees. """ if latitude < -90 or latitude > 90: raise ValueError("Latitude should be between -90 and 90 degrees.") if longitude < -180 or longitude > 180: raise ValueError("Longitude should be between -180 and 180 degrees.") self.latitude = latitude self.longitude = longitude
[docs] def get_api_path(self): return self.API_PATH
[docs] def get_payload(self): payload = { "latitude": self.latitude, "longitude": self.longitude } return payload