module TopoPyScale.fetch_era5
Retrieve ecmwf data with cdsapi.
- J. Fiddes, Origin implementation
- S. Filhol adapted in 2021
Global Variables
- var_surf_name_google
- var_plev_name_google
function fetch_era5_google_from_zarr
fetch_era5_google_from_zarr(
eraDir,
startDate,
endDate,
lonW,
latS,
lonE,
latN,
plevels,
bucket='gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3'
)
Function to download data from Zarr repository on Google Cloud Storage (https://github.com/google-research/arco-era5/tree/main)
function fetch_era5_google
fetch_era5_google(
eraDir,
startDate,
endDate,
lonW,
latS,
lonE,
latN,
plevels,
step='3H',
num_threads=1
)
function retrieve_era5
retrieve_era5(
product,
startDate,
endDate,
eraDir,
latN,
latS,
lonE,
lonW,
step,
num_threads=10,
surf_plev='surf',
plevels=None,
realtime=False,
output_format='netcdf',
download_format='unarchived',
new_CDS_API=True
)
Sets up era5 surface retrieval. * Creates list of year/month pairs to iterate through. * MARS retrievals are most efficient when subset by time. * Identifies preexisting downloads if restarted. * Calls api using parallel function.
Args:
product: "reanalysis" (HRES) or "ensemble_members" (EDA) startDate: endDate:eraDir: directory to write outputlatN: north latitude of bboxlatS: south latitude of bboxlonE: easterly lon of bboxlonW: westerly lon of bboxstep: timestep to use: 1, 3, 6num_threads: number of threads to use for downloading datasurf_plev: download surface single level or pressure level product: 'surf' or 'plev'output_format(str): default is "netcdf", can be "grib".download_format(str): default "unarchived". Can be "zip"new_CDS_API: flag to handle new formating of SURF files with the new CDS API (2024).
Returns: Monthly era surface files stored in disk.
function era5_request_surf
era5_request_surf(
dataset,
year,
month,
day,
bbox,
target,
product,
time,
output_format='netcdf',
download_format='unarchived'
)
CDS surface api call
Args:
dataset(str): copernicus dataset (era5)year(str or list): year of interestmonth(str or list): month of interestbbox(list): bonding box in lat-lontarget(str): filenameproduct(str): type of model run. defaul: reanalysistime(str or list): hours for which to download dataoutput_format(str): default is "netcdf", can be "grib".download_format(str): default "unarchived". Can be "zip"
Returns: Store to disk dataset as indicated
function era5_request_plev
era5_request_plev(
dataset,
year,
month,
day,
bbox,
target,
product,
time,
plevels,
output_format='netcdf',
download_format='unarchived'
)
CDS plevel api call
Args:
dataset(str): copernicus dataset (era5)year(str or list): year of interestmonth(str or list): month of interestbbox(list): bonding box in lat-lontarget(str): filenameproduct(str): type of model run. defaul: reanalysistime(str or list): hours to queryplevels(str or list): pressure levels to queryoutput_format(str): default is "netcdf", can be "grib".download_format(str): default "unarchived". Can be "zip"
Returns: Store to disk dataset as indicated
function era5_realtime_surf
function era5_realtime_plev
function return_last_fullday
TODO: NEED docstring and explanation
function grib2netcdf
Function to convert grib file to netcdf
Args:
gribname: filename fo grib file to convert
function process_SURF_file
Function to unpack and repack as NETCDF data sent by the new CDS API, which sends a ZIP file as NETCDF file.
Args:
wdir: path of era5 data. Typically in TopoPyScale project it will be at: ./inputs/climate
function remap_CDSbeta
Remapping of variable names from CDS beta to CDS legacy standard.
Args:
wdir: path of era5 data. Typically in TopoPyScale project it will be at: ./inputs/climate
function era5_request_surf_snowmapper
CDS surface api call
Args:
dataset(str): copernicus dataset (era5)today(datetime object): day to downloadtarget(str): filenameproduct(str): type of model run. defaul: reanalysistime(str or list): hours for which to download dataformat(str): "grib" or "netcdf"
Returns: Store to disk dataset as indicated
function era5_request_plev_snowmapper
era5_request_plev_snowmapper(
today,
latN,
latS,
lonE,
lonW,
eraDir,
plevels,
output_format='netcdf'
)
CDS plevel api call
Args:
dataset(str): copernicus dataset (era5)year(str or list): year of interestmonth(str or list): month of interestbbox(list): bonding box in lat-lontarget(str): filenameproduct(str): type of model run. defaul: reanalysistime(str or list): hours to queryplevels(str or list): pressure levels to query
Returns: Store to disk dataset as indicated
This file was automatically generated via lazydocs.