An introduction to `hydroscoper`
Hydroscope is the Greek National Data Bank for Hydrological and Meteorological Information, a result of long-standing efforts by numerous Greek scientists in collaboration with various companies and associations. It was implemented in three phases, funded by the Ministry of Development, the Ministry of Environment and Energy and the European Union.
This National Data Bank provides several data sources from various organisations via a web interface. Each participating organisation keeps its data on its own server using a database system for the storage and management of information. These organisations are:
- Ministry of Environment and Energy.
- Ministry of Rural Development and Food.
- National Meteorological Service.
- National Observatory of Athens.
- Greek Prefectures.
- Public Power Corporation.
The above data are structured as tables and space separated text files, but are in Greek, thus limiting their usefulness. Another issue with Hydroscope is the lack of comprehensive look-up tables about the available data, which are spread across many different databases.
hydroscoper provides functionality for automatic retrieval and translation of Hydroscope’s data to English. The main functions that can be utilized is the family of functions,
get_data, etc., to easily download Hydroscope’s data as
The package covers Hydroscope’s data sources using the Enhydris API. The Enhydris database is implemented in PostgreSQL and details about the about the Web-service API here.
The internal datasets of the package can be used to run queries on the available Hydroscope’s stations and time series data, reducing the time needed for downloading and data wrangling, as these data are rarely modified. These datasets are:
It is a comprehensive look-up table with geographical and ownership information of the available stations in all Hydroscope’s databases. The variables are:
station_idThe station’s ID.
nameThe station’s name.
water_basinThe station’s Water Basin.
water_divisionThe station’s Water Division.
ownerThe station’s owner.
longitudeThe station’s longitude in decimal degrees, (ETRS89).
latitudeThe station’s latitude in decimal degrees, (ETRS89).
altitudeThe station’s altitude, meters above sea level.
subdomainThe corresponding Hydroscope’s database.
It is also a look-up table with all the available measurements for a given station in a given Hydroscope’s database, with units of measurement and times of those measurements. The variables are:
time_idThe time series ID.
station_idThe corresponding station’s ID.
variableThe time series variable type.
timestepThe timestep of time series.
unitsThe units of the time series.
start_dateThe starting date of time series values.
end_dateThe ending date of time series values.
subdomainThe corresponding Hydroscope’s database.
- Ministry of Environment and Energy, National Observatory of Athens and Greek Prefectures,
- Ministry of Rural Development and Food,
- National Meteorological Service,
- Greek Public Power Corporation,
- Only the two Ministries allow to download time series values freely.
kyysub-domains are maintained by the National Technical University Of Athens and these servers work seamlessly.
dehsub-domain is maintained by the Greek Public Power Corporation and occasionally the server is down.
This is a basic example which shows how to get the stations’ and time series’ data from the Hydroscope’s Ministry of Environment and Energy database,
We will use the package’s data
timeseries, to reduce the time needed with data munging. We can subset the station’s data for the
kyy sub-domain with:
# load data data("stations") # subset stations data kyy_stations <- subset(stations, subdomain == "kyy") # view kyy stations kyy_stations #> # A tibble: 425 × 9 #> station_id name water_basin water_division owner longitude latitude altitude #> <int> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> #> 1 501032 AG. … "KOURTALIO… GR13 min_… NA NA NA #> 2 200246 GEPH… "ALPHEIOS … GR01 min_… 22.0 37.5 318 #> 3 200237 TROP… "ALPHEIOS … GR01 min_… 22.0 37.7 728. #> 4 200231 BYTI… "ALPHEIOS … GR01 min_… 22.2 37.7 1011. #> 5 200200 LYKO… "ALPHEIOS … GR01 min_… 22.2 37.9 758. #> 6 200236 MEGA… "ALPHEIOS … GR01 min_… 22.1 37.4 429. #> 7 200244 ODOG… "REMA CHOR… GR01 min_… 21.8 37.0 182. #> 8 200204 TRIP… "ALPHEIOS … GR01 min_… 21.9 37.9 570. #> 9 200198 KAST… "ALPHEIOS … GR01 min_… 22.0 37.9 792. #> 10 200239 PERD… "ALPHEIOS … GR01 min_… 22.0 37.7 837. #> # … with 415 more rows, and 1 more variable: subdomain <chr>
Let’s plot these stations using the package’s dataset
ggplot() + geom_polygon(data = greece_borders, aes(long, lat, group = group), fill = "grey", color = NA) + geom_point(data = kyy_stations, aes(x = longitude, y = latitude), color = "#E64B35FF") + coord_fixed(ratio=1) + theme_bw() #> Warning: Removed 11 rows containing missing values (geom_point).
To get the time series’ data for the station
200200 we can use:
station_ts <- subset(timeseries, station_id == 200200) station_ts
We can download the station’s precipitation time series 56:
ts_raw <- get_data(subdomain = "kyy", time_id = 56) ts_raw
Let’s create a plot: