fetch_era5

‘ Retrieve ecmwf data from new CDS api.

fetch_era5.era5_request_plev(year, month, bbox, target, product, time, plevels)[source]

CDS plevel api call

fetch_era5.era5_request_surf(year, month, bbox, target, product, time)[source]

CDS surface api call

fetch_era5.eraCat(wd, grepStr)[source]

* CDO * Concats monthly era (interim or 5) files by some keyword grepStr. Depends on CDO. - reads monthly ERA5 data files (MARS efficiency) - concats to single file timeseries

Syntax: cdo -b F64 -f nc2 mergetime SURF* SURF.nc

Parameters:
  • wd – directory of era monthly datafiles
  • grepStr – “PLEV” or “SURF”

Example

wd=/home/eraDat/ grepStr= “PLEV” eraCat(“/home/joel/mnt/myserver/sim/wfj_era5/eraDat/”, “PLEV”)

fetch_era5.eraCat5d(wd, grepStr)[source]

* NCO * Updated method to deal with 5D of ensemble datasets NOT supported by CDO Concats monthly era (interim or 5) files by some keyword grepStr. Depends on NCO. sudo apt-get install nco - reads monthly ERA5 data files (MARS efficiency) - concats to single file timeseries - 2 steps

  • assign time to “record” dimeanion in firstfile
  • concat files
Parameters:
  • wd – directory of era monthly datafiles
  • grepStr – “PLEV” or “SURF”

Example

wd=/home/eraDat/ grepStr= “PLEV” eraCat(“/home/joel/mnt/myserver/sim/wfj_era5/eraDat/”, “PLEV”)

fetch_era5.retrieve_era5_plev(product, startDate, endDate, eraDir, latN, latS, lonE, lonW, step, plevels)[source]

Sets up era5 pressure level 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.

Parameters:
  • config – config object defining INI
  • eraDir – directory to write output
latN: north latitude of bbox
latS: south latitude of bbox lonE: easterly lon of bbox lonW: westerly lon of bbox
Returns:Monthly era pressure level files.
fetch_era5.retrieve_era5_surf(product, startDate, endDate, eraDir, latN, latS, lonE, lonW, step)[source]

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.

Parameters:
  • product – “reanalysis” (HRES) or “ensemble_members” (EDA)
  • startDate
  • endDate
  • eraDir – directory to write output
  • latN – north latitude of bbox
  • latS – south latitude of bbox
  • lonE – easterly lon of bbox
  • lonW – westerly lon of bbox
Returns:

Monthly era surface files.

fetch_era5.retrieve_era5_tpmm(startDate, endDate, eraDir, latN, latS, lonE, lonW)[source]

retrive monthly tp means to correct 6 or 3h TP retrieval documented era5 here: https://confluence.ecmwf.int/display/CKB/ERA5+data+documentation#ERA5datadocumentation-Monthlymeans values are mean daily for that month, weight by number of days in month eg annualtotal = sum(wfj_m*c(31,28,31,30,31,30,31,31,30,31,30,31))