The Mudcat Café TM
Thread #171976   Message #4178195
Posted By: Jon Freeman
01-Aug-23 - 07:04 AM
Thread Name: DECLUTTER * Health/Home Ecologic-Innovation *2023
Subject: RE: DECLUTTER * Health/Home Ecologic-Innovation *2023
SRS, I don’t think I’d be functioning at all in your heat!

Thanks for the idea. It isn’t quite what I was thinking of but it was only a curiosity question from me.

As for my solution I mentioned, it took me a while to write but I thought that if I was to do all the 119 met office files was probably worth it (plus it gave me something to do). After doing a few input files (which took under 1 second each to process), I realised that would land me with with loads of csv files and database tables so. I revised my thinking so I'd just put all the met data into one table. It’s easy enough for me to extract what I want from there. Eg if I wanted all max temp data for UK region from 2000 on, I could use (I wouldn't type it every time I’d save this for reuse and modification or alternatively write it as a stored procedure so I'd just need to supply Dataset and Region names and year):

SELECT `year`, jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, `dec`
FROM Hot JOIN Dataset ON Dataset.DatasetID = Hot.DatasetID JOIN Region ON Region.RegionID = Hot.regionid
WHERE DatasetName = 'Max Temp' AND RegionName = 'UK'
AND `year` >= 2000

Using dbeaver, exporting a csv for a spreadsheet to open is only a couple of clicks away. dbeaver also exports html and I’ve put the output of that query here.

Mid posting, I decided to write a stored procedure so I'd now just need:
CALL selectdata("UK", "Max Temp", 2000, 2023)