environmentaltools.download.ERA5DataDownloadConfig

class environmentaltools.download.ERA5DataDownloadConfig(config: dict[str, Any] | None = None)[source]

Configuration class for ERA5 data download parameters.

This class accepts configuration as a dictionary and provides validation and default values for all parameters. It supports any ERA5 variable (marine, atmospheric, land, etc.).

dataset_name

CDS dataset identifier.

Type:

str

variable

Variable to download (e.g., wave height, wind, temperature).

Type:

str

start_year

First year to download.

Type:

int

end_year

Last year to download.

Type:

int

area_bounds

Geographic bounds [North, West, South, East].

Type:

list

output_directory

Directory for output files.

Type:

str

file_prefix

Prefix for output filenames.

Type:

str

retry_attempts

Number of retry attempts for failed downloads.

Type:

int

Example

>>> # Download wave data
>>> config_dict = {
...     'start_year': 2015,
...     'end_year': 2020,
...     'area_bounds': [41.4, -9.0, 41.0, -8.65],
...     'output_directory': './era5_data',
...     'variable': 'significant_height_of_combined_wind_waves_and_swell'
... }
>>> config = ERA5DataDownloadConfig(config_dict)
>>>
>>> # Download wind data
>>> config_dict['variable'] = '10m_u_component_of_wind'
>>> config = ERA5DataDownloadConfig(config_dict)
__init__(config: dict[str, Any] | None = None)[source]

Initialize configuration from dictionary.

Parameters:

config (dict, optional) – Configuration dictionary. If None, uses defaults. Supported keys: - dataset_name (str): Dataset identifier - variable (str): Variable name - start_year (int): Start year - end_year (int): End year - months (list): Months to download (default: all) - days (list): Days to download (default: all) - hours (list): Hours to download (default: all) - area_bounds (list): [North, West, South, East] - output_directory (str): Output path - retry_attempts (int): Number of retry attempts (default: 3)

Raises:

ValueError – If configuration is invalid.

Methods

__init__([config])

Initialize configuration from dictionary.

print_summary()

Print a summary of the current configuration using loguru logger.