Metadata

Given the collection id is known (see gs_datasets()) the function gs_metadata() downloads and prepares metainformation for the collection. This includes a data inventory, a list of all available stations, as well as a list of all parameters and their description.

This example uses the collection id ch.meteoschweiz.ogd-smn, the collection containing the weather station observations of the weather service.

library("msdata")
# Meta information for historical hourly synop observations
meta <- ms_metadata("ch.meteoschweiz.ogd-smn", language = "en")

The return is a named list (class ms_metadata) with the three sets of data mentioned above, which are explained in more detail in this article.

Station information

The element stations is an object of class c(“sf”, “tbl_df”, “tbl”, “data.frame”) containing information about available stations of this data set. This includes the station abbreviation (station_abbr) used as unique identifier, the stations location as well as the data owner.

plot(meta$station["station_height_masl"],
     main = "Station location and altitude",
     pch = 19, cex = 2)

Spatial plot showing the location of all stations available via this resource.

plot(meta$station["station_dataowner"],
     main = "Owner of the station/data",
     pch = 19, cex = 2)

Spatial plot showing the location of all stations (synop-v1-1h) where the symbols indicate whether or not the station is still active or not.

Parameter information

The element parameters provides a list of all available parameters for this data set. Alongside with the shortname (parameter_shortname) required to retrieve data (see ms_stationdata()). This data.frame also contains a description as well as the unit of the measurements.

The variable parameter_granularity contains information on which temporal resolution (granularity) the data is available from annual (Y) down to a ten minute temporal resolution (T). Not all stations will provide measurements for all parameters on all granularity levels (temporal resolution).

Note that the parameter description is available in English, French, German, and Italian. This can be controlled by specifying the language parameter when calling ms_metadata().

meta$parameters |> head(n = 3)
# A tibble: 3 × 7
  parameter_shortname parameter_description_en         parameter_group_en
  <chr>               <chr>                            <chr>             
1 dkl010d0            Wind direction; daily mean       Wind              
2 dkl010h0            Wind direction; hourly mean      Wind              
3 dkl010z0            Wind direction; ten minutes mean Wind              
# ℹ 4 more variables: parameter_granularity <chr>, parameter_decimals <int>,
#   parameter_datatype <chr>, parameter_unit <chr>