Advertisements

In an effort to allow other websites and providers to use our weather data (since there is no official station in town) we are developing an API with a variety of formats.

XML

The XML format can easily be parsed in PHP and combined with CSS to allow weather stats to be displayed on a website.

<?xml version="1.0"?>
<weather>
  <station>
    <name>Castle Rock CO Weather</name>
    <location>Castle Rock</location>
    <latitude>39.4166</latitude>
    <longitude>-104.9014</longitude>
    <model>Davis Vantage Vue</model>
  </station>
  <units>
    <temperature_units>F</temperature_units>
    <pressure_units>inhg</pressure_units>
    <wind_speed_units>mph</wind_speed_units>
    <precipitation_units>in</precipitation_units>
    <solar_radiation_units>W/m2</solar_radiation_units>
  </units>
  <current_conditions>
    <UNIX_timestamp>1488818073</UNIX_timestamp>
    <local_time>Mar 6, 2017 09:34</local_time>
    <date_time>2017-03-06T09:34:33-07:00</date_time>
    <rfc_time>Mon, 06 Mar 2017 09:34:33 -0700</rfc_time>
    <temperature>32.3</temperature>
    <relative_humidity>44.0</relative_humidity>
    <pressure>29.80</pressure>
    <wind_speed>4.3</wind_speed>
    <wind_gust>9.9</wind_gust>
    <apparent_temperature>24.3</apparent_temperature>
    <dewpoint>12.6</dewpoint>
    <rain_rate>0.00</rain_rate>
    <bearing_degrees>107.0</bearing_degrees>
    <wind_direction>ESE</wind_direction>
  </current_conditions>
  <today>
    <date>2017-03-06</date>
    <temperature_average>41.47</temperature_average>
    <temperature_max>49.1</temperature_max>
    <temperature_min>27.4</temperature_min>
    <humidity_average>40.53</humidity_average>
    <humidity_max>86.5</humidity_max>
    <humidity_min>25.0</humidity_min>
    <pressure_average>29.641</pressure_average>
    <pressure_max>29.80</pressure_max>
    <pressure_min>29.58</pressure_min>
    <dewpoint_average>17.56</dewpoint_average>
    <dewpoint_max>25.6</dewpoint_max>
    <dewpoint_min>10.8</dewpoint_min>
    <apparent_temperature_average>34.01</apparent_temperature_average>
    <apparent_temperature_max>41.4</apparent_temperature_max>
    <apparent_temperature_min>20.5</apparent_temperature_min>
    <wind_speed_average>4.05</wind_speed_average>
    <wind_gust_max>9.9</wind_gust_max>
    <precipitation>0.00</precipitation>
    <rain_rate_max>0.00</rain_rate_max>
  </today>
</weather>

 

JSON

JSON is a format that is easily readable by humans and easily parsed by machines. The format allows for use in PHP or Javascript modules and combined with CSS can allow for dashboards, graphs and other graphic displays to show weather data.

{"station":{"name":"Castle Rock CO Weather",
"location":"Castle Rock",
"latitude":39.4166,
"longitude":-104.9014,
"model":"Davis Vantage Vue"},

"units":{"temperature_units":"F",
"pressure_units":"inhg",
"wind_speed_units":"mph",
"precipitation_units":"in",
"solar_radiation_units":"W\/m2"},

"current_conditions":{"UNIX_timestamp":1488818373,
"local_time":"Mar 6, 2017 09:39",
"date_time":"2017-03-06T09:39:33-07:00",
"rfc_time":"Mon, 06 Mar 2017 09:39:33 -0700",
"temperature":32.5,
"relative_humidity":43.5,
"pressure":29.8,
"wind_speed":3.2,
"wind_gust":1.2,
"apparent_temperature":25.1,
"dewpoint":12.5,
"rain_rate":0,
"bearing_degrees":102,
"wind_direction":"ESE"},
}

 

Stay tuned for details on this exciting new project!