-
Notifications
You must be signed in to change notification settings - Fork 17
Query Formats and Conversion
Barometer allows the use of any query format for any weather service.
To do this, Barometer must detect the provided query format, determine what format the intended weather service allows, then convert from one to the other.
Below is a list of the query formats natively supported by each weather service.
| Format | barometer | wunderground (v1) | yahoo | weather bug | noaa | forecast io |
|---|---|---|---|---|---|---|
| zipcode | yes | yes | yes | yes | yes (FO) | x |
| icao | yes | yes | x | x | x | x |
| coordinates | yes | yes | x | yes | yes (FO) | yes |
| postal code | yes | yes | x | x | x | x |
| weather.com ID | yes | x | yes | x | x | x |
| woeid | yes | x | yes | x | x | x |
| geocodable location | yes | yes | x | x | x | x |
| ipv4 address | yes | x | x | x | x | x |
| noaa station id | x | x | x | x | yes (CO) | x |
- CO = Current Conditions Only
- FO = Forecast Only
So how does a query get converted from one format to another?
Barometer utilizes several services to perform the conversions. Some services can convert directly from one specific format to another specific format (1-1), several formats to one format (N-1) or one format to several formats (1-N). There are a few cases where an intermediate conversion must be made if no direct conversion is possible, but only the case when using NOAA, or multiple weather services.
If multiple weather services are configured to be used in Barometer, conversions are cached so that only the minimal number of conversions are performed to satisfy all weather services.
- No conversion
- weather_service:
wunderground_v1 - input:
zipcode - conversions:
none
- One Conversion
- weather_service:
forecast_io - input:
coordinates - conversions:
coordinates => woe_id
- Two Conversions
- weather_service:
noaa - input:
ipv4_address - conversions:
ipv4_address => geocode/coordinates => noaa_station_id