Sample code

An example of how to access the API using python is as follows:


import requests
import xarray as xr

GOOGLE_API_KEY = "your_API_key"
params = {
  "bbox": [
      -120,
      20,
      30,
      65,
  ],
  "aircraft_type": "A320",
  "time": "2024-04-11T03:00:00"
}
r = requests.get("https://contrails.googleapis.com/v1/grid/ef", params=params, headers={'x-goog-api-key': GOOGLE_API_KEY})
ds = xr.open_dataset(r.content)

A sample colab to query the API and plot the resulting data can be found here