fmiopendata

package module
v0.0.0-...-d3098e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

README

FmiOpenData

This is a Go package that allows you to fetch data from the Finnish Meteorological Institute's (FMI) open data web service with various stored queries.

An example workflow for using this package is as follows:

  1. Create a stored query object based on what data you want to see, e.g. q := GetForecastStoredQuery()
  2. Set any query parameters, e.g. q.SetPlace("Helsinki")
  3. Get the results of that query with fmiopendata.GetQueryResult(q)
  4. Do what you want with the results

Include this package in your code with:

import (
	fmiopendata "github.com/Zabrakk/FmiOpenData"
)

Suppored stored queries

The FmiOpenData Go package supports the following stored queries:

ecmwf::forecast::surface::point::timevaluepair

ECMWF weather forecast fetched to a specific location.

fmiopendata.GetForecastStoredQuery()
fmi::forecast::silam::airquality::surface::point::timevaluepair

SILAM air quality forecast.

fmiopendata.GetAirQualityForecastStoredQuery()
fmi::observations::weather::multipointcoverage

Real time weather observations from weather stations.

fmiopendata.GetRealTimeObservationsStoredQuery()
fmi::observations::weather::daily::timevaluepair

Daily weather observations from weather stations

fmiopendata.GetDailyObservationsStoredQuery()
fmi::observations::weather::hourly::timevaluepair

Hourly weather observations from weather stations.

fmiopendata.GetHourlyObservationsStoredQuery()
fmi::forecast::wam::point::timevaluepair

Wave height forecast.

fmiopendata.GetWaveHeightForecastStoredQuery()

More information on the stored queries can be found here.

Setting query parameters

Each stored query has different query parameters associated with it that affect what data the open data web service returns. Here is a list of the parameters that the FmiOpenData package provides a setter for:

StartTime	 string
EndTime		 string
Parameters	 []string
Timestep	 int
Bbox		 string
LatLon		 string
Place 		 string
Fmisid 		 int
MaxLocations int

Note that this package does not support all of the query parameters listed on the FMI Open data WFS services page.

Explain measurements found in result data

The data provided by the FMI open data web service includes various names for measurements and forecasted values. You can find information on these using two functions provided by this package

// For observations
fmiopendata.ExplainObservationParam("rrday")
/* Shows the following
Param rrday:
Label:           Precipitation amount
Base Phenomenon: Amount of precipitation
Unit of measure: mm
*/

// For forecasts
fmiopendata.ExplainForecastParam("aqindex")

Code examples

You can find code examples on using this package in the examples directory.

Unit tests

Unit tests can be run with the following command:

go test ./...

https://en.ilmatieteenlaitos.fi/open-data-manual

https://en.ilmatieteenlaitos.fi/open-data-manual-accessing-data

https://en.ilmatieteenlaitos.fi/open-data-manual-wfs-examples-and-guidelines

https://en.ilmatieteenlaitos.fi/open-data-manual-fmi-wfs-services

http://opendata.fmi.fi/meta?observableProperty=observation

Find fmisids here: https://en.ilmatieteenlaitos.fi/observation-stations

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExplainForecastParam

func ExplainForecastParam(param string) models.ExplainedParam

This function prints out the information FMI provides on a given forecast measurement parameter, e.g., aqindex. This info is also returned in an ExplainedParam struct. Observation parameters are not supported.

func ExplainObservationParam

func ExplainObservationParam(param string) models.ExplainedParam

This function prints out the information FMI provides on a given observation measurement parameter, e.g. t2m. The info is also returned in an ExplainedParam struct. Forecast parameters are not supported.

func GetAirQualityForecastStoredQuery

func GetAirQualityForecastStoredQuery() models.StoredQuery

Returns a stored query for "fmi::forecast::silam::airquality::surface::point::timevaluepair". Supported query parameters are:

starttime
endtime
timestep
parameters
latlon
fmisid

Check https://en.ilmatieteenlaitos.fi/open-data-manual-fmi-wfs-services for more info.

func GetDailyObservationsStoredQuery

func GetDailyObservationsStoredQuery() models.StoredQuery

Returns a stored query for "fmi::observations::weather::daily::timevaluepair" Supported query parameters are:

starttime
endtime
timestep
parameters
bbox
place
fmisid
maxlocations

Check https://en.ilmatieteenlaitos.fi/open-data-manual-fmi-wfs-services for more info.

func GetForecastStoredQuery

func GetForecastStoredQuery() models.StoredQuery

Returns a stored query for "ecmwf::forecast::surface::point::timevaluepair". Supported query parameters are:

starttime
endtime
timestep
parameters
place
latlon
fmisid

Check https://en.ilmatieteenlaitos.fi/open-data-manual-fmi-wfs-services for more info.

func GetHourlyObservationsStoredQuery

func GetHourlyObservationsStoredQuery() models.StoredQuery

Returns a stored query for "fmi::observations::weather::hourly::timevaluepair" Supported query parameters are:

starttime
endtime
timestep
parameters
bbox
place
fmisid
maxlocations

Check https://en.ilmatieteenlaitos.fi/open-data-manual-fmi-wfs-services for more info.

func GetQueryResult

func GetQueryResult(query models.StoredQuery) models.AllMeasurements

Performs a GET request, based on the given StoredQuery, to FMI. Returns the data provided by the GET request in a AllMeasurements struct.

func GetRealTimeObservationsStoredQuery

func GetRealTimeObservationsStoredQuery() models.StoredQuery

Returns a stored query for "fmi::observations::weather::simple" Supported query parameters are:

starttime
endtime
timestep
parameters
bbox
place
fmisid
maxlocations

Check https://en.ilmatieteenlaitos.fi/open-data-manual-fmi-wfs-services for more info.

func GetWaveHeightForecastStoredQuery

func GetWaveHeightForecastStoredQuery() models.StoredQuery

Returns a stored query for "fmi::forecast::wam::point::timevaluepair". Supported query parameters are:

starttime
endtime
timestep
parameters
fmisid
latlon
timezone

Check https://en.ilmatieteenlaitos.fi/open-data-manual-fmi-wfs-services for more info.

Types

This section is empty.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL