Water Quality in a Spanish River (GLOBAQUA)

Water Quality in a Spanish River (GLOBAQUA)

Using R and ArcGIS to understand water quality in the River Ebro in Spain


What was made: 


Background and objectives: 

The River Ebro is the largest Mediterranean river in Spain and also one of the largest catchments in Europe. The river suffers from multiple stressors due to various land uses, such as farming, industry and urbanistation. These are impacting on the biota and ecological status of the river and the catchment. Real time water quality data taken from gauges along the river (shown on the cover picture from ArcGIS) will help to predict the status of the river in ungauged sections, and therefore improve management techniques.This 4 month project working with GLOBAQUA is the final part of my MSc at the University of Manchester (Applications in Environmental Science), and I will be spending this time at the Helmholtz Institute in Halle, Germany, where I will receive help and support from academics.

  • To use R to interpolate water quality at ungauged sections of the River Ebro
  • Specifically to use the rtop package based upon the top-kriging approach, to provide geostatistical interpolation
  • To use ArcGIS to map the river catchment and data
  • To improve management techniques in the Ebro in relation to water quality
  • To improve the biota and ecological status of the river

How it was made

Useful terms and definitions
  • Geostatistics - A branch of statistics focusing on spatial or spatiotemporal datasets
  • Kriging - A group of geostatistical techniques to interpolate the value of a random field
  • Top kriging - The method conceptualizes catchments as space-time filters and exploits the space-time correlations of runoff along the stream network topology.
Feeling during this step: 
Learning how to use R
  • Learnt how to use R by watching a number of videos on youtube (link below)
  • Also took a short course on Udacity called  Data Analysis with R (link below)
  • Takes a fair amount of time but introduces you to the basics
  • Use an Open Dataset in link below
  • Installed the RTOP package in R for top kriging
  • Read paper by SKOIEN et al in order to understand the basics of how the package works (link below)
Feeling during this step: 
Converting the data

Given a large amount of data in CSV format. It was essential to interpret the data correctly and R was used to calculate batch means using the DLPLY package (details can be found on inside-r or other R forums).The average annual means for temperature and dissolved oxygen were calculated for each of the gauge stations along the river Ebro.This data was then linked with the river subbasin shapefiles in ArcMap in order to be able to use the shapefiles for the top kriging (as described in SKOIEN et al paper).The next stage was to convert the package in order to specifically analyse temperature and dissolved oxygen instead of stream flow.This was relatively simple and just required changing a couple of lines of code from the original package (more info to follow)Ran the package and then managed to interpolate the temperature and DO on the river in the following pictures below. As you can see the top kriging appeared to work well and the predicted results were similar to the observed.More analysis to continue... 

Feeling during this step: