Working with Weather Data

Learn how to access current, forecast, and historical weather data for your areas of interest.

Prerequisites: Before starting this tutorial, make sure you have:
  • An ObservEarth API key
  • Created at least one Area of Interest (AOI)
If you haven't done these steps yet, check out our Authentication and Areas of Interest tutorials first.

Getting Current Weather

Current Weather Conditions

To get current weather conditions for your area of interest:

API Type
GET
Endpoint
https://observearth.com/api/weather/current/
Query Parameters
Parameter Type Required Description
geometry_id UUID Yes UUID of your Area of Interest
Response Parameters
Parameter Unit Description
temperature °C Current air temperature
relative_humidity % Percentage of moisture in the air
apparent_temperature °C How the temperature feels (heat index/wind chill)
precipitation mm Total precipitation amount
rain mm Rain amount
cloud_cover % Percentage of sky covered by clouds
surface_pressure hPa Atmospheric pressure at surface level
wind_speed km/h Speed of wind
wind_gusts km/h Speed of wind gusts
apparent_temperature_max °C Maximum apparent temperature for the day
apparent_temperature_min °C Minimum apparent temperature for the day
sunrise iso8601 Time of sunrise
sunset iso8601 Time of sunset
uv_index_max Maximum UV index for the day
et0_fao_evapotranspiration mm Reference evapotranspiration
Code Example
import requests

api_key = "your_api_key_here"
geometry_id = "123e4567-e89b-12d3-a456-426614174000"

url = f"https://observearth.com/api/weather/current/?geometry_id={geometry_id}"

headers = {
    "X-API-Key": api_key
}

response = requests.get(url, headers=headers)
data = response.json()

print(f"Temperature: {data['temperature']}°C")
print(f"Precipitation: {data['precipitation']} mm")
print(f"Humidity: {data['humidity']}%")
print(f"Wind: {data['wind_speed']} m/s, {data['wind_direction']}°")

Weather Forecasts

16-Day Weather Forecast

To get a 16-day weather forecast for your area of interest:

API Type
GET
Endpoint
https://observearth.com/api/weather/forecast/

[Image: 7-day temperature forecast chart]

7-day temperature forecast visualization.

[Image: 7-day precipitation forecast chart]

7-day precipitation forecast visualization.

Query Parameters
Parameter Type Required Description
geometry_id UUID Yes UUID of your Area of Interest
Response Parameters
Parameter Unit Description
temp_max °C Maximum temperature
temp_min °C Minimum temperature
temp_mean °C Mean temperature
relative_humidity % Percentage of moisture in the air
precipitation mm Total precipitation amount
rain mm Rain amount
surface_pressure hPa Atmospheric pressure at surface level
cloud_cover % Percentage of sky covered by clouds
evapotranspiration mm Evapotranspiration amount
wind_speed km/h Speed of wind
wind_gusts km/h Speed of wind gusts

Historical Weather Data

Accessing Historical Weather

Historical weather data is valuable for understanding past conditions and trends:

API Type
GET
Endpoint
https://observearth.com/api/weather/historical/
Query Parameters
Parameter Type Required Description
geometry_id UUID Yes UUID of your Area of Interest
start_date string Yes Start date in YYYY-MM-DD format
end_date string Yes End date in YYYY-MM-DD format
Response Parameters
Parameter Unit Description
temp_max °C Maximum temperature
temp_min °C Minimum temperature
temp_mean °C Mean temperature
relative_humidity % Percentage of moisture in the air
precipitation mm Total precipitation amount
rain mm Rain amount
surface_pressure hPa Atmospheric pressure at surface level
cloud_cover % Percentage of sky covered by clouds
evapotranspiration mm Evapotranspiration amount
wind_speed km/h Speed of wind
wind_gusts km/h Speed of wind gusts

Next Steps

Now that you understand how to work with weather data, you can: