View source: R/meteo_ogimet_synop.R
| meteo_ogimet_synop | R Documentation |
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:
meteo_ogimet_synop(
station = NULL,
date = c(Sys.Date() - 30, Sys.Date()),
country = NULL,
country_name = NULL,
simplified = TRUE,
allow_failure = TRUE
)
station |
Numeric or character vector of WMO station IDs. Optional when
|
date |
Character or Date vector of length 2 giving the start and end of
the requested period, e.g. |
country |
Optional; passed to |
country_name |
Optional character string naming the country whose
stations should be downloaded, as recognised by Ogimet (e.g.
|
simplified |
Logical. When |
allow_failure |
Logical. When |
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.
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.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.