bluemath_tk.downloaders.ecmwf package

Submodules

bluemath_tk.downloaders.ecmwf.ecmwf_downloader module

class bluemath_tk.downloaders.ecmwf.ecmwf_downloader.ECMWFDownloader(product: str, base_path_to_download: str, model: str = 'ifs', resolution: str = '0p25', debug: bool = True, check: bool = True)[source]

Bases: BaseDownloader

This is the main class to download data from the ECMWF.

product

The product to download data from. Currently only OpenData is supported.

Type:

str

product_config

The configuration for the product to download data from.

Type:

dict

client

The client to interact with the ECMWF API.

Type:

ecmwf.opendata.Client

Examples

from bluemath_tk.downloaders.ecmwf.ecmwf_downloader import ECMWFDownloader

ecmwf_downloader = ECMWFDownloader(
    product="OpenData",
    base_path_to_download="/path/to/ECMWF/",  # Will be created if not available
    check=True,
)
dataset = ecmwf_downloader.download_data(
    load_data=False,
    param=["msl"],
    step=[0, 240],
    type="fc",
)
print(dataset)
/path/to/ECMWF/OpenData/ifs/0p25/msl_0_240_fc.grib2
property client: Client
download_data(load_data: bool = False, *args, **kwargs) str | Dataset[source]

Downloads the data for the product.

Parameters:
  • load_data (bool, optional) – Whether to load the data into an xarray.Dataset. Default is False.

  • *args – The arguments to pass to the download function.

  • **kwargs – The keyword arguments to pass to the download function.

Returns:

The path to the downloaded file if load_data is False, otherwise the xarray.Dataset.

Return type:

Union[str, xr.Dataset]

Raises:

ValueError – If the product is not supported.

download_data_open_data(force: bool = False, **kwargs) str[source]

Downloads the data for the OpenData product.

Parameters:
  • force (bool, optional) – Whether to force the download. Default is False.

  • **kwargs – The keyword arguments to pass to the download function.

Returns:

The path to the downloaded file.

Return type:

str

list_datasets() List[str][source]

Lists the datasets available for the product.

Returns:

The list of datasets available for the product.

Return type:

List[str]

property product: str
property product_config: dict
products_configs = {'OpenData': {'datasets': {'forecast_data': {'description': 'ECMWF OpenData Forecast Data', 'models': ['ifs', 'aifs'], 'resolutions': ['0p25'], 'url': 'https://confluence.ecmwf.int/display/DAC/ECMWF+open+data%3A+real-time+forecasts+from+IFS+and+AIFS'}}}}

Module contents