Page tree
Skip to end of metadata
Go to start of metadata

When you download data through the ECMWF WebAPI, you specify your data in a Python script as below. Note the area and grid keywords to set a specific area and resolution.

#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()
server.retrieve({
    "class": "ea",
    "dataset": "era5",
    "date": "2016-01-01/to/2016-01-31",	# Time period
    "expver": "1",
    "levtype": "sfc",
    "param": "2t/sp",			# Parameters. Here we use 2m Temperature (2t) and Surface Pressure (sp). See the ECMWF parameter database, at http://apps.ecmwf.int/codes/grib/param-db
    "stream": "oper",
	"type": "an",
    "time": "00:00:00",
    "step": "0",
    "area": "75/-20/10/60",  	# Subset or clip to an area, here to Europe. Specify as North/West/South/East in Geographic lat/long degrees. Southern latitudes and Western longitudes must be given as negative numbers.
	"grid": "0.25/0.25",		# Regrid from the default grid to a regular lat/lon with specified resolution. The first number is east-west resolution (longitude) and the second is north-south (latitude).
	"format": "netcdf",  		# Convert the output file from the default GRIB format to NetCDF format. Requires "grid" to be set to a regular lat/lon grid.
	"target": "CHANGEME.nc",	# The output file name. Set this to whatever you like.
})


The "area" keyword only works with regular lat/lon grids. So if you use the "area" keyword, you also have to set "grid":"<x>/<y>".

The "area" can span across the antimeridian (+/-180 degrees). Think of the East coordinate as 'Start longitude of study area, going from E to W' and the West coordinate as 'End longitude of study area'. For example, to specify the North Pacific set "area": "90/140/0/-120" (N/W/S/E). This works for both the GRIB and NetCDF format.


"format": "netcdf" only works with regular lat/lon grids. So if you set "format": "netcdf", you also have to set "grid":"<x>/<y>".


For additional options see Brief MARS request syntax, and for all (90+) keywords see MARS keywords.


See also: Does downloading data at higher resolution improve the output?