Meteobridge and WXSIM

This document covers my setup to provide weather data gathered by meteobridge to my WXSIM instance.

Problemspace

WXSIM relies on current and historic weather data which can be fed in from different sources (like Cumulus or WeatherDispplay). Meteobridge doesn't have its own format, but can generate data through a template based system. To save space meteobridge is only holding minute-based data for maximum of two days - for older data on can only access hourly aggregated data. A related aspect is the amount of available data and Tom, the author of WXSIM , recommends at least 10-minute data to create proper forecast. Given that meteobridge stores mostly hourly data, exporting historic data isn't a real option.

It turns out that a reduced cumulus file format would do the job, since it's already supported by WXSIM and CSV generation can be achieved with the meteobridge template system.

Special case: precipitation

WXSIM is able to use local precipitation data to improve the forecast accuracy. Tom stated that the data isn't strictly necessary, but highly recommended. Unfortunately total-sums aren't available when using the iteratative template expansion, so a simple export appending the current data to the data log doesn't work.

Solution with precipitation

Right now I have a two-step setup to generate a cumulus style export file that WXSIM can read:

  1. Every 5min a one-liner of the current values is created through the HTML-Generation feature
  2. A second event (triggered by the first one) appends this file to the monthly cumulus log file

Template

#if#{*[th0hum-avg5.0:]>0*}#then#[DD]/[MM]/[YY],[hh]:[mm],[th0temp-avg5.1:],[th0hum-avg5.0:],[th0dew-avg5.1:],[wind0wind-avg5=mph.1:],[wind0wind-max5=mph.1:],[wind0dir-avg5.0:],[rain0rate-avg5.1:],[rain0total-daysum.1:],[thb0seapress-avg5.1:],[rain0total-yearsum.1:],,,,,,,[sol0rad-avg5.0:],,#else##no data - [YY][MM][DD][hh][mm] #fi#
Event to generate data export

HTML-Gen Event

Script

#!/bin/sh
#
# Script to append log lines in cumulus format to a monthly log
CUMULUS_CURRENT_FILE="/tmp/mnt/data/html/cumulus_wxsim.cur"
if [ -f "$CUMULUS_CURRENT_FILE" ]; then
    CUMULUS_MONTHLY_FILE="/tmp/mnt/data/export/`date '+%b%y'`log.txt"
    # Append current line and drop invalid lines
    CURRENT_DATA=$(cat $CUMULUS_CURRENT_FILE | grep -v "no data" | grep -v ",,,,,,,,,")
    if [[ ! -z "$CURRENT_DATA" ]]; then
      printf "$CURRENT_DATA\r\n" >> $CUMULUS_MONTHLY_FILE
    fi
    rm $CUMULUS_CURRENT_FILE
else
    echo "$CUMULUS_CURRENT_FILE doesn't exist" 
fi
exit 0

One could easily adjust the script to do some more sofisticated error handling.

Event to trigger the script

Script-Append-Event

Some additional notes

Download templates & script

Resign from using precipitaion

In case you don't have or want precipitaion data in the log files you can use a single event the append data to a monthly log

#pragma exportfile=[MMM].[YY]log.txt
#pragma append=y
#pragma emptylines=n
#pragma crlf=y
#if#{*[th0hum-avg5.0:]>0*}#then#[DD]/[MM]/[YY],[hh]:[mm],[th0temp-avg5.1:],[th0hum-avg5.0:],[th0dew-avg5.1:],[wind0wind-avg5=mph.1:],[wind0wind-max5=mph.1:],[wind0dir-avg5.0:],[rain0rate-avg5.1:],,[thb0seapress-avg5.1:],,,,,,,,[sol0rad-avg5.0:],,#else##no data - [YY][MM][DD][hh][mm] #fi#

Einheiten

Sprache



Icon


Temperatur

Luftfeuchtigkeit

Luftdruck

Windgeschwindigkeit

Windspitze

Niederschlag

Solar-Strahlung

Schnee

Gefühlte Temperatur

Taupunkt

UV

Sicht

Wolkenbasis

Evapotranspiration

Innenraumtemperatur

Innenraumfeuchtigkeit


Sonnenaufang

Sonnenuntergang

Mondaufgang

Monduntergang

Time

Menu

Von

Bis

Vollbildansicht

Als Bild exportieren

Einstellungen

Homepage

Webcam

Tabelle

Grafik

Karte

Gleichbleibend

Steigend

Fallend

Warnung

Breitengrad

Längengrad

Historie

Sonnenfinsternis

Mondfinsternis

GPS

Höhe

Tag

Monat

Jahr

Hohe Temperatur

Niedrige Temperatur

Tag

Nacht

Frühling

Sommer

Herbst

Winter