ecmwf

ecmwf(; filename="", cb::Bool=false, dataset="", params::AbstractString="", key::String="",
          url::String="", region="", format="netcdf", dryrun::Bool=false, verbose::Bool=true)

Retrieves data from the Climate Data Store CDS service.


    ecmwf(:forecast; levlist="", kw...)

Download forecast datasets or just some variables from the ECMWF. (see man after that of first mode)


Get ERA5 data from the Copernicus Climate Change Service (C3S) Climate Data Store (CDS) using the CDS API.

Credits

This function is based in part on bits of CDSAPI.jl but doesn’t require any of the dependencies of that package.

Examples

# Copy the following code by selecting it and pressing Ctrl-C

{"product_type": ["reanalysis"],
    "variable": [
        "10m_u_component_of_wind",
        "10m_v_component_of_wind"
    ],
    "year": ["2024"],
    "month": ["12"],
    "day": ["06"],
    "time": ["16:00"],
    "data_format": "netcdf",
    "download_format": "unarchived",
    "area": [58, 6, 55, 9]
}

# Now call the function but WARNING: DO NOT COPY_PASTE it as it would replace the clipboard contents
ecmwf(dataset="reanalysis-era5-single-levels", cb=true)

Let’s dare and build the request ourselves

var = era5vars(["t2m", "skt"])          # "t2m" is the 2m temperature and "skt" is the skin temperature
datetime = era5time(hour=10:14);
ecmwf(dataset="reanalysis-era5-land", params=[var, datetime], region=(-10, 0, 30, 45))
ecmwf(:forecast; levlist=““, kw…)
Download forecast data
### Kwargs - cube: If true [the default], when downloading pressure levels variables, save them data as a netCDF 3D cubes instead of one file per layer (when cube=false).
- date: The date to select. It can be a string to select a unique date, a DateTime object, or a Int. Where the Int is the number of days to go back from today. If the Int is greater than 3, an error is raised. If the date is a string, it must be in the form YYYYMMDD or YYYY-MM-DD.
- dryrun: Print the URL of the requested data and return without trying to download anything.
- format: The format in which to save the downloaded data. It can be “grib” or “netcdf”. Default is “netcdf”.
- levlist: The pressure levels to select. It can be a string to select a unique pressure level, or a vector of strings or Ints to select multiple pressure levels.
- model: A string with the model to select. Either “ifs” or “aifs”. Default is “ifs”.
- param, variable, var, vars: The variable(s) to select. It can be a string to select a unique variable, or a vector of strings or Ints to select multiple variables. When variable(s) is requested, we download only those variables as separate files. The names of those files are the same as the variable names with the .grib2 extension. NOTE: Not specifying a variable will download the entire forecast grib file for each forecast step selected with the step option.
- R or region or limits : – limits=(xmin, xmax, ymin, ymax) | limits=(BB=(xmin, xmax, ymin, ymax),) | limits=(LLUR=(xmin, xmax, ymin, ymax),units=“unit”) | …more
Specify the region of interest. More at limits. For perspective view view, optionally add zmin,zmax. This option may be used to indicate the range used for the 3-D axes. You may ask for a larger w/e/s/n region to have more room between the image and the axes.
- root: The root URL of the CDS ERA5 dataset. Default is “https://data.ecmwf.int/forecasts”.
- step: An Int with the forecast step to select.
- stream: The stream to select. It can be one of: “oper”, “enfo”, “waef”, “wave”, “scda”, “scwv”, “mmsf”. Default is “oper”.
- time: The time in hours to select. It can be a string a Time object, or a Int. What ever it is, it will floored to 0, 6, 12 or 18. The default is the current hour.
- stream: A string with the stream to select, it must be one of: “oper”, “enfo”, “waef”, “wave”, “scda”, “scwv”, “mmsf”. Default is “oper”.
- type: A string with the type of forecast to select, it must be one of: “fc”, “ef”, “ep”, “tf”. Default is “fc”.
Example

Get the latest 10m wind and 2m temperature forecast for the region of North Atlantic.

ecmwf(:forecast, var=["10u", "10v", "2t"], R="IHO23")

Get the 1000, 925 and 850 hPa temperature forecast for the Portugal region. Result is saved in a 3D netCDF file.

ecmwf(:forecast, var="t", R="PTC", levlist=["1000", "925", "850"])

The same as above but now we request 5 time steps of the Temperature at the 1000 hPa level.

ecmwf(:forecast, var="t", R="PTC", steps=0:3:12)

See Also

weather, era5vars, era5time, listecmwfvars

Source Code

This function has multiple methods: