Polytope vertical profile

The following example first retrieves vertical profiles on pressure levels using polytope, then converts the resulting CoverageJSON data to Xarray.

[1]:
import earthkit.data as ekd

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": [[38.9, -9.1]],
    },
}

ds = ekd.from_source("polytope", "ecmwf-mars", request, stream=False, address='polytope.ecmwf.int')
ds.to_xarray()
2024-12-18 09:10:29 - INFO - Key read from /Users/cgr/.polytopeapirc
2024-12-18 09:10:29 - 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'}
2024-12-18 09:10:29 - INFO - Polytope user key found in session cache for user cgr
2024-12-18 09:10:30 - INFO - Request accepted. Please poll ./76f67d4d-f386-43ff-b11c-39e6ea9c404f for status
2024-12-18 09:10:30 - INFO - Polytope user key found in session cache for user cgr
2024-12-18 09:10:30 - INFO - Checking request status (./76f67d4d-f386-43ff-b11c-39e6ea9c404f)...
2024-12-18 09:10:30 - INFO - The current status of the request is 'queued'
2024-12-18 09:10:30 - INFO - The current status of the request is 'processing'
2024-12-18 09:10:33 - INFO - The current status of the request is 'processed'
[1]:
<xarray.Dataset> Size: 640B
Dimensions:   (x: 1, y: 1, number: 1, datetime: 1, t: 1, z: 22)
Coordinates:
  * x         (x) float64 8B 38.91
  * y         (y) float64 8B 350.9
  * number    (number) int64 8B 1
  * datetime  (datetime) <U20 80B '2024-12-17T00:00:00Z'
  * t         (t) int64 8B 0
  * z         (z) int64 176B 1 2 3 5 7 10 20 30 ... 400 500 600 700 850 925 1000
Data variables:
    q         (x, y, number, datetime, t, z) float64 176B 4.254e-06 ... 0.005184
    o3        (x, y, number, datetime, t, z) float64 176B 4.228e-06 ... 6.039...
Attributes:
    class:          od
    Forecast date:  2024-12-17T00:00:00Z
    domain:         g
    expver:         0001
    levelist:       1
    levtype:        pl
    number:         1
    stream:         enfo
    type:           pf
[ ]: