dinau package

Submodules

dinau.client module

class dinau.client.WeatherClient(location: Location, rounding_precision: int | None = 2, meteo=<class 'openmeteo_requests.Client.Client'>)[source]

Bases: object

Client for retrieving weather forecasts from Open-Meteo API.

This client provides methods to fetch current weather conditions, today’s weather forecast, and multi-day weather forecasts with configurable detail levels.

AIR_QUALITY_URL = 'https://air-quality-api.open-meteo.com/v1/air-quality'
FORECAST_URL = 'https://api.open-meteo.com/v1/forecast'
FULL_WEATHER: list[str] = ['temperature_2m', 'apparent_temperature', 'relative_humidity_2m', 'wind_speed_10m', 'wind_direction_10m', 'wind_gusts_10m', 'weather_code', 'precipitation', 'snowfall', 'rain', 'showers', 'cloud_cover', 'pressure_msl', 'surface_pressure']
HISTORICAL_URL = 'https://archive-api.open-meteo.com/v1/archive'
LITE_WEATHER: list[str] = ['temperature_2m', 'apparent_temperature', 'relative_humidity_2m', 'wind_speed_10m', 'weather_code', 'precipitation']
get_weather_current(lite: bool = False) CurrentWeather | CurrentWeatherLite[source]

Retrieve the current weather conditions.

Parameters:

lite (bool) – If True, returns only the most important weather information; otherwise returns a detailed report (default: False)

Returns:

Dataclass holding information about the current weather

Return type:

CurrentWeather | CurrentWeatherLite

get_weather_forecast(days: int = 7, lite: bool = False)[source]

Retrieve weather forecast for multiple days.

Parameters:
  • days (int) – Number of days to forecast (default: 7)

  • lite (bool) – If True, returns only the most important weather information; otherwise returns a detailed report (default: False)

Returns:

Dataclass holding weather forecast data

Return type:

WeatherForecast | WeatherForecastLite

get_weather_today(lite: bool = False)[source]

Retrieve today’s weather forecast.

Parameters:

lite (bool) – If True, returns only the most important weather information; otherwise returns a detailed report (default: False)

Returns:

Dataclass holding information about today’s weather

Return type:

DailyWeather | DailyWeatherLite

dinau.location module

class dinau.location.Location(name: str)[source]

Bases: object

Represents a geographic location.

GEOCODING_URL = 'https://geocoding-api.open-meteo.com/v1/search'
property latitude: float

Latitude of the location

property longitude: float

Longitude of the location

dinau.models module

class dinau.models.AirQualityIndex(*values)[source]

Bases: Enum

European Air Quality Index categories.

This enum defines the standard European air quality categories ranging from good to extremely poor conditions.

EXTREMELY_POOR = 6
FAIR = 2
GOOD = 1
MODERATE = 3
POOR = 4
VERY_POOR = 5
class dinau.models.CurrentWeather(timestamp: float, temperature: float, apparent_temperature: float, humidity: float, wind_speed: float, wind_direction: float, wind_gust: float, weather_code: int, precipitation: float, snowfall: float, rain: float, showers: float, cloud_cover: float, pressure_sea_level: float, pressure_surface_level: float)[source]

Bases: object

Current weather conditions with comprehensive information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • temperature (float) – Current temperature in Celsius

  • apparent_temperature (float) – Current feels-like temperature in Celsius

  • humidity (float) – Current relative humidity (0-100%)

  • wind_speed (float) – Current wind speed in km/h

  • wind_direction (float) – Current wind direction in degrees

  • wind_gust (float) – Current wind gust speed in km/h

  • weather_code (int) – Current WMO weather code

  • precipitation (float) – Preceding 15 minutes sum in mm

  • snowfall (float) – Preceding 15 minutes sum in cm

  • rain (float) – Preceding 15 minutes sum in mm

  • showers (float) – Preceding 15 minutes sum in mm

  • cloud_cover (float) – Current cloud cover percentage (0-100%)

  • pressure_sea_level (float) – Current atmospheric pressure at sea level in hPa

  • pressure_surface_level (float) – Current atmospheric pressure at surface level in hPa

apparent_temperature: float
cloud_cover: float
humidity: float
precipitation: float
pressure_sea_level: float
pressure_surface_level: float
rain: float
showers: float
snowfall: float
temperature: float
timestamp: float
weather_code: int
wind_direction: float
wind_gust: float
wind_speed: float
class dinau.models.CurrentWeatherLite(timestamp: float, temperature: float, apparent_temperature: float, humidity: float, wind_speed: float, weather_code: int, precipitation: float)[source]

Bases: object

Current weather conditions with only the most important information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • temperature (float) – Current temperature in Celsius

  • apparent_temperature (float) – Current feels-like temperature in Celsius

  • humidity (float) – Current relative humidity (0-100%)

  • wind_speed (float) – Current wind speed in km/h

  • weather_code (int) – Current WMO weather code

  • precipitation (float) – Preceding 15 minutes sum in mm

apparent_temperature: float
humidity: float
precipitation: float
temperature: float
timestamp: float
weather_code: int
wind_speed: float
class dinau.models.DailyWeather(timestamp: float, temperature_min: float, temperature_max: float, precipitation_probability: float, hourly_data: DataFrame)[source]

Bases: DailyWeatherLite

Weather forecast for a single day with comprehensive information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • temperature_min (float) – Minimum temperature in Celsius

  • temperature_max (float) – Maximum temperature in Celsius

  • precipitation_probability (float) – Probability of precipitation (0-100%)

  • hourly_data (pd.DataFrame) – Hourly weather data for the day

Note

The hourly_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature (float): Temperature

  • apparent_temperature (float): Feels-like temperature

  • humidity (float): Relative humidity (0-100%)

  • wind_speed (float): Wind speed

  • wind_direction (float): Wind direction in degrees

  • wind_gusts (float): Wind gust speed

  • weather_code (int): WMO weather code

  • precipitation (float): Precipitation amount

  • snowfall (float): Snowfall amount

  • rain (float): Rain amount

  • showers (float): Shower amount

  • cloud_cover (float): Cloud cover percentage (0-100%)

  • pressure_sea_level (float): Atmospheric pressure at sea level in hPa

  • pressure_surface_level (float): Atmospheric pressure at surface level in hPa

The DataFrame contains 24 rows (one per hour).

class dinau.models.DailyWeatherLite(timestamp: float, temperature_min: float, temperature_max: float, precipitation_probability: float, hourly_data: DataFrame)[source]

Bases: object

Weather forecast for a single day with only the most important information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • temperature_min (float) – Minimum temperature in Celsius

  • temperature_max (float) – Maximum temperature in Celsius

  • precipitation_probability (float) – Probability of precipitation (0-100%)

  • hourly_data (pd.DataFrame) – Hourly weather data for the day

Note

The hourly_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature (float): Temperature (Celsius)

  • apparent_temperature (float): Feels-like temperature

  • humidity (float): Relative humidity at this time (0-100%)

  • wind_speed (float): Wind speed

  • weather_code (int): WMO weather code

  • precipitation (float): Precipitation amount (mm)

The DataFrame contains 24 rows (one per hour).

hourly_data: DataFrame
precipitation_probability: float
temperature_max: float
temperature_min: float
timestamp: float
umbrella_needed(threshold: float = 3.0) bool[source]

Determines if an umbrella is needed based on the weather data.

Umbrella points are calculated internally based on the following factors:

  • Precipitation probability (0-100%)

  • Precipitation amount, temperature, and time of precipitation

Parameters:

threshold (float) – Minimum number of ‘umbrella points’ needed to return True (default: 3.0)

Returns:

True if an umbrella is needed, False otherwise

Return type:

bool

class dinau.models.WeatherForecast(timestamp: float, daily_data: DataFrame, hourly_data: DataFrame)[source]

Bases: WeatherForecastLite

Weather forecast for multiple days with comprehensive information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • daily_data (pd.DataFrame) – Daily weather data

  • hourly_data (pd.DataFrame) – Hourly weather data

Note

The daily_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature_min (float): Minimum temperature

  • temperature_max (float): Maximum temperature

  • temperature_mean (float): Mean temperature

  • apparent_temperature_mean (float): Mean feels-like temperature

  • precipitation_probability (float): Probability of precipitation (0-100%)

  • precipitation_sum (float): Sum of precipitation for the day

The hourly_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature (float): Temperature

  • apparent_temperature (float): Feels-like temperature

  • humidity (float): Relative humidity (0-100%)

  • wind_speed (float): Wind speed

  • wind_direction (float): Wind direction in degrees

  • wind_gusts (float): Wind gust speed

  • weather_code (int): WMO weather code

  • precipitation (float): Precipitation amount

  • snowfall (float): Snowfall amount

  • rain (float): Rain amount

  • showers (float): Shower amount

  • cloud_cover (float): Cloud cover percentage (0-100%)

  • pressure_sea_level (float): Atmospheric pressure at sea level in hPa

  • pressure_surface_level (float): Atmospheric pressure at surface level in hPa

class dinau.models.WeatherForecastLite(timestamp: float, daily_data: DataFrame, hourly_data: DataFrame)[source]

Bases: object

Weather forecast for multiple days with only the most important information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • daily_data (pd.DataFrame) – Daily weather data

  • hourly_data (pd.DataFrame) – Hourly weather data

Note

The daily_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature_min (float): Minimum temperature

  • temperature_max (float): Maximum temperature

  • temperature_mean (float): Mean temperature

  • apparent_temperature_mean (float): Mean feels-like temperature

  • precipitation_probability (float): Probability of precipitation (0-100%)

  • precipitation_sum (float): Sum of precipitation for the day

The hourly_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature (float): Temperature (Celsius)

  • apparent_temperature (float): Feels-like temperature (Celsius)

  • humidity (float): Relative humidity (0-100%)

  • wind_speed (float): Wind speed (km/h)

  • weather_code (int): WMO weather code

  • precipitation (float): Precipitation amount (mm)

daily_data: DataFrame
get_detailed_data(section_length: int = 6) DataFrame[source]

Calculate weather data with customized section length.

Parameters:

section_length (int) – Number of hours per section (default: 6 for 4 sections per day)

Returns:

DataFrame with detailed data containing the following columns:

  • date (str): String representation of the section (e.g., “Jan 01 00-06”)

  • temperature_min (float): Minimum temperature in the section

  • temperature_max (float): Maximum temperature in the section

  • temperature_mean (float): Mean temperature in the section

  • apparent_temperature_mean (float): Mean feels-like temperature in the section

  • precipitation_sum (float): Sum of precipitation for the section

Return type:

pd.DataFrame

hourly_data: DataFrame
timestamp: float
umbrella_needed(threshold: float = 3.0) list[bool][source]

Determines if an umbrella is needed for each day based on the weather data.

Umbrella points are calculated internally based on the following factors:

  • Precipitation probability (0-100%)

  • Precipitation amount, temperature, and time of precipitation

Parameters:

threshold (float) – Minimum number of ‘umbrella points’ needed to return True (default: 3.0)

Returns:

List of boolean values, one per day. True if an umbrella is needed for that day, False otherwise

Return type:

list[bool]

Module contents

class dinau.AirQualityIndex(*values)[source]

Bases: Enum

European Air Quality Index categories.

This enum defines the standard European air quality categories ranging from good to extremely poor conditions.

EXTREMELY_POOR = 6
FAIR = 2
GOOD = 1
MODERATE = 3
POOR = 4
VERY_POOR = 5
class dinau.CurrentWeather(timestamp: float, temperature: float, apparent_temperature: float, humidity: float, wind_speed: float, wind_direction: float, wind_gust: float, weather_code: int, precipitation: float, snowfall: float, rain: float, showers: float, cloud_cover: float, pressure_sea_level: float, pressure_surface_level: float)[source]

Bases: object

Current weather conditions with comprehensive information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • temperature (float) – Current temperature in Celsius

  • apparent_temperature (float) – Current feels-like temperature in Celsius

  • humidity (float) – Current relative humidity (0-100%)

  • wind_speed (float) – Current wind speed in km/h

  • wind_direction (float) – Current wind direction in degrees

  • wind_gust (float) – Current wind gust speed in km/h

  • weather_code (int) – Current WMO weather code

  • precipitation (float) – Preceding 15 minutes sum in mm

  • snowfall (float) – Preceding 15 minutes sum in cm

  • rain (float) – Preceding 15 minutes sum in mm

  • showers (float) – Preceding 15 minutes sum in mm

  • cloud_cover (float) – Current cloud cover percentage (0-100%)

  • pressure_sea_level (float) – Current atmospheric pressure at sea level in hPa

  • pressure_surface_level (float) – Current atmospheric pressure at surface level in hPa

apparent_temperature: float
cloud_cover: float
humidity: float
precipitation: float
pressure_sea_level: float
pressure_surface_level: float
rain: float
showers: float
snowfall: float
temperature: float
timestamp: float
weather_code: int
wind_direction: float
wind_gust: float
wind_speed: float
class dinau.CurrentWeatherLite(timestamp: float, temperature: float, apparent_temperature: float, humidity: float, wind_speed: float, weather_code: int, precipitation: float)[source]

Bases: object

Current weather conditions with only the most important information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • temperature (float) – Current temperature in Celsius

  • apparent_temperature (float) – Current feels-like temperature in Celsius

  • humidity (float) – Current relative humidity (0-100%)

  • wind_speed (float) – Current wind speed in km/h

  • weather_code (int) – Current WMO weather code

  • precipitation (float) – Preceding 15 minutes sum in mm

