Units Reference
Complete reference for units used in Spire Weather API responses.
Unit Systems¶
The API supports two unit systems:
Specify the unit system with the unit_system query parameter:
curl -X GET \
'https://api.wx.spire.com/forecast/point?lat=40.0&lon=-105.0&unit_system=us' \
-H 'spire-api-key: YOUR_API_KEY'
Temperature¶
| Variable | SI Unit | US Unit |
|---|
air_temperature | Kelvin (K) | Fahrenheit (°F) |
dew_point_temperature | Kelvin (K) | Fahrenheit (°F) |
sea_surface_temperature | Kelvin (K) | Fahrenheit (°F) |
soil_temperature | Kelvin (K) | Fahrenheit (°F) |
Conversion¶
# Kelvin to Celsius
celsius = kelvin - 273.15
# Kelvin to Fahrenheit
fahrenheit = (kelvin - 273.15) * 9/5 + 32
# Celsius to Fahrenheit
fahrenheit = celsius * 9/5 + 32
Wind¶
| Variable | SI Unit | US Unit |
|---|
wind_speed | m/s | mph |
northward_wind | m/s | mph |
eastward_wind | m/s | mph |
wind_gust | m/s | mph |
wind_direction | degrees | degrees |
Direction Convention¶
Wind direction follows meteorological convention: the direction from which the wind is blowing, measured clockwise from north.
| Direction | Degrees |
|---|
| North | 0° / 360° |
| East | 90° |
| South | 180° |
| West | 270° |
Conversion¶
# m/s to mph
mph = ms * 2.237
# m/s to knots (see glossary: Knot)
knots = ms * 1.944
# m/s to km/h
kmh = ms * 3.6
Pressure¶
| Variable | SI Unit | US Unit |
|---|
air_pressure | Pa | inHg |
sea_level_pressure | Pa | inHg |
Conversion¶
# Pa to hPa (mb) — see glossary: hPa
hpa = pa / 100
# Pa to inHg
inhg = pa * 0.0002953
Precipitation¶
| Variable | SI Unit | US Unit |
|---|
precipitation_amount | kg/m² (mm) | inches |
precipitation_rate | kg/m²/s | inches/hour |
snow_depth | m | inches |
Conversion¶
# mm to inches
inches = mm * 0.03937
# kg/m² equals mm for water
mm = kg_per_m2
Waves¶
| Variable | SI Unit | US Unit |
|---|
significant_wave_height | m | ft |
mean_wave_period | s | s |
peak_wave_period | s | s |
mean_wave_direction | degrees | degrees |
Conversion¶
# meters to feet
feet = meters * 3.281
Visibility¶
| Variable | SI Unit | US Unit |
|---|
visibility | m | miles |
Conversion¶
# meters to miles
miles = meters / 1609.34
# meters to nautical miles
nm = meters / 1852
Humidity¶
| Variable | SI Unit | US Unit |
|---|
relative_humidity | % | % |
specific_humidity | kg/kg | kg/kg |
Humidity values are the same in both unit systems.
Soil Moisture¶
| Variable | SI Unit | US Unit |
|---|
soil_moisture | m³/m³ | m³/m³ |
Soil moisture is expressed as volumetric water content (same in both systems).
Radiation¶
| Variable | SI Unit | US Unit |
|---|
shortwave_radiation | W/m² | W/m² |
longwave_radiation | W/m² | W/m² |
solar_irradiance | W/m² | W/m² |
Radiation values are the same in both unit systems.
Tides¶
| Variable | SI Unit | US Unit |
|---|
tide_height | m | ft |
CF Conventions¶
Field names follow CF Conventions. This ensures compatibility with common meteorological software and data formats.
Common CF Standard Names¶
| API Field | CF Standard Name |
|---|
air_temperature | air_temperature |
wind_speed | wind_speed |
northward_wind | northward_wind |
eastward_wind | eastward_wind |
relative_humidity | relative_humidity |
precipitation_amount | precipitation_amount |
air_pressure | air_pressure |
Python Helper Functions¶
def kelvin_to_celsius(k):
"""Convert Kelvin to Celsius."""
return k - 273.15
def kelvin_to_fahrenheit(k):
"""Convert Kelvin to Fahrenheit."""
return (k - 273.15) * 9/5 + 32
def ms_to_knots(ms):
"""Convert m/s to knots."""
return ms * 1.944
def ms_to_mph(ms):
"""Convert m/s to mph."""
return ms * 2.237
def pa_to_hpa(pa):
"""Convert Pa to hPa (millibars)."""
return pa / 100
def meters_to_feet(m):
"""Convert meters to feet."""
return m * 3.281
def wind_components_to_speed_direction(u, v):
"""Convert U/V wind components to speed and direction.
Args:
u: Eastward wind component (m/s)
v: Northward wind component (m/s)
Returns:
tuple: (speed in m/s, direction in degrees)
"""
import math
speed = math.sqrt(u**2 + v**2)
direction = (270 - math.degrees(math.atan2(v, u))) % 360
return speed, direction