breos.weather.load_weather#

breos.weather.load_weather(location, data_type=None, start_year=None, end_year=None, source=None, weather_dir='weather/')[source]#

Smart weather loading: scan local files for matching weather data.

Searches the weather directory for files matching the naming convention, filters by location/type/source, and checks date coverage. If a file covers the requested range (e.g., requesting 2008-2010 and a 2005-2024 file exists), subsets it automatically.

Parameters:
  • location (str) – Location name (e.g., ‘porto’, ‘lisbon’)

  • data_type (Optional[str]) – ‘tmy’ or ‘historical’ (None = any)

  • start_year (Optional[int]) – Start year for date coverage check

  • end_year (Optional[int]) – End year for date coverage check

  • source (Optional[str]) – Data source filter (e.g., ‘openmeteo’, ‘pvgis-sarah3’)

  • weather_dir (str) – Directory to scan for weather files

Return type:

Optional[DataFrame]

Returns:

DataFrame if a matching file is found, None otherwise.