apparent_temperature: float
humidity: float
precipitation: float
temperature: float
timestamp: float
weather_code: int
wind_speed: float
class dinau.DailyWeather(timestamp: float, temperature_min: float, temperature_max: float, precipitation_probability: float, hourly_data: DataFrame)[source]

Bases: DailyWeatherLite

Weather forecast for a single day with comprehensive information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • temperature_min (float) – Minimum temperature in Celsius

  • temperature_max (float) – Maximum temperature in Celsius

  • precipitation_probability (float) – Probability of precipitation (0-100%)

  • hourly_data (pd.DataFrame) – Hourly weather data for the day

Note

The hourly_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature (float): Temperature

  • apparent_temperature (float): Feels-like temperature

  • humidity (float): Relative humidity (0-100%)

  • wind_speed (float): Wind speed

  • wind_direction (float): Wind direction in degrees

  • wind_gusts (float): Wind gust speed

  • weather_code (int): WMO weather code

  • precipitation (float): Precipitation amount

  • snowfall (float): Snowfall amount

  • rain (float): Rain amount

  • showers (float): Shower amount

  • cloud_cover (float): Cloud cover percentage (0-100%)

  • pressure_sea_level (float): Atmospheric pressure at sea level in hPa

  • pressure_surface_level (float): Atmospheric pressure at surface level in hPa

The DataFrame contains 24 rows (one per hour).

class dinau.DailyWeatherLite(timestamp: float, temperature_min: float, temperature_max: float, precipitation_probability: float, hourly_data: DataFrame)[source]

Bases: object

Weather forecast for a single day with only the most important information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • temperature_min (float) – Minimum temperature in Celsius

  • temperature_max (float) – Maximum temperature in Celsius

  • precipitation_probability (float) – Probability of precipitation (0-100%)

  • hourly_data (pd.DataFrame) – Hourly weather data for the day

Note

The hourly_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature (float): Temperature (Celsius)

  • apparent_temperature (float): Feels-like temperature

  • humidity (float): Relative humidity at this time (0-100%)

  • wind_speed (float): Wind speed

  • weather_code (int): WMO weather code

  • precipitation (float): Precipitation amount (mm)

The DataFrame contains 24 rows (one per hour).

hourly_data: DataFrame
precipitation_probability: float
temperature_max: float
temperature_min: float
timestamp: float
umbrella_needed(threshold: float = 3.0) bool[source]

Determines if an umbrella is needed based on the weather data.

Umbrella points are calculated internally based on the following factors:

  • Precipitation probability (0-100%)

  • Precipitation amount, temperature, and time of precipitation

Parameters:

threshold (float) – Minimum number of ‘umbrella points’ needed to return True (default: 3.0)

Returns:

True if an umbrella is needed, False otherwise

Return type:

bool

class dinau.Location(name: str)[source]

Bases: object

Represents a geographic location.

GEOCODING_URL = 'https://geocoding-api.open-meteo.com/v1/search'
property latitude: float

Latitude of the location

property longitude: float

Longitude of the location

class dinau.WeatherClient(location: Location, rounding_precision: int | None = 2, meteo=<class 'openmeteo_requests.Client.Client'>)[source]

Bases: object

Client for retrieving weather forecasts from Open-Meteo API.

This client provides methods to fetch current weather conditions, today’s weather forecast, and multi-day weather forecasts with configurable detail levels.

AIR_QUALITY_URL = 'https://air-quality-api.open-meteo.com/v1/air-quality'
FORECAST_URL = 'https://api.open-meteo.com/v1/forecast'
FULL_WEATHER: list[str] = ['temperature_2m', 'apparent_temperature', 'relative_humidity_2m', 'wind_speed_10m', 'wind_direction_10m', 'wind_gusts_10m', 'weather_code', 'precipitation', 'snowfall', 'rain', 'showers', 'cloud_cover', 'pressure_msl', 'surface_pressure']
HISTORICAL_URL = 'https://archive-api.open-meteo.com/v1/archive'
LITE_WEATHER: list[str] = ['temperature_2m', 'apparent_temperature', 'relative_humidity_2m', 'wind_speed_10m', 'weather_code', 'precipitation']
get_weather_current(lite: bool = False) CurrentWeather | CurrentWeatherLite[source]

Retrieve the current weather conditions.

Parameters:

lite (bool) – If True, returns only the most important weather information; otherwise returns a detailed report (default: False)

Returns:

Dataclass holding information about the current weather

Return type:

CurrentWeather | CurrentWeatherLite

get_weather_forecast(days: int = 7, lite: bool = False)[source]

Retrieve weather forecast for multiple days.

Parameters:
  • days (int) – Number of days to forecast (default: 7)

  • lite (bool) – If True, returns only the most important weather information; otherwise returns a detailed report (default: False)

Returns:

Dataclass holding weather forecast data

Return type:

WeatherForecast | WeatherForecastLite

get_weather_today(lite: bool = False)[source]

Retrieve today’s weather forecast.

Parameters:

lite (bool) – If True, returns only the most important weather information; otherwise returns a detailed report (default: False)

Returns:

Dataclass holding information about today’s weather

Return type:

DailyWeather | DailyWeatherLite

class dinau.WeatherForecast(timestamp: float, daily_data: DataFrame, hourly_data: DataFrame)[source]

Bases: WeatherForecastLite

Weather forecast for multiple days with comprehensive information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • daily_data (pd.DataFrame) – Daily weather data

  • hourly_data (pd.DataFrame) – Hourly weather data

Note

The daily_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature_min (float): Minimum temperature

  • temperature_max (float): Maximum temperature

  • temperature_mean (float): Mean temperature

  • apparent_temperature_mean (float): Mean feels-like temperature

  • precipitation_probability (float): Probability of precipitation (0-100%)

  • precipitation_sum (float): Sum of precipitation for the day

The hourly_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature (float): Temperature

  • apparent_temperature (float): Feels-like temperature

  • humidity (float): Relative humidity (0-100%)

  • wind_speed (float): Wind speed

  • wind_direction (float): Wind direction in degrees

  • wind_gusts (float): Wind gust speed

  • weather_code (int): WMO weather code

  • precipitation (float): Precipitation amount

  • snowfall (float): Snowfall amount

  • rain (float): Rain amount

  • showers (float): Shower amount

  • cloud_cover (float): Cloud cover percentage (0-100%)

  • pressure_sea_level (float): Atmospheric pressure at sea level in hPa

  • pressure_surface_level (float): Atmospheric pressure at surface level in hPa

class dinau.WeatherForecastLite(timestamp: float, daily_data: DataFrame, hourly_data: DataFrame)[source]

Bases: object

Weather forecast for multiple days with only the most important information.

Parameters:
  • timestamp (float) – Time of the request (Unix Timestamp)

  • daily_data (pd.DataFrame) – Daily weather data

  • hourly_data (pd.DataFrame) – Hourly weather data

Note

The daily_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature_min (float): Minimum temperature

  • temperature_max (float): Maximum temperature

  • temperature_mean (float): Mean temperature

  • apparent_temperature_mean (float): Mean feels-like temperature

  • precipitation_probability (float): Probability of precipitation (0-100%)

  • precipitation_sum (float): Sum of precipitation for the day

The hourly_data DataFrame contains the following columns:

  • date (datetime): Datetime of this row

  • temperature (float): Temperature (Celsius)

  • apparent_temperature (float): Feels-like temperature (Celsius)

  • humidity (float): Relative humidity (0-100%)

  • wind_speed (float): Wind speed (km/h)

  • weather_code (int): WMO weather code

  • precipitation (float): Precipitation amount (mm)

daily_data: DataFrame
get_detailed_data(section_length: int = 6) DataFrame[source]

Calculate weather data with customized section length.

Parameters:

section_length (int) – Number of hours per section (default: 6 for 4 sections per day)

Returns:

DataFrame with detailed data containing the following columns:

  • date (str): String representation of the section (e.g., “Jan 01 00-06”)

  • temperature_min (float): Minimum temperature in the section

  • temperature_max (float): Maximum temperature in the section

  • temperature_mean (float): Mean temperature in the section

  • apparent_temperature_mean (float): Mean feels-like temperature in the section

  • precipitation_sum (float): Sum of precipitation for the section

Return type:

pd.DataFrame

hourly_data: DataFrame
timestamp: float
umbrella_needed(threshold: float = 3.0) list[bool][source]

Determines if an umbrella is needed for each day based on the weather data.

Umbrella points are calculated internally based on the following factors:

  • Precipitation probability (0-100%)

  • Precipitation amount, temperature, and time of precipitation

Parameters:

threshold (float) – Minimum number of ‘umbrella points’ needed to return True (default: 3.0)

Returns:

List of boolean values, one per day. True if an umbrella is needed for that day, False otherwise

Return type:

list[bool]