Title: | Interface to Download Meteorological (and Hydrological) Datasets |
---|---|
Description: | Automatize downloading of meteorological and hydrological data from publicly available repositories: OGIMET (<http://ogimet.com/index.phtml.en>), University of Wyoming - atmospheric vertical profiling data (<http://weather.uwyo.edu/upperair/>), Polish Institute of Meteorology and Water Management - National Research Institute (<https://danepubliczne.imgw.pl>), and National Oceanic & Atmospheric Administration (NOAA). This package also allows for searching geographical coordinates for each observation and calculate distances to the nearest stations. |
Authors: | Bartosz Czernecki [aut, cre] |
Maintainer: | Bartosz Czernecki <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.2.2 |
Built: | 2025-03-07 01:39:37 UTC |
Source: | https://github.com/bczernecki/climate |
The object contains pre-downloaded CO2 dataset from Mauna Loa observatory The snapshot was taken 2020/05/05.
co2_demo
co2_demo
An object of class data.frame
with 745 rows and 7 columns.
data.frame with historical CO2 concentrations data(co2_demo) head(co2_demo)
Downloading daily, and monthly hydrological data from the measurement stations available in the danepubliczne.imgw.pl collection
hydro_imgw( interval, year, coords = FALSE, value = "H", station = NULL, col_names = "short", ... )
hydro_imgw( interval, year, coords = FALSE, value = "H", station = NULL, col_names = "short", ... )
interval |
temporal resolution of the data ("daily" or "monthly") |
year |
vector of years (e.g., 1966:2000) |
coords |
add coordinates of the stations (logical value TRUE or FALSE) |
value |
type of data (can be: state - "H" (default), flow - "Q", or temperature - "T") |
station |
vector of hydrological stations danepubliczne.imgw.pl; can be given as station name with CAPITAL LETTERS (character) It accepts either names (characters in CAPITAL LETTERS) or stations' IDs (numeric) |
col_names |
three types of column names possible: "short" - default, values with shorten names, "full" - full English description, "polish" - original names in the dataset |
... |
other parameters that may be passed to the 'shortening' function that shortens column names |
A data.frame with columns describing the hydrological parameters
(e.g. flow, water level) where each row represent a measurement,
depending on the interval, at a given hour, month or year.
If coords = TRUE
additional two columns with geographic coordinates are added.
x = hydro_imgw("monthly", year = 1999) head(x)
x = hydro_imgw("monthly", year = 1999) head(x)
Downloading daily hydrological data from the danepubliczne.imgw.pl collection
hydro_imgw_daily( year, coords = FALSE, station = NULL, col_names = "short", allow_failure = TRUE, ... )
hydro_imgw_daily( year, coords = FALSE, station = NULL, col_names = "short", allow_failure = TRUE, ... )
year |
vector of years (e.g., 1966:2000) |
coords |
add coordinates of the stations (logical value TRUE or FALSE) |
station |
name or ID of hydrological station(s). It accepts names (characters in CAPITAL LETTERS) or stations' IDs (numeric) |
col_names |
three types of column names possible: "short" - default, values with shorten names, "full" - full English description, "polish" - original names in the dataset |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
... |
other parameters that may be passed to the 'shortening' function that shortens column names |
data.frame with historical hydrological data for the daily time interval
daily = hydro_imgw_daily(year = 2000)
daily = hydro_imgw_daily(year = 2000)
Downloading monthly hydrological data from the danepubliczne.imgw.pl collection
hydro_imgw_monthly( year, coords = FALSE, station = NULL, col_names = "short", allow_failure = TRUE, ... )
hydro_imgw_monthly( year, coords = FALSE, station = NULL, col_names = "short", allow_failure = TRUE, ... )
year |
vector of years (e.g., 1966:2000) |
coords |
add coordinates of the stations (logical value TRUE or FALSE) |
station |
name or ID of hydrological station(s). It accepts names (characters in CAPITAL LETTERS) or stations' IDs (numeric) |
col_names |
three types of column names possible: "short" - default, values with shorten names, "full" - full English description, "polish" - original names in the dataset |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
... |
other parameters that may be passed to the 'shortening' function that shortens column names |
data.frame with historical hydrological data for the monthly summaries
monthly = hydro_imgw_monthly(year = 2000)
monthly = hydro_imgw_monthly(year = 2000)
Shortening column names of hydrological parameters to improve the readability of downloaded dataset from the danepubliczne.imgw.pl collection and removing duplicated column names
hydro_shortening_imgw(data, col_names = "short", remove_duplicates = TRUE)
hydro_shortening_imgw(data, col_names = "short", remove_duplicates = TRUE)
data |
downloaded dataset with original column names |
col_names |
three types of column names possible: "short" - default, values with shorten names, "full" - full English description, "polish" - original names in the dataset |
remove_duplicates |
whether to remove duplicated column names (default TRUE - i.e., columns with duplicated names are deleted) |
data.frame with shorten names of hydrological parameters
monthly = data = hydro_imgw("monthly", year = 1969, col_names = "polish") if (is.data.frame(monthly)) { abbr = hydro_shortening_imgw(data = monthly, col_names = "full", remove_duplicates = TRUE) head(abbr) }
monthly = data = hydro_imgw("monthly", year = 1969, col_names = "polish") if (is.data.frame(monthly)) { abbr = hydro_shortening_imgw(data = monthly, col_names = "full", remove_duplicates = TRUE) head(abbr) }
The object contains 3 columns that are currently used for improving readability of the downloaded dataset: fullname, abbr_eng, and fullname_eng
imgw_hydro_abbrev
imgw_hydro_abbrev
The data contains a data.frame with ca. 20 elements described in three ways:
original column names as downloaded from the repository
shorten column names with abbreviations derived from the most popular scheme used for meteorological parameters
detailed description of downloaded meteorological variables
The object is created mostly to be used altogether with the hydro_shortening_imgw() function
data(imgw_hydro_abbrev) head(imgw_hydro_abbrev)
data(imgw_hydro_abbrev) head(imgw_hydro_abbrev)
The object contains weather stations coordinates, ID numbers, and elevations
imgw_hydro_stations
imgw_hydro_stations
The data contains a data.frame with 1304 obs. of 3 variables:
Station ID
Longitude
Latitude
The object is in the geographic coordinates using WGS84 (EPSG:4326).
data(imgw_hydro_stations) head(imgw_hydro_stations)
data(imgw_hydro_stations) head(imgw_hydro_stations)
The object contains 3 columns that are currently used for improving readability of the downloaded dataset: fullname, abbr_eng, and fullname_eng
imgw_meteo_abbrev
imgw_meteo_abbrev
The data contains a data.frame with ca. 250 elements described in three ways:
original column names as downloaded from the repository
shorten column names with abbreviations derived from the most popular scheme used for meteorological parameters
detailed description of downloaded meteorological variables
The object is created mostly to be used altogether with the meteo_shortening_imgw function
data(imgw_meteo_abbrev) head(imgw_meteo_abbrev)
data(imgw_meteo_abbrev) head(imgw_meteo_abbrev)
The object contains weather stations coordinates, ID numbers, and elevations
imgw_meteo_stations
imgw_meteo_stations
The data contains a data.frame with 1998 obs. of 3 variables:
Station ID
Longitude
Latitude
Station name
IMGW-PIB ID for station rank
The object is in the geographic coordinates using WGS84 (EPSG:4326).
data(imgw_meteo_stations) head(imgw_meteo_stations)
data(imgw_meteo_stations) head(imgw_meteo_stations)
Downloading hourly, daily, and monthly meteorological data from the SYNOP / CLIMATE / PRECIP stations available in the danepubliczne.imgw.pl collection.
meteo_imgw( interval, rank = "synop", year, status = FALSE, coords = FALSE, station = NULL, col_names = "short", ... )
meteo_imgw( interval, rank = "synop", year, status = FALSE, coords = FALSE, station = NULL, col_names = "short", ... )
interval |
temporal resolution of the data ("hourly", "daily", "monthly") |
rank |
rank of the stations: "synop" (default), "climate" or "precip" |
year |
vector of years (e.g., 1966:2000) |
status |
leave the columns with measurement and observation statuses (default status = FALSE - i.e. the status columns are deleted) |
coords |
add coordinates of the station (logical value TRUE or FALSE) |
station |
vector of hydrological stations danepubliczne.imgw.pl can be name of station CAPITAL LETTERS(character). It accepts names (characters in CAPITAL LETTERS) or stations' IDs (numeric) |
col_names |
three types of column names possible: "short" - default, values with shorten names, "full" - full English description, "polish" - original names in the dataset |
... |
other parameters that may be passed to the 'shortening' function that shortens column names |
A data.frame with columns describing the meteorological parameters
(e.g. temperature, wind speed, precipitation) where each row represent a measurement,
depending on the interval, at a given hour, month or year.
If coords = TRUE
additional two
columns with geographic coordinates are added.
x = meteo_imgw("monthly", year = 2018, coords = TRUE) head(x)
x = meteo_imgw("monthly", year = 2018, coords = TRUE) head(x)
Downloading daily (meteorological) data from the SYNOP / CLIMATE / PRECIP stations available in the danepubliczne.imgw.pl collection
meteo_imgw_daily( rank = "synop", year, status = FALSE, coords = FALSE, station = NULL, col_names = "short", allow_failure = TRUE, ... )
meteo_imgw_daily( rank = "synop", year, status = FALSE, coords = FALSE, station = NULL, col_names = "short", allow_failure = TRUE, ... )
rank |
rank of the stations: "synop" (default), "climate", or "precip" |
year |
vector of years (e.g., 1966:2000) |
status |
leave the columns with measurement and observation statuses (default status = FALSE - i.e. the status columns are deleted) |
coords |
add coordinates of the station (logical value TRUE or FALSE) |
station |
name of meteorological station(s). It accepts names (characters in CAPITAL LETTERS); Stations' IDs (numeric) are no longer valid |
col_names |
three types of column names possible: "short" - default, values with shorten names, "full" - full English description, "polish" - original names in the dataset |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
... |
other parameters that may be passed to the 'shortening' function that shortens column names |
data.frame with a daily meteorological measurements
daily = meteo_imgw_daily(rank = "climate", year = 2000)
daily = meteo_imgw_daily(rank = "climate", year = 2000)
Downloading hourly (meteorological) data from the telemetric stations available in the danepubliczne.imgw.pl/datastore collection since 2008. Most parameters are collected with 10 minutes interval and thus it is recommended to download only the mandatory years, parameters or stations. For example, 1 year of data with all available parameters requires processing around 4GB of uncompressed data.
meteo_imgw_datastore( year, parameters = NULL, stations = NULL, coords = TRUE, allow_failure = TRUE )
meteo_imgw_datastore( year, parameters = NULL, stations = NULL, coords = TRUE, allow_failure = TRUE )
year |
numeric vector of years to be downloaded (e.g., 2022:2023) |
parameters |
|
stations |
|
coords |
|
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
Data from the IMGW automated (telemetry) systems are non validated by experts and may contain invalid values.
data.frame with a raw meteorological measurements in 10-min intervals. Please note that this dataset is not validated by experts and may contain invalid values.
imgw_telemetry = meteo_imgw_datastore(year = 2022:2023, parameters = "t2m", stations = c("HALA GĄSIENICOWA", "DOLINA 5 STAWÓW"), coords = TRUE)
imgw_telemetry = meteo_imgw_datastore(year = 2022:2023, parameters = "t2m", stations = c("HALA GĄSIENICOWA", "DOLINA 5 STAWÓW"), coords = TRUE)
Downloading hourly (meteorological) data from the SYNOP / CLIMATE / PRECIP stations available in the danepubliczne.imgw.pl collection
meteo_imgw_hourly( rank = "synop", year, status = FALSE, coords = FALSE, station = NULL, col_names = "short", allow_failure = TRUE, ... )
meteo_imgw_hourly( rank = "synop", year, status = FALSE, coords = FALSE, station = NULL, col_names = "short", allow_failure = TRUE, ... )
rank |
rank of the stations: "synop" (default), "climate", or "precip" |
year |
vector of years (e.g., 1966:2000) |
status |
leave the columns with measurement and observation statuses (default status = FALSE - i.e. the status columns are deleted) |
coords |
add coordinates of the station (logical value TRUE or FALSE) |
station |
name or ID of meteorological station(s). It accepts names (characters in CAPITAL LETTERS) or stations' IDs (numeric) |
col_names |
three types of column names possible: "short" - default, values with shorten names, "full" - full English description, "polish" - original names in the dataset |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
... |
other parameters that may be passed to the 'shortening' function that shortens column names |
meteorological data for the hourly time interval
hourly = meteo_imgw_hourly(rank = "climate", year = 1984) head(hourly)
hourly = meteo_imgw_hourly(rank = "climate", year = 1984) head(hourly)
Downloading monthly (meteorological) data from the SYNOP / CLIMATE / PRECIP stations available in the danepubliczne.imgw.pl collection
meteo_imgw_monthly( rank = "synop", year, status = FALSE, coords = FALSE, station = NULL, col_names = "short", allow_failure = TRUE, ... )
meteo_imgw_monthly( rank = "synop", year, status = FALSE, coords = FALSE, station = NULL, col_names = "short", allow_failure = TRUE, ... )
rank |
rank of the stations: "synop" (default), "climate", or "precip" |
year |
vector of years (e.g., 1966:2000) |
status |
leave the columns with measurement and observation statuses (default status = FALSE - i.e. the status columns are deleted) |
coords |
add coordinates of the station (logical value TRUE or FALSE) |
station |
name or ID of meteorological station(s).
It accepts names (characters in CAPITAL LETTERS) or stations' IDs (numeric).
Please note that station names may change over time and thus sometimes 2 names
are required in some cases, e.g. |
col_names |
three types of column names possible: "short" - default, values with shorten names, "full" - full English description, "polish" - original names in the dataset |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
... |
other parameters that may be passed to the 'shortening' function that shortens column names |
meteorological data with monthly summaries
monthly = meteo_imgw_monthly(rank = "climate", year = 1969) head(monthly) # a descriptive (long) column names: monthly2 = meteo_imgw_monthly(rank = "synop", year = 2018, col_names = "full") head(monthly2)
monthly = meteo_imgw_monthly(rank = "climate", year = 1969) head(monthly) # a descriptive (long) column names: monthly2 = meteo_imgw_monthly(rank = "synop", year = 2018, col_names = "full") head(monthly2)
Carbon Dioxide (CO2) monthly measurements from Mauna Loa observatory. The source file is available at: ftp://aftp.cmdl.noaa.gov/products/trends/co2/co2_mm_mlo.txt with all further details.
meteo_noaa_co2()
meteo_noaa_co2()
Data from March 1958 through April 1974 have been obtained by C. David Keeling of the Scripps Institution of Oceanography (SIO) and were obtained from the Scripps website (scrippsco2.ucsd.edu).
The "average" column contains the monthly mean CO2 mole fraction determined from daily averages. The mole fraction of CO2, expressed as parts per million (ppm) is the number of molecules of CO2 in every one million molecules of dried air (water vapor removed). If there are missing days concentrated either early or late in the month, the monthly mean is corrected to the middle of the month using the average seasonal cycle. Missing months are denoted by -99.99. The "interpolated" column includes average values from the preceding column and interpolated values where data are missing. Interpolated values are computed in two steps. First, we compute for each month the average seasonal cycle in a 7-year window around each monthly value. In this way the seasonal cycle is allowed to change slowly over time. We then determine the "trend" value for each month by removing the seasonal cycle; this result is shown in the "trend" column. Trend values are linearly interpolated for missing months. The interpolated monthly mean is then the sum of the average seasonal cycle value and the trend value for the missing month. NOTE: In general, the data presented for the last year are subject to change, depending on recalibration of the reference gas mixtures used, and other quality control procedures. Occasionally, earlier years may also be changed for the same reasons. Usually these changes are minor. CO2 expressed as a mole fraction in dry air, micromol/mol, abbreviated as ppm
Data frame with historical CO2 concentrations
co2 = meteo_noaa_co2() head(co2)
co2 = meteo_noaa_co2() head(co2)
Downloading hourly (meteorological) data from the SYNOP stations available in the NOAA ISD collection. Some stations in the dataset are dated back even up to 1900. By default only records that follow FM-12 (SYNOP) convention are processed. Further details available at: https://www1.ncdc.noaa.gov/pub/data/noaa/readme.txt
meteo_noaa_hourly( station = NULL, year = 2019, fm12 = TRUE, allow_failure = TRUE )
meteo_noaa_hourly( station = NULL, year = 2019, fm12 = TRUE, allow_failure = TRUE )
station |
ID of meteorological station(s) (characters). Find your station's ID at: https://www1.ncdc.noaa.gov/pub/data/noaa/isd-history.txt |
year |
vector of years (e.g., 1966:2000) |
fm12 |
use only FM-12 (SYNOP) records (TRUE by default) |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
data.frame with historical meteorological data in hourly intervals
# London-Heathrow, United Kingdom noaa = meteo_noaa_hourly(station = "037720-99999", year = 1949)
# London-Heathrow, United Kingdom noaa = meteo_noaa_hourly(station = "037720-99999", year = 1949)
Downloading hourly or daily (meteorological) data from the Synop stations available at https://www.ogimet.com/
meteo_ogimet( interval, date = c(Sys.Date() - 30, Sys.Date()), coords = FALSE, station, precip_split = TRUE, allow_failure = TRUE )
meteo_ogimet( interval, date = c(Sys.Date() - 30, Sys.Date()), coords = FALSE, station, precip_split = TRUE, allow_failure = TRUE )
interval |
'daily' or 'hourly' dataset to retrieve - given as character |
date |
start and finish date (e.g., date = c("2018-05-01", "2018-07-01")) - character or Date class object. If not provided last 30 days are used. |
coords |
add geographical coordinates of the station (logical value TRUE or FALSE) |
station |
WMO ID of meteorological station(s). Character or numeric vector |
precip_split |
whether to split precipitation fields into 6/12/24h |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE numeric fields (logical value TRUE (default) or FALSE); valid only for hourly time step |
A data.frame of measured values with columns describing the meteorological parameters (e.g. air temperature, wind speed, cloudines). Depending on the interval, at a given hour or day. Different parameters are returned for daily and hourly datasets.
station_ID - WMO station identifier
Lon - longitude
Lat - latitude
Date - date (and time) of observations
TC - air temperature at 2 metres above ground level. Values given in Celsius degrees
TdC - dew point temperature at 2 metres above ground level. Values given in Celsius degrees
TmaxC - maximum air temperature at 2 metres above ground level. Values given in Celsius degrees
TminC - minimum air temperature at 2 metres above ground level. Values given in Celsius degrees
ddd - wind direction
ffkmh - wind speed in km/h
Gustkmh - wind gust in km/h
P0hpa - air pressure at elevation of the station in hPa
PseahPa - sea level pressure in hPa
PTnd - pressure tendency in hPa
Nt - total cloud cover
Nh - cloud cover by high-level cloud fraction
HKm - height of cloud base
InsoD1 - insolation in hours
Viskm - visibility in kilometres
Snowcm - depth of snow cover in centimetres
pr6 - precicipitation totals in 6 hours
pr12 - precicipitation totals in 12 hours
pr24 - precicipitation totals in 24 hours
TemperatureCAvg - average air temperature at 2 metres above ground level. Values given in Celsius degrees
TemperatureCMax - maximum air temperature at 2 metres above ground level. Values given in Celsius degrees
TemperatureCMin - minimum air temperature at 2 metres above ground level. Values given in Celsius degrees
TdAvgC - average dew point temperature at 2 metres above ground level. Values given in Celsius degrees
HrAvg - average relative humidity. Values given in %
WindkmhDir - wind direction
WindkmhInt - wind speed in km/h
WindkmhGust - wind gust in km/h
PresslevHp - Sea level pressure in hPa
Precmm - precipitation totals in mm
TotClOct - total cloudiness in octants
lowClOct - cloudiness by low level clouds in octants
SunD1h - sunshine duration in hours
PreselevHp - atmospheric pressure measured at altitude of station in hPa
SnowDepcm - depth of snow cover in centimetres
# downloading daily data for New York - La Guardia (last 30 days by default) new_york = meteo_ogimet(interval = "daily", station = 72503, coords = TRUE)
# downloading daily data for New York - La Guardia (last 30 days by default) new_york = meteo_ogimet(interval = "daily", station = 72503, coords = TRUE)
Shortening column names of meteorological parameters to improve the readability of downloaded dataset from the danepubliczne.imgw.pl collection and removing duplicated column names
meteo_shortening_imgw(data, col_names = "short", remove_duplicates = TRUE)
meteo_shortening_imgw(data, col_names = "short", remove_duplicates = TRUE)
data |
downloaded dataset with original column names |
col_names |
three types of column names possible: "short" - default, values with shorten names, "full" - full English description, "polish" - original names in the dataset |
remove_duplicates |
whether to remove duplicated column names (default TRUE - i.e., columns with duplicated names are deleted) |
data.frame with modified names of meteorological parameters
monthly = meteo_imgw("monthly", rank = "climate", year = 1969) abbr = meteo_shortening_imgw(data = monthly, col_names = "full", remove_duplicates = TRUE) head(abbr)
monthly = meteo_imgw("monthly", rank = "climate", year = 1969) abbr = meteo_shortening_imgw(data = monthly, col_names = "full", remove_duplicates = TRUE) head(abbr)
Returns a data frame of meteorological or hydrological stations with their coordinates in particular year.
The returned object is valid only for a given year and type of stations (e.g. "synop", "climate" or "precip"). If add_map = TRUE
additional map of downloaded data is added.
nearest_stations_imgw( type = "meteo", rank = "synop", year = 2018, add_map = TRUE, point = NULL, no_of_stations = 50, allow_failure = TRUE, ... )
nearest_stations_imgw( type = "meteo", rank = "synop", year = 2018, add_map = TRUE, point = NULL, no_of_stations = 50, allow_failure = TRUE, ... )
type |
data name; "meteo" (default), "hydro" |
rank |
rank of the stations: "synop" (default), "climate", or "precip"; Only valid if type = "meteo" |
year |
select year for searching nearest station |
add_map |
logical - whether to draw a map for a returned data frame (requires maps/mapdata packages) |
point |
a vector of two coordinates (longitude, latitude) for a point we want to find nearest stations to (e.g. c(15, 53)); If not provided calculated as a mean longitude and latitude for the entire dataset |
no_of_stations |
how many nearest stations will be returned from the given geographical coordinates. 50 used by default |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
... |
extra arguments to be provided to the |
A data.frame with a list of nearest stations. Each row represents metadata for station which collected measurements in a given year. Particular columns contain stations metadata (e.g. station ID, geographical coordinates, official name, distance in kilometers from a given coordinates).
df = nearest_stations_imgw(type = "meteo", rank = "synop", year = 2018, point = c(17, 52), add_map = TRUE, no_of_stations = 4)
df = nearest_stations_imgw(type = "meteo", rank = "synop", year = 2018, point = c(17, 52), add_map = TRUE, no_of_stations = 4)
Returns a data frame of meteorological stations with their coordinates and distance from a given location based on the noaa website. The returned list is valid only for a given day.
nearest_stations_noaa( country, date = Sys.Date(), add_map = TRUE, point = NULL, no_of_stations = 10, allow_failure = TRUE )
nearest_stations_noaa( country, date = Sys.Date(), add_map = TRUE, point = NULL, no_of_stations = 10, allow_failure = TRUE )
country |
country name (e.g., "SRI LANKA"). Single entries allowed only. |
date |
optionally, a day when measurements were done in all available locations; current Sys.Date used by default |
add_map |
logical - whether to draw a map for a returned data frame (requires maps/mapdata packages) |
point |
a vector of two coordinates (longitude, latitude) for a point we want to find nearest stations to (e.g. c(80, 6)). If not provided the query will be based on a mean longitude and latitude among available dataset. |
no_of_stations |
how many nearest stations will be returned from the given geographical coordinates; default 30 |
allow_failure |
logical - whether to allow or stop on failure. By default set to TRUE. For debugging purposes change to FALSE |
A data.frame with number of nearest station according to given point columns describing stations parameters
(e.g. ID station, distance from point, geographic coordinates, etc.) where each row represent a measurement,
each station which has a measurements on selected date. If add_map = TRUE
additional map of downloaded data is added.
nearest_stations_noaa(country = "SRI LANKA", point = c(80, 6), add_map = TRUE, no_of_stations = 10) uk_stations = nearest_stations_noaa(country = "UNITED KINGDOM", no_of_stations = 100)
nearest_stations_noaa(country = "SRI LANKA", point = c(80, 6), add_map = TRUE, no_of_stations = 10) uk_stations = nearest_stations_noaa(country = "UNITED KINGDOM", no_of_stations = 100)
Returns a data frame of meteorological stations with their coordinates and distance from a given location based on the ogimet webpage. The returned list is valid only for a given day.
nearest_stations_ogimet( country = "United Kingdom", date = Sys.Date(), add_map = FALSE, point = c(2, 50), no_of_stations = 10, allow_failure = TRUE, ... )
nearest_stations_ogimet( country = "United Kingdom", date = Sys.Date(), add_map = FALSE, point = c(2, 50), no_of_stations = 10, allow_failure = TRUE, ... )
country |
country name; for more than two words they need to be seperated with a plus character (e.g., "United+Kingdom"). It is possible to provide more than one country combined into a vector |
date |
optionally, a day when measurements were done in all available locations; current Sys.Date used by default |
add_map |
logical - whether to draw a map for a returned data frame (requires maps/mapdata packages) |
point |
a vector of two coordinates (longitude, latitude) for a point we want to find nearest stations to (e.g. c(0, 0)) |
no_of_stations |
how many nearest stations will be returned from the given geographical coordinates |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
... |
extra arguments to be provided to the |
A data.frame with number of nearest station according to given point columns describing stations parameters
(e.g. ID station, distance from point in km, geographic coordinates, etc.). Each row represent a measurement,
each station which has a measurements on selected date. If add_map = TRUE
additional map of downloaded data is added.
nearest_stations_ogimet(country = "United Kingdom", point = c(-2, 50), add_map = TRUE, no_of_stations = 50, allow_failure = TRUE, main = "Meteo stations in UK")
nearest_stations_ogimet(country = "United Kingdom", point = c(-2, 50), add_map = TRUE, no_of_stations = 50, allow_failure = TRUE, main = "Meteo stations in UK")
Downloading daily (meteorological) data from the Synop stations available in the https://www.ogimet.com/ repository. The data are processed only if temperature or precipitation fields are present.
ogimet_daily( date = c(Sys.Date() - 30, Sys.Date()), coords = FALSE, station = NA, hour = 6, allow_failure = TRUE )
ogimet_daily( date = c(Sys.Date() - 30, Sys.Date()), coords = FALSE, station = NA, hour = 6, allow_failure = TRUE )
date |
start and finish of date (e.g., date = c("2018-05-01","2018-07-01") ). By default last 30 days. |
coords |
add geographical coordinates of the station (logical value TRUE or FALSE) |
station |
WMO ID of meteorological station(s). Character or numeric vector |
hour |
time for which the daily raport is generated. Set default as hour = 6 (i.e. 6 UTC) |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
data.frame with historical meteorological data for the daily summaries
# downloading daily summaries for last 30 days. station: New York - La Guardia new_york = ogimet_daily(station = 72503, coords = TRUE)
# downloading daily summaries for last 30 days. station: New York - La Guardia new_york = ogimet_daily(station = 72503, coords = TRUE)
The object contains pre-downloaded atmospheric (sounding) profile for Leba, PL rawinsonde station. The measurement was taken 2000/03/23 at 00 UTC.
profile_demo
profile_demo
The data contains list of two data.frames as derived using sounding_wyoming() function
data(profile_demo) head(profile_demo)
data(profile_demo) head(profile_demo)
Downloading the measurements of the vertical profile of atmosphere (also known as sounding data). Data can be retrieved using TEMP and BUFR sounding formatting.
sounding_wyoming( wmo_id, yy, mm, dd, hh, min = 0, bufr = FALSE, allow_failure = TRUE )
sounding_wyoming( wmo_id, yy, mm, dd, hh, min = 0, bufr = FALSE, allow_failure = TRUE )
wmo_id |
international WMO station code (World Meteorological Organization ID); For Polish stations: Leba - 12120, Legionowo - 12374, Wrocław- 12425 |
yy |
year - single number |
mm |
month - single number denoting month |
dd |
day - single number denoting day |
hh |
hour - single number denoting initial hour of sounding; for most stations this measurement is done twice a day (i.e. at 12 and 00 UTC), sporadically 4 times a day |
min |
minute - single number denoting initial minute of sounding; applies only to BUFR soundings. |
bufr |
|
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
Returns two lists with values described at: weather.uwyo.edu ; The first list contains:
PRES - Pressure (hPa)
HGHT - Height (metres)
TEMP - Temperature (C)
DWPT - Dew point (C)
RELH - Relative humidity (%)
MIXR - Mixing ratio (g/kg)
DRCT - Wind direction (deg)
SKNT - Wind speed (knots)
THTA = (K)
THTE = (K)
THTV = (K)
The second list contains metadata and calculated thermodynamic / atmospheric instability indices (for TEMP soundings only)
A list of 2 data.frames where first data frame represents parameters of upper parts o with columns describing the meteorogical parameters (e.g. temperature, air pressure) where each row represent a measurement, depending on the height. Second data.frame presents a description of the conditions under which the sounding was carried out.
http://weather.uwyo.edu/upperair/sounding.html
############################################################################## # download data for Station 45004 starting 1120Z 11 Jul 2021; Kowloon, HONG KONG, CHINA # using TEMP and BUFR sounding formats ############################################################################## TEMP = sounding_wyoming(wmo_id = 45004, yy = 2021, mm = 07, dd = 17, hh = 12, min = 00) head(TEMP[[1]]) BUFR = sounding_wyoming(wmo_id = 45004, yy = 2021, mm = 07, dd = 17, hh = 12, min = 00, bufr = TRUE) head(BUFR[[1]]) ############################################################################## ### example with a random date to download sounding from LEBA, PL station: ### ############################################################################## profile = sounding_wyoming(wmo_id = 12120, yy = sample(2000:2019,1), mm = sample(1:12,1), dd = sample(1:20,1), hh = 0) # plot(profile[[1]]$HGHT, profile[[1]]$PRES, type = 'l')
############################################################################## # download data for Station 45004 starting 1120Z 11 Jul 2021; Kowloon, HONG KONG, CHINA # using TEMP and BUFR sounding formats ############################################################################## TEMP = sounding_wyoming(wmo_id = 45004, yy = 2021, mm = 07, dd = 17, hh = 12, min = 00) head(TEMP[[1]]) BUFR = sounding_wyoming(wmo_id = 45004, yy = 2021, mm = 07, dd = 17, hh = 12, min = 00, bufr = TRUE) head(BUFR[[1]]) ############################################################################## ### example with a random date to download sounding from LEBA, PL station: ### ############################################################################## profile = sounding_wyoming(wmo_id = 12120, yy = sample(2000:2019,1), mm = sample(1:12,1), dd = sample(1:20,1), hh = 0) # plot(profile[[1]]$HGHT, profile[[1]]$PRES, type = 'l')
Calculate the distance between two points on the surface of a spheroid using Vincenty's formula. This function can be used when GIS libraries for calculating distance are not available.
spheroid_dist(p1, p2)
spheroid_dist(p1, p2)
p1 |
coordinates of the first point in decimal degrees (LON, LAT) |
p2 |
coordinates of the second point in decimal degrees (LON, LAT) |
numerical vector with distance between two locations (in kilometers)
p1 = c(18.633333, 54.366667) # longitude and latitude for Gdansk, PL p2 = c(17.016667, 54.466667) # longitude and latitude for Slupsk, PL spheroid_dist(p1, p2)
p1 = c(18.633333, 54.366667) # longitude and latitude for Gdansk, PL p2 = c(17.016667, 54.466667) # longitude and latitude for Slupsk, PL spheroid_dist(p1, p2)
Retrieving current metadata for stations used in the telemetric systems of the IMGW-PIB datastore (danepubliczne.imgw.pl/datastore)
stations_meteo_imgw_telemetry()
stations_meteo_imgw_telemetry()
data table with metadata for over 500 stations. Metadata contains: station ID, station name, river, latitude, longitude, altitude
telemetry_stations = stations_meteo_imgw_telemetry()
telemetry_stations = stations_meteo_imgw_telemetry()
Returns a list of meteorological stations with their coordinates from the Ogimet webpage. The returned list is valid only for a given day
stations_ogimet( country = "United Kingdom", date = Sys.Date(), add_map = FALSE, allow_failure = TRUE )
stations_ogimet( country = "United Kingdom", date = Sys.Date(), add_map = FALSE, allow_failure = TRUE )
country |
country name; Every word must be written with capital letters (e.g. "United Kingdom") |
date |
a day when measurements were done in all available locations |
add_map |
logical - whether to draw a map based on downloaded dataset (requires |
allow_failure |
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE |
A data.frame with columns describing the synoptic stations in selected countries where each row represent a statation.
If add_map = TRUE
additional map of downloaded data is visualized.
stations_ogimet(country = "Australia", add_map = TRUE)
stations_ogimet(country = "Australia", add_map = TRUE)
Function for downloading & testing url/internet connection according to CRAN policy Example solution strongly based on https://community.rstudio.com/t/internet-resources-should-fail-gracefully/49199/12 as suggested by kvasilopoulos
test_url(link, output, quiet = FALSE)
test_url(link, output, quiet = FALSE)
link |
character vector with URL to check |
output |
character vector for output file name |
quiet |
logical vector (TRUE or FALSE) to be passed to curl_download function. FALSE by default |
No return value, called for side effects
link = "https://www1.ncdc.noaa.gov/pub/data/noaa/2019/123300-99999-2019.gz" output = tempfile() test_url(link = link, output = output)
link = "https://www1.ncdc.noaa.gov/pub/data/noaa/2019/123300-99999-2019.gz" output = tempfile() test_url(link = link, output = output)