Sample code
Stay organized with collections
Save and categorize content based on your preferences.
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
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-14 UTC."],[[["Access the Contrails API using Python with libraries like `requests` and `xarray` to retrieve contrail environmental impact data."],["Define parameters such as bounding box, aircraft type, and time to specify your API query."],["Utilize the provided Google API key and endpoint URL for authentication and data retrieval."],["Refer to the linked Google Colab notebook for a comprehensive example on querying the API and visualizing the data."]]],[]]