fmi_opendata_assembler: download FMI in-situ data and format the output

fmi_opendata_assemblerR Documentation

download FMI in-situ data and format the output

Description

The FMI data are downloaded by using gibson_fmi_opendata that is linked to the FMI API (data.fmi.fi).

The output is formatted and presented as a data frame where every row includes all the metadata and the observations for a specific source/timestamp.

The function has been implemented and tested to download hourly and diurnal data.

Usage

gibson_frost(apiKey=NULL,
             oldElementCodes=NULL,
             timeOffset=0,
             start_date=NULL,
             stop_date=NULL,
             format="
             formatOUT="
             spatial_extent=c(19.09,59.3,31.59,70.13),
             stationholders=NULL,
             stationholders.exclude=F,
             WMOonly=F,
             WMOin=T,
             na.rm=T,
             url.show=F,
             coords=data.frame(x="lon",y="lat",
                    proj4="+proj=longlat +datum=WGS84",
                    stringsAsFactors=F),
             url4stnlist="http://en.ilmatieteenlaitos.fi/observation-stations",
             verbose=F)

Arguments

apiKey

API-key that can be gotten via registration https://ilmatieteenlaitos.fi/rekisteroityminen-avoimen-datan-kayttajaksi

oldElementCodes

character vector with the abbreviations used to define weather and climate elements (before Frost-era). See Details for more information or https://frost.met.no/elementtable. The oldElementCodes are transladed into the FMI observations, that are described at http://en.ilmatieteenlaitos.fi/guidance-to-observations by fmi_opendata_translate_oldElementCodes.

timeOffset

numeric number of seconds to add to the original FMI timestamp. It can be used to adapt the timestamp to different time conventions.

start_date

character string with the time stamp of the first observation

stop_date

character string with the time stamp of the last observation

format

charater string specifying the date-time format of start_date and stop_date (see strptime help page)

formatOUT

charater string specifying the date-time format of the output timestamps (see strptime help page)

spatial_extent

numeric vector of the form c(long_min,long_max,lan_min,lan_max) that identifies a rectangle used to select the data sources. The lower left corner is (long_min,lan_min) the upper right corner is (long_max,lat_max).

stationholders

character vector with the names of the station holders. The list of observation stations is available at http://en.ilmatieteenlaitos.fi/observation-stations. The available station holders are: 'Weather', 'Precipitation', 'Radar', 'Sounding', 'Mast', 'Buoy', 'Air quality', 'Air quality (urban)'.

stationholders.exclude

logical, it is used in combination with stationholders. If FALSE, then the stationholders list will be used to select those station holders to include in the output. If TRUE, then the stationholders list will be used to select those station holders NOT to include in the output. Note that it might happen that a station has more than one station holder, in this case if at least one of the specified stationholders is included within the station holders of a station then the correspondent action (i.e., include/exclude) will be executed.

WMOonly

logical, if TRUE then only WMO stations (i.e., having assigned a WMO code) will be returned

WMOin

logical, used only if WMOonly=FALSE. if TRUE then WMO stations (i.e., having a WMO code) will be returned otherwise the will not.

na.rm

not used

url.show

logical, if TRUE the urls are shown to the user

coords

data frame specifying the coordinate reference systems (as proj4 strings http://proj4.org/) to include in the output together with the names of the easting and northing coordinate.

verbose

logical, if TRUE verbose mode is activated

url4stnlist

character, link to the page with the list of observation stations

Details

oldElementCodes abbreviations are listed at https://frost.met.no/elementtable. Not all abbreviations have been implemented (see frost_translate_oldElementCodes).

It is not possible to mix variables with hourly time resolution and variables with daily time resolution.

SourceId is the FMI-station identifier and the suffix ':fmi' has been added. The sourceId is a unique key.

Guidance to the observed values is available at http://en.ilmatieteenlaitos.fi/guidance-to-observations. For 'r_1h' hourly precipitation, the timestamp marks the end of the aggregation period. The other hourly values ('t2m', 'ws_10min', 'p_sea', 'wd_10min', 'wg_10min', 'rh') are actually instantaneous values or 10-minute values referring to the 10-minute interval that ends at minute 00.

For daily (or diurnal) values of: 'rrday' Precipitation is between 0700 UTC and 0700 UTC of the successive day respect to the one reported as the timestamp; 'tmin' the lowest temperature during two 12 hours period, i.e. between 1900 UTC previous evening and 1900 UTC this evening; 'tmax' the highest temperature during two 12 hours period, i.e. between 1900 UTC previous evening and 1900 UTC this evening; 'tday' the average temperature based usually on 4 or 8 observations per day.

Value

A data frame is returned. The number of columns depends on the input parameters. Each row includes all the metadata and observed values for a single sourceId/timestamp.

The column names are: timestamp (end of the aggregation period), sourceId (station:sensor), easting coordinate for the 1st CRS, northing coordinate for the 1st CRS, easting coordinate for the 2nd CRS, northing coordinate for the 2nd CRS, ... , z (elevation a.m.s.l.), variable1, variable1_qcode, variable2, variable2_qcode, ...

Note

FMI open data licence http://en.ilmatieteenlaitos.fi/open-data-licence.

Author(s)

Cristian Lussana

See Also

fmi_opendata_assembler

Examples


# load libraries
library(gibson)
#
apiKey<-put_your_apiKey_here
#--------------------------------------------------------------------
# get hourly data on a real-time basis
fmi<-fmi_opendata_assembler(apiKey=apiKey,oldElementCodes=c("RR_1","TA","UU"),timeOffset=0,start_date=NULL,stop_date=NULL,format="
#--------------------------------------------------------------------
# get daily data on a real-time basis
fmi<-fmi_opendata_assembler(apiKey=apiKey,oldElementCodes=c("RR","TAM"),timeOffset=86400,start_date=NULL,stop_date=NULL,format="

metno/gibson documentation built on Feb. 12, 2024, 7:25 a.m.