README.alternatives.md 2.8 KB

Since parsing the website breaks every now and then (not too often fortunately), I have been considering to change the method of data aquisition.

1

Fortunately, the FMI offers Open Data.

An example URL would look like this:
https://opendata.fmi.fi/wfs?service=WFS&request=getFeature&storedquery_id=fmi::forecast::hirlam::surface::point::multipointcoverage&place=helsinki

This seems to boil down to a list of Lat/Lon coordinates with a Unix timestamp (*): <gmlcov:positions>, and a list of forecast values for each place/timestamp row: <gml:doubleOrNilReasonTupleList>.

(*) Can be converted to something more familiar thusly: date -d @1593867600

To understand what the numbers mean, this seems to help: <om:observedProperty xlink:href="https://opendata.fmi.fi/meta?observableProperty=forecast&amp;param=GeopHeight,Temperature,Pressure,Humidity,WindDirection,WindSpeedMS,WindUMS,WindVMS,MaximumWind,WindGust,DewPoint,TotalCloudCover,WeatherSymbol3,LowCloudCover,MediumCloudCover,HighCloudCover,Precipitation1h,PrecipitationAmount,RadiationGlobalAccumulation,RadiationLWAccumulation,RadiationNetSurfaceLWAccumulation,RadiationNetSurfaceSWAccumulation,RadiationDiffuseAccumulation,LandSeaMask&amp;language=eng"/>

Of course this is mostly guesswork so far.

Caveat

AFAICS, all this data does not offer nicely formulated forecasts like "mostly cloudy with occasional showers" etc., only precise values for cloud cover, precipitation amount etc.

2

This page seems to offer a little more information:

  • we possibly want WFS services

https://opendata.fmi.fi/wfs?service=WFS&version=2.0.0&request=getFeature&storedquery_id=fmi::forecast::harmonie::surface::point::simple&place=helsinki
This one gives usable forecast data.
Also fmi::forecast::hirlam::surface::point::simple.

3

More links:
https://www.ilmatieteenlaitos.fi/tukipyynto-avoimesta-datasta
https://www.ilmatieteenlaitos.fi/avoin-data-pikaohje
https://www.ilmatieteenlaitos.fi/latauspalvelun-pikaohje
https://www.ilmatieteenlaitos.fi/kysymyksia-avoimesta-datasta

Some expanation about WeatherSymbol3: https://github.com/Meecast/meecast/blob/sailfishos/omweather-fmi-fi-stations-db/src/meego-main.cpp

4

Another approach:
sqlite3 -line fmi.fi.db 'select * from stations'| grep -iC3 espoo Download your country from here: https://download.geonames.org/export/dump/
unzip, find your location, use the first numerical value on that line as id for this command:
curl "http://m.fmi.fi/mobile/interfaces/weatherdata.php?l=en&locations=$id"

Alternatively, find your numerical location id here: https://www.geonames.org/

5

Some hints for dealing with FMI data: https://github.com/Meecast/meecast