Skip to content

Extraction of feature type verticalprofile throws Timedelta error #529

Description

@uandrae

What happened?

With:

from polytope.api import Client

collection = "deode"
c = Client( address="polytope-test.ecmwf.int")

request = {
    "class": "d1",
    "dataset": "on-demand-extremes-dt",
    "expver": "aagq",
    "stream": "oper",
    "date": 20230820,
    "time": "1200",
    "type": "fc",
    "levtype": "ml",
    "georef": "u033tt",
    "param": 130,
    "step": 0,
    "timespan": "none",
    "feature": {
               "type": "verticalprofile",
               "points": [[48.8,1.8]],
               "axes": "levelist",
               "range": {"start": "1", "end": "90" }
    }
}

c.retrieve("deode", request, pointer=False)

we get

2026-06-15 13:46:06 - INFO - Sending request...
{'request': 'class: d1\n'
            'dataset: on-demand-extremes-dt\n'
            'date: 20230820\n'
            'expver: aagq\n'
            'feature:\n'
            '  axes: levelist\n'
            '  points:\n'
            '  - - 48.8\n'
            '    - 1.8\n'
            '  range:\n'
            "    end: '90'\n"
            "    start: '1'\n"
            '  type: verticalprofile\n'
            'georef: u033tt\n'
            'levtype: ml\n'
            'param: 130\n'
            'step: 0\n'
            'stream: oper\n'
            "time: '1200'\n"
            'timespan: none\n'
            'type: fc\n',
 'verb': 'retrieve'}
...
2026-06-15 13:46:08 - INFO - The current status of the request is 'processing'
2026-06-15 13:46:16 - WARNING - HTTPResponseError: Polytope error
Situation: trying to download data
Description: HTTP CLIENT ERROR (400)
URL: https://polytope-test.ecmwf.int:443/api/v1/requests/f974f834-ad99-43b7-9224-ec91b6095dfe
HTTP method: GET
Request header/body contents:
{'headers': {'Authorization': 'EmailKey **********1e9c'}, 'json': None}
Expected responses: 200, 202
Received response: CLIENT ERROR (400)
Details:
Request failed with error:
Matched datasource polytope-deode

Object of type Timedelta is not JSON serializable

What are the steps to reproduce the bug?

Run the example above.

Version

0.7.6

Platform (OS and architecture)

Red Hat Enterprise Linux release 10.2 (Coughlan)

Relevant log output

Accompanying data

No response

Organisation

SMHI/UrbanAIR

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions