https://github.com/titaniumbones/gauge-parsers
Small js library for parsing river gauges in Ontario
https://github.com/titaniumbones/gauge-parsers
Last synced: 10 months ago
JSON representation
Small js library for parsing river gauges in Ontario
- Host: GitHub
- URL: https://github.com/titaniumbones/gauge-parsers
- Owner: titaniumbones
- Created: 2019-12-04T23:07:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-17T17:25:53.000Z (over 6 years ago)
- Last Synced: 2025-08-04T08:56:34.716Z (11 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* River Gauge Client
This is a small library to fetch and parse API responses from river gauges in Ontario. The library provides the following:
- a *dictionary* that matches river gauge types to parsing functions. So far the only ones I know about are [[https://wateroffice.ec.gc.ca/report/real_time_e.html?stn=02HB029&mode=Graph][Ontario Water Offic Gauges]], [[https://apps.grandriver.ca/waterdata/kiwischarts/rf_uppergrand.aspx][Grand River conservation Area Gauges]], and [[https://cvc.ca/watershed-science/watershed-monitoring/real-time-monitoring/west-credit-river-belfountain-conservation-area/][Credit Valley conservation Cauges]]. GRCA and CVC gauges both use the WISKI/KIWIS/KISTER water gauge data management platform, so their data sources are providedi ithe same format. Wateroffice has a very similar but nonidentical format. CVC and GRCA unfortunately use distinct URL construction patterns.
- *get* and *parse* functions that *retrieve* and *process* API responses form the various endpoints and prepare them to be fed to a [[https://chartist-js.org][Chartist chart]]. These should take
This should be as self-contained as possible, and each parser function should be a stable interface that provides datain a predictable format that chartist can use; should also be possible to meet the needs of other chart construction libraries, e.g. D3
Lots of TODOs here:
- [ ] find more online gauges! I only have a small percentage of runnable rivers here. Check Boatwerks, and also these suggestions:
- [ ] Cataract section of credit river
- [ ] Humber River (find the gauge)
- [ ] Moira
- [ ] Claireville (??)
- [ ] Hockley Valley (?)
- [ ] Upper Black (??)
- [ ] Skootamatta
- [ ] Beaver
- [ ] Ottawa River
- [ ] determine which of these gauges provide historical data in a different format from the real-time data, and figure out how to manage it. e.g., wateroffice appears to store ~2 years of data in the json endpoint, after which it is available only in CSV format from a separate endpoint
- [ ] Figure out how to display auxiliary data simultaneously -- e.g., mean/median data from water office, rainfall data from CVC.
- [ ] Similarly: is there a way to capture rainfall info using other data sources, and add that in somehow? That last is a big ask. But it should be possible to either link to windy for forecasts or to another service for historical data. e.g., raw data for Ontario is [[https://climate.weather.gc.ca/historical_data/search_historic_data_stations_e.html?searchType=stnProv&timeframe=1&lstProvince=ON&optLimit=yearRange&StartYear=2016&EndYear=2019&Year=2019&Month=12&Day=3&selRowPerPage=100][available at this endpoint]], while [[https://climate.weather.gc.ca/radar/index_e.html?site=CASKR&year=2019&month=12&day=1&hour=00&minute=10&duration=2&image_type=PRECIPET_SNOW_WEATHEROFFICE][RADAR images can be picked up here]]. Links should be easy, I think. The images themselves are available at URLs like https://climate.weather.gc.ca/radar/image_e.html?time=201612011840&site=CASKR&image_type=PRECIPET_SNOW_WEATHEROFFICE, where the time value is ~YYYYMMDDHHmm~ in *UTC*
- [ ] correcting for time zone also important. I haven't inspected the data yet to be sure it's corrected for time zone.
* Code
I've moved the code out of this README into a standalone js file -- too much hassle w/ lsp etc to stick with the literate programming mode.
#+NAME: gaugeparser