The weather compasses and weather graphs on this website that show weather readings from the CSS weather stations, along with forecast data from NWS, are driven by simple APIs (application programming interface) that anyone can use. All data that is used behind the scenes and delivered via these APIs are JSON format, making it very easy to consume by standard web technologies.
There are only 2 API endpoints – one that returns only the latest readings (this drives the weather compasses), and another that returns all readings for a date (this drives the graphs).
Property names that are returned in the endpoints below are described as follows (names are very short to keep the size of data transmitted low):
- dt: Date/time of the record.
- w: Wind speed (in mph).
- dir or d: Wind direction (in degrees).
- f: Temperature (in F).
- ajxShowOffline/crsShowOffline/marShowOffline: Should the “offline” message be displayed on the weather graph? Only when data is returned for the current day, if the most recent reading is more than an hour old, this value will be true for that station.
- on: Is the station online? (opposite of the previous property regarding station status). This is used for the weather compasses.
Data from these endpoints should be fetched no more than once per 5 minute period. Data is retrieved from the weather stations once per minute. Exceeding this limit may cause your application or IP to be automatically blocked by the web host.
Weather Compass Endpoint
The number after the “=” should be randomly generated (this prevents caching of the request, which would potentially return old results). In this case, that number is the current Epoch time.
Weather Graph Endpoint
This endpoint will return different results depending on what parameters are passed to it.
The first is with no parameters – this returns data for all stations for the current day, in addition to the forecast data for those locations for the current day. This endpoint also includes a random number (Epoch again) to ensure that the results are not cached.
A “date” querystring parameter can be added to return data from a day other than the current day. Dates in the past will return weather station data only for that day, and dates in the future will return NWS forecast data only for that day. Dates should use the following format: YYYYMMDD.
“date” and “location” can be included to return data for a specific station/location for a specific date. Allowed values for “location” are “crs” for Crestline, “mar” for Marshall, and “ajx” for AJX.