ecmwf_models.erainterim package
Submodules
ecmwf_models.erainterim.download module
Module to download ERA Interim from terminal.
- ecmwf_models.erainterim.download.default_variables() list [source]
These variables are being downloaded, when None are passed by the user
- ecmwf_models.erainterim.download.download_and_move(target_path, startdate, enddate, variables=None, keep_original=False, grid_size=None, type='an', h_steps=(0, 6, 12, 18), steps=(0,), grb=False, dry_run=False)[source]
Downloads the data from the ECMWF servers and moves them to the target path. This is done in 30 days increments between start and end date to be efficient with the MARS system. See the recommendation for doing it this way in https://software.ecmwf.int/wiki/display/WEBAPI/ERA-Interim+daily+retrieval+efficiency
The files are then extracted into separate grib/nc files and stored in yearly folders under the target_path.
- Parameters
target_path (str) – Path to which to copy the extracted parameter files
startdate (datetime) – First date to download
enddate (datetime) – Last date to download
variables (list, optional (default: None)) – List of variable ids to pass to the client, if None are passed, the default variable ids will be downloaded.
keep_original (bool, optional (default: False)) – Keep the original downloaded data
grid_size (list, optional (default: None)) – [lon, lat] extent of the grid (regular for netcdf, at lat=0 for grib) If None is passed, the default grid size for the data product is used.
type (str, optional (default: 'an')) – Data stream, model to download data for (fc=forecase)
h_steps (list, optional (default: [0, 6, 12, 18])) – List of full hours to download data at the selected dates
grb (bool, optional (default: False)) – Download data as grib files instead of netcdf files
dry_run (bool) – Do not download anything, this is just used for testing the functions
- ecmwf_models.erainterim.download.download_eraint(target_path, start, end, variables, grid_size=None, type='fc', h_steps=(0, 6, 12, 18), grb=False, dry_run=False, steps=(0,))[source]
Download era interim data
- Parameters
target_path (str) – path at which to save the downloaded grib file
start (date) – start date
end (date) – end date
variables (list) – parameter ids, see wiki
product (str, optional) – Name of the model, “ERA-interim” (default) or “ERA5”
grid_size ([float,float], optional) – size of the grid in form (lon, lat), which the data is resampled to If None is passed the minimum grid for the accoring product is chosen
h_steps (tuple, optional (default: (0, 6, 12, 18))) – List of full hours to download data at the selected dates
grb (bool, optional (default: False)) – Download data as grb files instead of nc files
dry_run (bool) – Do not download anything, this is just used for testing the functions
ecmwf_models.erainterim.interface module
This module contains ERA Interim specific child classes of the netcdf and grib base classes, that are used for reading all ecmwf products.
- class ecmwf_models.erainterim.interface.ERAIntGrbDs(root_path: str, parameter: Collection[str] = ('swvl1', 'swvl2'), subgrid: Optional[pygeogrids.grids.CellGrid] = None, mask_seapoints: Optional[bool] = False, h_steps: Collection[int] = (0, 6, 12, 18), array_1D: Optional[bool] = False)[source]
- class ecmwf_models.erainterim.interface.ERAIntGrbImg(filename: str, parameter: Optional[Collection[str]] = ('swvl1', 'swvl2'), mode: Optional[str] = 'r', subgrid: Optional[pygeogrids.grids.CellGrid] = None, mask_seapoints: Optional[bool] = False, array_1D: Optional[bool] = False)[source]
- class ecmwf_models.erainterim.interface.ERAIntNcDs(root_path: str, parameter: Optional[Collection[str]] = ('swvl1', 'swvl2'), subgrid: Optional[pygeogrids.grids.CellGrid] = None, mask_seapoints: Optional[bool] = False, h_steps: Collection[int] = (0, 6, 12, 18), array_1D: Optional[bool] = False)[source]
ecmwf_models.erainterim.reshuffle module
Module for a command line interface to convert the ERA Interim data into a time series format using the repurpose package
- ecmwf_models.erainterim.reshuffle.parse_args(args)[source]
Parse command line parameters for conversion from image to time series.
- Parameters
args (list) – command line parameters as list of strings
- Returns
args – Parsed command line parameters
- Return type
- ecmwf_models.erainterim.reshuffle.reshuffle(input_root, outputpath, startdate, enddate, variables, mask_seapoints=False, h_steps=(0, 6, 12, 18), imgbuffer=50)[source]
Reshuffle method applied to ERA images for conversion into netcdf time series format.
- Parameters
input_root (str) – Input path where ERA image data was downloaded to.
outputpath (str) – Output path, where the reshuffled netcdf time series are stored.
startdate (datetime) – Start date, from which images are read and time series are generated.
enddate (datetime) – End date, from which images are read and time series are generated.
variables (list or str or tuple) – Variables to read from the passed images and convert into time series format.
mask_seapoints (bool, optional (default: False)) – Mask points over sea, replace them with nan.
h_steps (tuple, optional (default: (0,6,12,18))) – Full hours for which images are available.
imgbuffer (int, optional (default: 50)) – How many images to read at once before writing time series. This number affects how many images are stored in memory and should be chosen according to the available amount of memory and the size of a single image.