Page 1 of 1
Archiving Meteo Data on Local Computer
Posted: Sun Dec 14, 2014 8:32 pm
by DaveK
I'm in the process of setting up my Meteobridge (the Ambient Weather "Weatherbridge" version), and it seems mostly straghtforward as far as linking data to a remote service such as WUG. However, since I'd like to be able to do my own analysis and presentations of my meteo data, I would like to archive it on my own computer (yes, lots of files, but I have terrabytes of unused hard drives). Yes, I could also use Meteohub, but I'm just a tiny-bit paranoid about trusting other folk to archive "my" data.
Is there a simple way to use the Push service to append my data to a local database file? Once archived into a local file, I can readily manage to slice-&-dice with a spreadsheet. I'm reluctant to try and write some kind of script to do this, since my programming skills are wretched, and I'd have to go through the pain of learning yet another programming language to do one simple set of tasks.
Any ideas out there on how to go about this? If it's already been done, could you just point me in the right direction. I did run a search of this site, but didn't find anything
Thanks in advance for any help!
Re: Archiving Meteo Data on Local Computer
Posted: Wed Dec 17, 2014 12:07 am
by bluecorn
I'm doing this via a MySQL push. This is what I'm using but it's obviously dependent on how you build your database, tables and what you decide to log.
Code: Select all
insert into meteo_log_raw (stamp,temp,hum,dew,wind_dir,wind_sp,wind_gs,rain_to,rain_rt,seapress) values (now(),[th0temp-act=F.1],[th0hum-act.1],[th0dew-act=F.1],[wind0dir-act],[wind0wind-act=mph],[wind0wind-max5=mph],[rain0total-ymax=in.2],[rain0total-dmax=in.2],[thb0seapress-act=inHg.2])
I display the resulting data here:
http://abqwx.dyndns.info/wxhistory.php
Re: Archiving Meteo Data on Local Computer
Posted: Wed Dec 17, 2014 8:13 pm
by DaveK
Thanks for that... Yes, I'm trying to make a very basic list like yours, that can be appended every few minutes. My biggest obstacle at this point is learning how to set up a MySQL database. I presume that your code snippet is the line of a script that acceps the MySQL push, then tacks that onto the end of the file.
Where do I need to look to learn enough about MySQL to be able to do this? I'm not wanting to build elaborate relational databases, just something I can export to a spreadsheet and work with that. I'm currently running Ubuntu 13.10 and using the LibreOffice spreadsheet.
Re: Archiving Meteo Data on Local Computer
Posted: Wed Dec 17, 2014 10:53 pm
by bluecorn
The code is just a single SQL statement my meteobridge uses to insert a row into my database. The table in my database (meteo_log_raw in this example) contains the fields:
stamp, temp, hum, dew, wind_dir, wind_sp, wind_gs, rain_to, rain_rt, seapress
It's a database, not a file, but It's analogous to adding a row to an Excel spreadsheet.
This is the SQL necessary to create the database (installing it and getting that far is beyond the scope of this forum but there is a ton of information on the net).
Code: Select all
-- MySQL dump 10.13 Distrib 5.5.40, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: meteobridge
-- ------------------------------------------------------
-- Server version 5.5.40-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `meteo_log_raw`
--
DROP TABLE IF EXISTS `meteo_log_raw`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `meteo_log_raw` (
`recid` int(8) NOT NULL AUTO_INCREMENT,
`stamp` datetime DEFAULT NULL,
`temp` decimal(5,2) DEFAULT NULL,
`hum` decimal(4,1) DEFAULT NULL,
`dew` decimal(4,2) DEFAULT NULL,
`wind_dir` decimal(5,2) DEFAULT NULL,
`wind_sp` decimal(5,2) DEFAULT NULL,
`wind_gs` decimal(5,2) DEFAULT NULL,
`rain_to` decimal(8,2) DEFAULT NULL,
`rain_rt` decimal(5,2) DEFAULT NULL,
`seapress` decimal(4,2) DEFAULT NULL,
PRIMARY KEY (`recid`),
UNIQUE KEY `recid` (`recid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=38145 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2014-12-17 13:52:32
Re: Archiving Meteo Data on Local Computer
Posted: Wed Dec 17, 2014 11:55 pm
by DaveK
Oy! I can see I have a learning curve to master here. At least all I really want is the single-table database and don't need to attempt a complex relational DB.
Thanks for the help here, it will get me going in the right direction.
Re: Archiving Meteo Data on Local Computer
Posted: Fri Dec 19, 2014 7:53 pm
by bluecorn
Well, technically speaking, it IS a single table but suit yourself.
Meteobridge has built-in support for pushing to a database. If you're wanting to just append a file you'll need to code something.