Browse Source

New post: Weathered Chimo

chimo 1 year ago
Signed by: chimo GPG Key ID: 5BB4D7994908AA0D
  1. 78


@ -0,0 +1,78 @@
title: Weathered Chimo
description: ""
publishdate: 2020-04-27
categories: blog
tags: [weather]
So I haven't been on here for a while, huh? What's been happening? Not much.
A lot. I don't know. Let's take it month-by-month. I suppose it's as good
an approach as any. October was fairly standard and mostly uneventful.
November and December were probably my favourite months in a very long time.
January and February were a roller-coaster of very highs and very lows. March
and April were pretty terrible, and no, it's (mostly) not related to that
COVID-19 pandemic situation. Or at least I don't think so. All in all, I've
come to the conclusion that I'll probably never really understand people, and
I'm tired, and I'm not even sure I want to do "this" anymore.
Anyway, for the most part, I haven't touched this whole "*"
environment since my <a href="/blog/the-road-to-gtfs/">last post in
September</a>. I don't think this post is indicative of a "return to a
regular schedule". If things keep going this way, I don't think I'll have the
energy/motivation to work on it much.
So what am I doing here rambling about some random nonsense then? I found a
draft post I'd started almost a year ago, around the time I was messing with
weather data and wrote the <a
href="">Weathered Radio</a> post. I
figured I'd get it done and, who knows, maybe I'm wrong and I'll start
posting more. So let's cut the crap and get to it, shall we?
<!-- more -->
This post is very specific to the <a href="">Environment
and Climate Change Canada</a> (ECCC)'s data, so might not be very interesting
or relevant to many people, but as always, these posts are mostly about
reminding me how my own stuff works.
The recurring theme on this blog is about self-hosting the data that I'm
using. Unfortunately, I can't really go out and setup weather stations all
over the place, so next best thing is to consume external data in a way that
reduces the number of third-parties/tracking/etc.
In short, I have a small <a href="">PHP
script</a> that takes a pair of latitude/longitude coordinates, finds the
closest ECCC weather station and returns the current temperature.
This in itself isn't very interesting, but the process of collecting the
weather station data was a fun exercise (an exercise that wouldn't have been
necessary if they'd just provide an API... but hey, whatever.) It was also
the first time (or one of the few times) using PostGIS, so that was also fun.
Most of the work is done via the <a
script. It parses ECCC's "<a href="">siteList</a>" XML file, then fetches and parses each
<a href="">weather station's XML file</a> to extract its location. It then inserts the
weather station's information into the postgres database.
That's pretty much it. Pretty simple, turns out.