miranda.ecmwf package#

ECMWF Download module.

miranda.ecmwf.rename_era5_files(path: PathLike | str) None[source]#

Rename badly named ERA5 files.

Notes

Requires that the proper ERA5 project name is in the filename, separated by underscores. Assumes that the data

Parameters:

path (os.PathLike or str) – Path to a folder containing netcdf files

Returns:

None

miranda.ecmwf.request_era5(projects: str | list[str], *, variables: str | Sequence[str] | None = None, domain: str = 'AMNO', pressure_levels: list[int] | None = None, separate_pressure_levels: bool = True, output_folder: str | PathLike | None = None, year_start: str | int | None = None, year_end: str | int | None = None, dry_run: bool = False, processes: int = 10, url: str | None = None, key: str | None = None) None[source]#

Request ERA5/ERA5-Land from Copernicus Data Store in NetCDF4 format.

Parameters:
  • projects (str or List[str]) – Allowed keys: {“era5-land”, “era5-land-monthly-means”, “era5-single-levels”, “era5-single-levels-monthly-means”, “era5-single-levels-preliminary-back-extension”, “era5-single-levels-monthly-means-preliminary-back-extension”, “era5-pressure-levels”, “era5-pressure-levels-monthly-means”, “era5-pressure-levels-preliminary-back-extension”, “era5-pressure-levels-monthly-means-preliminary-back-extension”}

  • variables (str or Sequence[str]) – Variable codes requested. If None, will attempt all hardcoded variables supported by miranda converter.

  • domain ({“GLOBAL”, “AMNO”, “NAM”, “CAN”, “QC”, “MTL”}) – Geographic domain requested. Default: “AMNO” (North America).

  • pressure_levels (List[int], optional) – If set and project requested has pressure levels, will download specific pressure levels.

  • separate_pressure_levels (bool) – Whether to separate files for each pressure level. Default: True

  • output_folder (str or os.PathLike, optional) – Folder to send files to. If None, will create a “downloaded” folder in current working directory.

  • year_start (int, optional) – Starting year for data download. If None, will download from first available year for project.

  • year_end (int, optional) – End year for data download. If None, will download files for current year and two months prior to present day.

  • dry_run (bool) – Do not send request. For debugging purposes.

  • processes (int) – The number of simultaneous download requests. Default: 10.

  • url (str, optional) – URL for Copernicus Data Store API (if not already using .cdsapirc)

  • key (str, optional) – Personal access key for Copernicus Data Store (if not already using .cdsapirc)

Returns:

None

miranda.ecmwf.request_tigge(variables: list[str], providers: list[str] | None = None, *, forecast_type: str = 'pf', times: list[str] | None = None, dates: list[str] | None = None, date_start: str | None = None, date_end: str | None = None, output_folder: PathLike | None = None, processes: int = 4) None[source]#

Request tigge data from ECMWF in grib format.

Parameters:
  • variables (list of str)

  • providers (ist of str, optional)

  • forecast_type ({“pf”, “cf”})

  • times (list of str, optional)

  • dates (list of str. optional)

  • date_start (str, optional)

  • date_end (str, optional)

  • output_folder (os.PathLike, optional)

  • processes (int)

Returns:

None

Submodules#

miranda.ecmwf._era5 module#

miranda.ecmwf._era5.rename_era5_files(path: PathLike | str) None[source]#

Rename badly named ERA5 files.

Notes

Requires that the proper ERA5 project name is in the filename, separated by underscores. Assumes that the data

Parameters:

path (os.PathLike or str) – Path to a folder containing netcdf files

Returns:

None

miranda.ecmwf._era5.request_era5(projects: str | list[str], *, variables: str | Sequence[str] | None = None, domain: str = 'AMNO', pressure_levels: list[int] | None = None, separate_pressure_levels: bool = True, output_folder: str | PathLike | None = None, year_start: str | int | None = None, year_end: str | int | None = None, dry_run: bool = False, processes: int = 10, url: str | None = None, key: str | None = None) None[source]#

Request ERA5/ERA5-Land from Copernicus Data Store in NetCDF4 format.

Parameters:
  • projects (str or List[str]) – Allowed keys: {“era5-land”, “era5-land-monthly-means”, “era5-single-levels”, “era5-single-levels-monthly-means”, “era5-single-levels-preliminary-back-extension”, “era5-single-levels-monthly-means-preliminary-back-extension”, “era5-pressure-levels”, “era5-pressure-levels-monthly-means”, “era5-pressure-levels-preliminary-back-extension”, “era5-pressure-levels-monthly-means-preliminary-back-extension”}

  • variables (str or Sequence[str]) – Variable codes requested. If None, will attempt all hardcoded variables supported by miranda converter.

  • domain ({“GLOBAL”, “AMNO”, “NAM”, “CAN”, “QC”, “MTL”}) – Geographic domain requested. Default: “AMNO” (North America).

  • pressure_levels (List[int], optional) – If set and project requested has pressure levels, will download specific pressure levels.

  • separate_pressure_levels (bool) – Whether to separate files for each pressure level. Default: True

  • output_folder (str or os.PathLike, optional) – Folder to send files to. If None, will create a “downloaded” folder in current working directory.

  • year_start (int, optional) – Starting year for data download. If None, will download from first available year for project.

  • year_end (int, optional) – End year for data download. If None, will download files for current year and two months prior to present day.

  • dry_run (bool) – Do not send request. For debugging purposes.

  • processes (int) – The number of simultaneous download requests. Default: 10.

  • url (str, optional) – URL for Copernicus Data Store API (if not already using .cdsapirc)

  • key (str, optional) – Personal access key for Copernicus Data Store (if not already using .cdsapirc)

Returns:

None

miranda.ecmwf._tigge module#

miranda.ecmwf._tigge.request_tigge(variables: list[str], providers: list[str] | None = None, *, forecast_type: str = 'pf', times: list[str] | None = None, dates: list[str] | None = None, date_start: str | None = None, date_end: str | None = None, output_folder: PathLike | None = None, processes: int = 4) None[source]#

Request tigge data from ECMWF in grib format.

Parameters:
  • variables (list of str)

  • providers (ist of str, optional)

  • forecast_type ({“pf”, “cf”})

  • times (list of str, optional)

  • dates (list of str. optional)

  • date_start (str, optional)

  • date_end (str, optional)

  • output_folder (os.PathLike, optional)

  • processes (int)

Returns:

None