CoverageJSON: retrieving vertical profiles with Polytope¶
The polytope source provides access to the Polytope web services.
The following example retrieves vertical profiles on pressure levels using polytope.
[1]:
import earthkit.data as ekd
location = [38.9, -9.1] # lat, lon
request = {
"class": "od",
"stream": "enfo",
"type": "pf",
"date": -1,
"time": "0000",
"levtype": "pl",
"expver": 1,
"domain": "g",
"param": "203/133",
"number": "1",
"step": "0",
"levelist": "1/to/1000",
"feature": {
"type": "verticalprofile",
"points": [location],
},
}
ds = ekd.from_source("polytope", "ecmwf-mars", request=request, stream=False, address="polytope.ecmwf.int")
2026-03-11 12:00:49 - INFO - Key read from /Users/cgr/.polytopeapirc
2026-03-11 12:00:49 - INFO - Sending request...
{'request': 'class: od\n'
'date: -1\n'
'domain: g\n'
'expver: 1\n'
'feature:\n'
' points:\n'
' - - 38.9\n'
' - -9.1\n'
' type: verticalprofile\n'
'levelist: 1/to/1000\n'
'levtype: pl\n'
"number: '1'\n"
'param: 203/133\n'
"step: '0'\n"
'stream: enfo\n'
"time: '0000'\n"
'type: pf\n',
'verb': 'retrieve'}
2026-03-11 12:00:49 - INFO - Polytope user key found in session cache for user cgr
2026-03-11 12:00:49 - INFO - Request accepted. Please poll ./378efd3b-6ed6-4ec9-a212-a35b8c9209d6 for status
2026-03-11 12:00:49 - INFO - Polytope user key found in session cache for user cgr
2026-03-11 12:00:49 - INFO - Checking request status (378efd3b-6ed6-4ec9-a212-a35b8c9209d6)...
2026-03-11 12:00:49 - INFO - The current status of the request is 'queued'
2026-03-11 12:00:50 - INFO - The current status of the request is 'processing'
2026-03-11 12:00:54 - INFO - The current status of the request is 'processed'
The data is retrieved as CoverageJSON, which we can convert to Xarray for further processing (the conversion uses the covjsonkit package under the hood).
[2]:
ds.to_xarray()
[2]:
<xarray.Dataset> Size: 640B
Dimensions: (latitude: 1, longitude: 1, number: 1, datetime: 1, time: 1,
levelist: 22)
Coordinates:
* latitude (latitude) float64 8B 38.91
* longitude (longitude) float64 8B 350.9
* number (number) int64 8B 1
* datetime (datetime) <U20 80B '2026-03-10T00:00:00Z'
* time (time) int64 8B 0
* levelist (levelist) int64 176B 1 2 3 5 7 10 ... 500 600 700 850 925 1000
Data variables:
q (latitude, longitude, number, datetime, time, levelist) float64 176B ...
o3 (latitude, longitude, number, datetime, time, levelist) float64 176B ...
Attributes:
class: od
Forecast date: 2026-03-10T00:00:00Z
domain: g
expver: 0001
levelist: 1
levtype: pl
number: 1
stream: enfo
type: pf[ ]: