Observation values converted to match units?

When retrieving the most recent observation from a station using:

https://swd.weatherflow.com/swd/rest/observations/station/[your_station_id]?token=[your_access_token]

Do the observation values correspond to the units of measure as reported in the station_units?

  "station_units": {
    "units_direction": "degrees",
    "units_distance": "mi",
    "units_other": "imperial",
    "units_precip": "in",
    "units_pressure": "inhg",
    "units_temp": "f",
    "units_wind": "kts"
  },
  "obs": [
    {
      ...
      "wind_avg": 1,
      "wind_chill": -2.3,
      "wind_direction": 323,
      "wind_gust": 1.8,
      "wind_lull": 0.3
    }
  ]

For example, if I’m creating an application that uses the WeatherFlow Tempest API, do I need to handle the conversion of observation values if say a given station’s "units_wind": was set to "kts" vice "mps"?

If I’m making the call like this:

        const response = await axios.get(
            'https://swd.weatherflow.com/swd/rest/better_forecast', {
                headers: {
                    Authorization: `Bearer ${token}`,
                },
                params: {
                    station_id: stationId,
                    units_temp: 'f',
                    units_wind: 'mps',
                    units_pressure: 'inhg',
                    units_precip: 'in',
                    units_distance: 'mi'
                }
            }
        );

And the units defined in params: do not match the units of the station as set in the app/web interface, will the obs values returned match the station’s setting or those designated on the params: block?

all the parameters stored are in SI units. You’ll have to convert them yourself.

2 Likes

I ran a test using Tempest API Explorer, and found that if params are passed in the request then the current conditions values are returned already converted from the default.

For example, "units_temp"="c" returns "air_temperature": -2, as expected.

Whereas, "units_temp"="f"correctly returns "air_temperature": 28, as anticipated.

https: //swd.weatherflow.com/swd/rest/better_forecast?station_id=163880&units_temp=c&units_wind=kts&units_pressure=mb&units_precip=cm&units_distance=km&token=XXXX
{
    "current_conditions":
    {
        "air_density": 1.31,
        "air_temperature": -2,
        "brightness": 2,
        "conditions": "Partly Cloudy",
        "delta_t": 2,
        "dew_point": -6,
        "feels_like": -2,
        "icon": "partly-cloudy-night",
        "is_precip_local_day_rain_check": true,
        "is_precip_local_yesterday_rain_check": true,
        "lightning_strike_count_last_1hr": 0,
        "lightning_strike_count_last_3hr": 0,
        "precip_accum_local_day": 0,
        "precip_accum_local_yesterday": 0,
        "precip_minutes_local_day": 0,
        "precip_minutes_local_yesterday": 0,
        "precip_probability": 0,
        "pressure_trend": "rising",
        "relative_humidity": 72,
        "sea_level_pressure": 1019.2,
        "solar_radiation": 0,
        "station_pressure": 1018.3,
        "time": 1737156173,
        "uv": 0,
        "wet_bulb_globe_temperature": 3,
        "wet_bulb_temperature": -4,
        "wind_avg": 1,
        "wind_direction": 227,
        "wind_direction_cardinal": "SW",
        "wind_gust": 3
    },
    "forecast":
    {},
    "latitude": 42.21053,
    "location_name": "Sand Hills Beach, Scituate MA",
    "longitude": -70.73138,
    "source_id_conditions": 5,
    "station":
    {
        "agl": 3.048,
        "elevation": 4.615411281585693,
        "is_station_online": true,
        "state": 1,
        "station_id": 163880
    },
    "status":
    {
        "status_code": 0,
        "status_message": "SUCCESS"
    },
    "timezone": "America/New_York",
    "timezone_offset_minutes": -300,
    "units":
    {
        "units_air_density": "kg/m3",
        "units_brightness": "lux",
        "units_distance": "km",
        "units_other": "metric",
        "units_precip": "cm",
        "units_pressure": "mb",
        "units_solar_radiation": "w/m2",
        "units_temp": "c",
        "units_wind": "kts"
    }
}
https: //swd.weatherflow.com/swd/rest/better_forecast?station_id=163880&units_temp=f&units_wind=mph&units_pressure=inhg&units_precip=in&units_distance=mi&token=XXXX
{
    "current_conditions":
    {
        "air_density": 1.31,
        "air_temperature": 28,
        "brightness": 2,
        "conditions": "Partly Cloudy",
        "delta_t": 4,
        "dew_point": 21,
        "feels_like": 28,
        "icon": "partly-cloudy-night",
        "is_precip_local_day_rain_check": true,
        "is_precip_local_yesterday_rain_check": true,
        "lightning_strike_count_last_1hr": 0,
        "lightning_strike_count_last_3hr": 0,
        "precip_accum_local_day": 0,
        "precip_accum_local_yesterday": 0,
        "precip_minutes_local_day": 0,
        "precip_minutes_local_yesterday": 0,
        "precip_probability": 0,
        "pressure_trend": "rising",
        "relative_humidity": 73,
        "sea_level_pressure": 30.097,
        "solar_radiation": 0,
        "station_pressure": 30.071,
        "time": 1737155513,
        "uv": 0,
        "wet_bulb_globe_temperature": 37,
        "wet_bulb_temperature": 25,
        "wind_avg": 1,
        "wind_direction": 225,
        "wind_direction_cardinal": "SW",
        "wind_gust": 2
    },
    "forecast":
    {},
    "latitude": 42.21053,
    "location_name": "Sand Hills Beach, Scituate MA",
    "longitude": -70.73138,
    "source_id_conditions": 5,
    "station":
    {
        "agl": 3.048,
        "elevation": 4.615411281585693,
        "is_station_online": true,
        "state": 1,
        "station_id": 163880
    },
    "status":
    {
        "status_code": 0,
        "status_message": "SUCCESS"
    },
    "timezone": "America/New_York",
    "timezone_offset_minutes": -300,
    "units":
    {
        "units_air_density": "kg/m3",
        "units_brightness": "lux",
        "units_distance": "mi",
        "units_other": "metric",
        "units_precip": "in",
        "units_pressure": "inhg",
        "units_solar_radiation": "w/m2",
        "units_temp": "f",
        "units_wind": "mph"
    }
}

Note calling .../rest/better_forecast? returns a "current_conditions" object while .../rest/observations/... an "obs" object. The values of "obs" data do not seem to align with the station’s settings. For example, "units_temp": "f", returns "air_temperature": -3.3, and would need conversion to from celsius to fahrenheit as @sunny noted, if required.

https://swd.weatherflow.com/swd/rest/observations/station/163880?token=XXXX
{
  "status": {
    "status_code": 0,
    "status_message": "SUCCESS"
  },
  "elevation": 4.615411281585693,
  "is_public": true,
  "latitude": 42.21053,
  "longitude": -70.73138,
  "obs": [
    {
      "air_density": 1.31612,
      "air_temperature": -3.3,
      "barometric_pressure": 1019.5,
      "brightness": 2,
      "delta_t": 1.2,
      "dew_point": -7.3,
      "feels_like": -3.3,
      "heat_index": -3.3,
      "lightning_strike_count": 0,
      "lightning_strike_count_last_1hr": 0,
      "lightning_strike_count_last_3hr": 0,
      "precip": 0,
      "precip_accum_last_1hr": 0,
      "precip_accum_local_day": 0,
      "precip_accum_local_day_final": 0,
      "precip_accum_local_yesterday": 0,
      "precip_accum_local_yesterday_final": 0,
      "precip_analysis_type_yesterday": 0,
      "precip_minutes_local_day": 0,
      "precip_minutes_local_yesterday": 0,
      "precip_minutes_local_yesterday_final": 0,
      "pressure_trend": "rising",
      "relative_humidity": 74,
      "sea_level_pressure": 1020.4,
      "solar_radiation": 0,
      "station_pressure": 1019.5,
      "timestamp": 1737166850,
      "uv": 0,
      "wet_bulb_globe_temperature": -4.1,
      "wet_bulb_temperature": -4.5,
      "wind_avg": 1,
      "wind_chill": -3.3,
      "wind_direction": 207,
      "wind_gust": 1.5,
      "wind_lull": 0.6
    }
  ],
  "outdoor_keys": [
    "timestamp",
    "air_temperature",
    "barometric_pressure",
    "station_pressure",
    "pressure_trend",
    "sea_level_pressure",
    "relative_humidity",
    "precip",
    "precip_accum_last_1hr",
    "precip_accum_local_day",
    "precip_accum_local_day_final",
    "precip_accum_local_yesterday_final",
    "precip_minutes_local_day",
    "precip_minutes_local_yesterday_final",
    "wind_avg",
    "wind_direction",
    "wind_gust",
    "wind_lull",
    "solar_radiation",
    "uv",
    "brightness",
    "lightning_strike_count",
    "lightning_strike_count_last_1hr",
    "lightning_strike_count_last_3hr",
    "feels_like",
    "heat_index",
    "wind_chill",
    "dew_point",
    "wet_bulb_temperature",
    "wet_bulb_globe_temperature",
    "delta_t",
    "air_density"
  ],
  "public_name": "Marion Rd",
  "station_id": 163880,
  "station_name": "Sand Hills Beach, Scituate MA",
  "station_units": {
    "units_direction": "degrees",
    "units_distance": "km",
    "units_other": "metric",
    "units_precip": "in",
    "units_pressure": "inhg",
    "units_temp": "f",
    "units_wind": "mph"
  },
  "timezone": "America/New_York"
}

My takeaway is that it matters which method ( .../rest/better_forecast? : "current_conditions" object, or .../rest/observations/... : "obs") is chosen to interact with the API, with one incurring the burden of manual conversion to desired units.

2 Likes