meteo_ogimet_synop: Download and decode raw SYNOP messages from the Ogimet...

View source: R/meteo_ogimet_synop.R

meteo_ogimet_synopR Documentation

Download and decode raw SYNOP messages from the Ogimet getsynop service

Description

Downloads raw SYNOP messages from the Ogimet getsynop endpoint and decodes them into a tidy data.frame using the synop_parser() function. Two retrieval modes are supported:

Usage

meteo_ogimet_synop(
  station = NULL,
  date = c(Sys.Date() - 30, Sys.Date()),
  country = NULL,
  country_name = NULL,
  simplified = TRUE,
  allow_failure = TRUE
)

Arguments

station

Numeric or character vector of WMO station IDs. Optional when country_name is provided; required otherwise.

date

Character or Date vector of length 2 giving the start and end of the requested period, e.g. c("2009-12-01", "2009-12-04"). Defaults to the last 30 days.

country

Optional; passed to synop_parser() for country-specific precipitation indicator decoding (e.g. "RU"). Single string or NULL (default). This is distinct from country_name.

country_name

Optional character string naming the country whose stations should be downloaded, as recognised by Ogimet (e.g. "Poland", "Germany", "France"). When provided, the ⁠state=⁠ Ogimet parameter is used and station is ignored. The full date range is fetched in a single request.

simplified

Logical. When TRUE (default) returns a compact data.frame with 20 standardised columns (see Value below). When FALSE the full parser output is returned.

allow_failure

Logical. When TRUE (default) network errors are caught and a message is emitted; when FALSE errors propagate to the caller.

Details

  • Station mode (station provided): fetches messages for one or more WMO station IDs. URL form: ⁠http://www.ogimet.com/cgi-bin/getsynop?block=<id>&begin=<YYYYMMDDhhmm>&end=<YYYYMMDDhhmm>⁠

  • Country mode (country_name provided): fetches messages for all Ogimet stations in a country in a single request. URL form: ⁠http://www.ogimet.com/cgi-bin/getsynop?begin=<YYYYMMDDhhmm>&end=<YYYYMMDDhhmm>&state=<country_name>⁠

When both station and country_name are supplied, country_name takes precedence and a warning is issued.

Each line of the response is a comma-separated record: ⁠station_id,year,month,day,hour,minute,<SYNOP message>⁠. The SYNOP message is decoded via synop_parser() with as_data_frame = TRUE.

Value

By default (simplified = TRUE), a compact data.frame with one row per decoded SYNOP observation. Columns:

  • date — Observation date-time (POSIXct, UTC).

  • station — WMO station identifier (character).

  • t2m — Air temperature at 2 m (°C).

  • dpt2m — Dew-point temperature at 2 m (°C).

  • rel_hum — Relative humidity (%), derived via compute_relative_humidity().

  • tmax — Daily maximum temperature from Section 3 (°C).

  • tmin — Daily minimum temperature from Section 3 (°C).

  • wd — Wind direction (degrees).

  • ws — Wind speed (m/s or knots, per wind_unit).

  • gust — Highest gust speed from Section 3, same unit as ws.

  • press — Station-level pressure (hPa).

  • slp — Sea-level pressure (hPa).

  • press_tend — 3-hour pressure change (hPa).

  • precip — Precipitation amount (mm).

  • Nt — Total cloud cover (oktas, 0–8) from the Nddff group.

  • Nh — Cover of low clouds (genera Sc, St, Cu, Cb) in oktas (0–8), from Section 1 group ⁠8NhCLCMCH⁠; NA when not reported.

  • N_base — Height of base of lowest observed cloud (m).

  • insol — Daily sunshine duration (hours).

  • visibility — Horizontal visibility (m).

  • snow — Total snow depth (cm); 0 for trace amounts.

When simplified = FALSE, a data.frame with the first two columns station_id (WMO identifier, character) and Date (POSIXct, UTC), followed by all columns produced by synop_parser() with as_data_frame = TRUE: station_type, region, obs_day, obs_hour, wind_unit, wind_estimated, visibility, cloud_cover, wind_direction, wind_speed, air_temperature, dewpoint_temperature, station_pressure, sea_level_pressure, pressure_tendency, pressure_change, precipitation_amount, precipitation_time, cloud_base_min, cloud_base_max, low_cloud_type, middle_cloud_type, high_cloud_type, low_cloud_amount, maximum_temperature, minimum_temperature, gust, sunshine_duration, snow_depth, snow_depth_state, source.

Returns NULL invisibly when the download fails and allow_failure = TRUE.

Examples


  # Station mode: Poznan-Lawica (Poland)
  poznan = meteo_ogimet_synop(station = 12330,
                              date = c("2009-12-01", "2009-12-04"))
  head(poznan)

  # Station mode: multiple stations
  two_stations = meteo_ogimet_synop(station = c(12330, 12375),
                                    date = c("2019-06-01", "2019-06-03"))
  head(two_stations)
  
  # Country mode: all Polish stations for one day
  poland = meteo_ogimet_synop(country_name = "Poland",
                              date = c("2009-12-15", "2009-12-15"))
  head(poland)

  # Simplified view
  poznan_simple = meteo_ogimet_synop(station = 12330,
                                     date = c("2009-12-01", "2009-12-04"),
                                     simplified = TRUE)
  head(poznan_simple)



climate documentation built on Sept. 18, 2026, 5:06 p.m.