Polytope
  • Home
  • Installation
  • Quick Start
  • Data Portfolio

Full Fields

  • Full Fields

Features

  • Overview
  • Time Series
  • Vertical Profile
  • Polygon
  • Bounding Box
  • Trajectory
  • Circle
  • Position

Examples

  • Examples
Polytope
  • Vertical Profile Open Data Example

Vertical Profile Open Data Example¶

In [ ]:
Copied!
import earthkit.data

request = {
    "class": "ai",
    "stream" : "oper",
    "type" : "fc",
    "date" : -1,
    "time" : "0000",
    "levtype" : "pl",
    "expver" : "0001", 
    "model": "aifs-single",
    "domain" : "g",
    "param" : "130",
    "step" : "0",
    "levelist" : "0/to/1000",
    "feature": {
        "type": "verticalprofile",
        "points": [[38.9, -9.1]],
    },
}

ds = earthkit.data.from_source("polytope", "ecmwf-mars", request, stream=False, address='polytope.ecmwf.int')
import earthkit.data request = { "class": "ai", "stream" : "oper", "type" : "fc", "date" : -1, "time" : "0000", "levtype" : "pl", "expver" : "0001", "model": "aifs-single", "domain" : "g", "param" : "130", "step" : "0", "levelist" : "0/to/1000", "feature": { "type": "verticalprofile", "points": [[38.9, -9.1]], }, } ds = earthkit.data.from_source("polytope", "ecmwf-mars", request, stream=False, address='polytope.ecmwf.int')

Visualise¶

The following visualisation uses earthkit-plots.

Note: This notebook is rendered in many different ways depending on where you are viewing it (e.g. GitHub, Jupyter, readthedocs etc.). To maximise compatibility with many possible rendering methods, all interactive plots are rendered with chart.show(renderer="png"), which removes all interactivity and only shows a PNG image render.

If you are running this notebook in an interactive session yourself and would like to interact with the plots, remove the renderer="png" argument from each call to chart.show().
In [8]:
Copied!
from earthkit.plots.interactive import Chart

chart = Chart()
chart.line(ds, y="level")
chart.fig.update_layout(yaxis1={"title": "hPa"})
chart.fig.update_layout(yaxis2={"title": "hPa"})
chart.show(renderer="png")  # Replace with chart.show() in an interactive session!
from earthkit.plots.interactive import Chart chart = Chart() chart.line(ds, y="level") chart.fig.update_layout(yaxis1={"title": "hPa"}) chart.fig.update_layout(yaxis2={"title": "hPa"}) chart.show(renderer="png") # Replace with chart.show() in an interactive session!
No description has been provided for this image

Convert to Xarray¶

In [9]:
Copied!
da = ds.to_xarray()
print(da)
da = ds.to_xarray() print(da)
<xarray.Dataset> Size: 320B
Dimensions:   (x: 1, y: 1, number: 1, datetime: 1, time: 1, level: 13)
Coordinates:
  * x         (x) float64 8B 38.92
  * y         (y) float64 8B 350.9
  * number    (number) int64 8B 0
  * datetime  (datetime) <U20 80B '2025-02-24T00:00:00Z'
  * time      (time) int64 8B 0
  * level     (level) int64 104B 50 100 150 200 250 300 ... 600 700 850 925 1000
Data variables:
    t         (x, y, number, datetime, time, level) float64 104B 217.9 ... 286.2
Attributes:
    class:          ai
    Forecast date:  2025-02-24T00:00:00Z
    domain:         g
    expver:         0102
    levelist:       50
    levtype:        pl
    model:          aifs-single
    stream:         oper
    type:           fc
    number:         0
In [ ]:
Copied!


Built with MkDocs using a theme provided by Read the Docs.