Copernicus

pansat.download.providers.copernicus

This module provides the CopernicusProvider class to download data from the Copernicus data store. After creating an account, you need to install a key for the CDS API and the python library cdsapi following these steps: https://cds.climate.copernicus.eu/api-how-to

class pansat.download.providers.copernicus.CopernicusProvider(product)

Base class for reanalysis products available from Copernicus.

__init__(product)

Create a new product instance.

Parameters:

product (str) – product name, available products are land, single-level, pressure-level for hourly and monthly resolution

download(start, end, destination)

Downloads files dependent on desired temporal resolution of data product.

Parameters:
  • start (datetime.datetime) – start date and time (year, month, day, hour), if hour is not specified for hourly dataproduct, all hours are downloaded for each date.

  • end (datetime.datetime) – end date and time (year, month, day, hour), if hour is not specified for hourly dataproduct, all hours are downloaded for each date.

  • destination (str or pathlib.Path) – path to directory where the downloaded files should be stored.

download_hourly(start, end, destination)

Downloads hourly files for given time range and stores at specified location. Hourly data products are saved per hour and monthly data products are saved per month. Note that you have to install the CDS API key before download is possible: https://cds.climate.copernicus.eu/api-how-to

Parameters:
  • start (datetime.datetime) – start date and time (year, month, day, hour), if hour is not specified for hourly dataproduct, all hours are downloaded for each date.

  • end (datetime.datetime) – end date and time (year, month, day, hour), if hour is not specified for hourly dataproduct, all hours are downloaded for each date.

  • destination (str or pathlib.Path) – path to directory where the downloaded files should be stored.

download_monthly(start, end, destination)

Downloads monthly files for given time range and stores at specified location. Hourly data products are saved per hour and monthly data products are saved per month. Note that you have to install the CDS API key before download is possible: https://cds.climate.copernicus.eu/api-how-to

Parameters:
  • start (datetime.datetime) – start date and time (year, month, day, hour), if hour is not specified for hourly dataproduct, all hours are downloaded for each date.

  • end (datetime.datetime) – end date and time (year, month, day, hour), if hour is not specified for hourly dataproduct, all hours are downloaded for each date.

  • destination (str or pathlib.Path) – path to directory where the downloaded files should be stored.

classmethod get_available_products()

The products available from this dataprovider.

classmethod get_timesteps_hourly(start, end)

Create a time range with all dates between the start and end date.

Parameters:
  • start (datetime.datetime) – datetime.datetime object for start time

  • end (datetime.datetime) – datetime.datetime object for end time

Returns:

list with all hours, days, months and years between two dates

Return type:

dates(list)

classmethod get_timesteps_monthly(start, end)

Create a time range with all dates between the start and end date.

Parameters:
  • start (datetime.datetime) – datetime.datetime object for start time

  • end (datetime.datetime) – datetime.datetime object for end time

Returns:

list with months for each year years(list): list with all years

Return type:

dates(list)

pansat.download.providers.copernicus._create_cds_api_rc()

Context manager to create a temporary file with the Copernicus CDS login credentials obtained from the Pansat account manager.