Use programming languages to interact with, analyze, and visualize data is an increasingly important skill for hydrogeologists to have. Coding-based science makes it easier to process and visualize large amounts of data and increase the reproducibility of your work, both for yourself and others.
There are many programming languages out there; anecdotally, the most commonly used languages in the hydrogeology community are Python, MATLAB, and R. Kevin previously wrote a post highlighting Python’s role in the hydrogeology toolbox, in particular the excellent FloPy package for creating and interacting with MODFLOW models.
In this post, we’ll focus on R to explore some of the tools that can be used for hydrogeology. R uses ‘packages’, which are collections of functions related to a similar task. There are thousands of R packages; recently, two colleagues and I compiled a ‘Hydrology Task View’ which compiles and describes a large number of water-related packages. We found that water-related R packages can be broadly categorized into data retrieval, data analysis, and modelling applications. Though packages related to surface water and meteorological data constitute the bulk of the package, there are many groundwater-relevant packages for each step of a typical workflow.
Here, I’ll focus on some of the packages I use most frequently.
Instead of downloading data as a CSV file and reading it into R, many packages exist to directly interface with online water data portals. For instance, dataRetrieval and waterData connect to the US Geological Survey water information service, tidyhydat to the Canadian streamflow monitoring network, and rnrfa for the UK National River Flow Archive.
Many common data analysis tasks are contained in various R packages. hydroTSM and zoo are excellent for working with timeseries data, and lfstat calculates various low-flow statistics. The EcoHydRology package contains an automated digital filter for baseflow separation from streamflow data.
While R does not have an interface to MODFLOW, there are many other models that can be run within R. The boussinesq package, unsurprisingly, contains functions to solve the 1D Boussinesq equation, and the kwb.hantush package models groundwater mounding beneath an infiltration basin. The first and only package I’ve ever made, streamDepletr, contains analytical models for estimating streamflow depletion due to groundwater pumping. To evaluate your model, check out the hydroGOF package which calculated many common goodness-of-fit metrics.
Louise Slater and many co-authors currently have a paper under discussion about ‘Using R in Hydrology’ which has many excellent resources.
While not hydrogeology-specific, there are many packages for generic data analysis and visualization that will be of use to hydrogeologists. In particular, the Tidyverse has a number of packages for reading, tidying, and visualizing data such as dplyr and ggplot2.
Claus Wilke’s Fundamentals of Data Visualization book (free online) was written entirely within R and shows examples of the many ways that R can be used to make beautiful graphs.
Freeze-frame from the featured IAEA video on drought conditions in Cape Town.
Post by Jared van Rooyen, PhD student in Earth Science at Stellenbosch University, in South Africa.
When the Cape Town water crisis first emerged it took almost a year before active contingencies were put in place. Four major ideas were proposed: (1) Intense water restrictions for municipal water users, (2) greywater recycling facilities, (3) groundwater augmentation of water supplies, and (4) desalination.
Although not all the proposed ideas came to fruition, there was a significant increase in the installation of well points and boreholes for municipal and private use. The national and provincial governments began the investigation and development of three major aquifers in the Western Cape. Unfortunately (or fortunately), the initial estimates for extraction were never realized as a result of poor water quality in theCape Flats aquifer, power struggles between government parties and typical delays in service delivery in South Africa. In contrast, private groundwater consultants are benefiting from the high demand for groundwater use by residents installing private wells to alleviate the pressures of stringent water restrictions.
There are now two plausible scenarios for the groundwater use situation in the Western Cape: either we have not yet begun to abstract any significant amounts of groundwater, or we lack the data to show if we have. It is difficult to provide empirical evidence on whether groundwater levels are indeed declining and if it is a result of the drought (or abstraction or both). The trouble is that, unlike surface water storage where we can see the direct evidence of the drought, how much water is in an aquifer cannot be directly observed and must be estimated via an indirect method.
Estimating changes in groundwater availability usually requires detailed baseline data to be available, meaning that the state of a resource is relative to the baseline data available and can be over/underestimated as a result. One example of this was the subject of a controversial string ofnews articles released in the first months of 2019.
The Department of Water Affairs (DWS) released an interactive map of monitoring boreholes across South Africa which includes a record of normalized water levels (0% being the lowest measured water level in meters above sea level (masl) and 100% the highest measured water level) averaged over a province (Figure 1). The graph shows a decline in average water levels in the last three years, but the record only goes back to 2009 and it is difficult to say if this a drought signal, a result of abstraction, or simply a natural fluctuation over a longer timescale.
Figure 1: Plot showing the severity of groundwater levels in the Western Cape of South Africa, averaged groundwater levels are plotted as a normalized percentage of the lowest and highest recorded levels in the borehole history. Credit: NIWIS DWA South Africa
Respected researcher and geochemist Dr. Meris Mills investigated historical data from the national groundwater archive and found that much of the data before 2015 were too sparse to be considered representative of the groundwater level. Data density and availability still is a major limiting factor in groundwater studies in South Africa.
Dr. Mills found that 55% of boreholes show statistically significant declining water levels and 63% of boreholes recorded an all time low water level after 2015 to late 2018 (since 1978). She concluded that fractured rock aquifers were the least affected and that 37% of boreholes with falling water levels were, in fact, not related to the recent drought. The cause for these declines in water levels are still unknown.
It is still difficult to quantify how much groundwater contributed to the recovery of Cape Town’s dam levels, if at all, but the resultant interest in long term groundwater supply has sparked debate surrounding local groundwater resources.
It is also clear that the effects of the drought on groundwater resources remain to be fully realized, however our groundwater, in general, is more resilient to change than we may think. Depending on the angle you look at it, initial findings may either indicate that groundwater is potentially a lifeline to cities crippled by a water supply crisis, or a time bomb with a delayed fuse.
The Groundwater Drought Initiative is collecting more and more groundwater level data and groundwater drought impacts. The Initiative is very happy to welcome new partners and supporters from as far East as Ukraine and as far South as Albania, increasing the number of participating countries and countries currently considering to participate to 23 (see map). Additionally, a first getting-to-know-each-other & info meeting was held at EGU19 with participants from Austria, Belgium, Canada, Estonia, Germany, Latvia, Luxembourg, Netherlands, Norway, UK, Ukraine, and Switzerland. If you are from Bulgaria, Greece, Hungary, Italy, Romania, Slovakia or any of the other yellow countries on the map below and you have groundwater data (or contacts in organisations who could help) or you are interested in groundwater drought, please contact Bentje Brauns (firstname.lastname@example.org).
The IAHS Panta Rhei Working Group on Large Sample Hydrology
The IAHS Panta Rhei focus on efforts to facilitate the production and exchange of datasets worldwide. This year at EGU, the group organised a splinter meeting to discuss the generation of large sample catchment datasets in the cloud and a session (HS2.5.2 Large-sample hydrology: characterising and understanding hydrological diversity) that showcased several recent data- and model-based efforts on large-sample hydrology from new global datasets to large multi-model ensembles. If you are interested in being updated on the activities of the group then please contact Gemma Coxon (email@example.com) to be added to the mailing list.
There seems to be a lot going on in the world of hydrological data sharing! To share your own story or initiative, please leave a reply below.
Anne Van Loon (website | @AnneVanLoon) is a Senior Lecturer in Physical Geography in the School of Geography, Earth and Environmental Sciences at the University of Birmingham.
Gemma Coxon (website) is a Postdoctoral Research Associate and Lecturer in Hydrology in the School of Geographical Sciences at the University of Bristol.
Bentje Brauns (website) is a Hydrogeologist at the British Geological Survey.
Tom Gleeson talking about doughnut economics and showing great doughnut eating restraint.
Water Underground creator Tom Gleeson prepared this quick research video (with no more than a toothbrush, a file holder, and a doughnut, in one take!) for the Ripples project meeting at the Stockholm Resilience Centre, that was held in April. In this video, he talks about using doughnut economics for linking water planetary boundaries and UN Sustainable Development Goals.
Curious about why a toothbrush features in the video? For the answer, you’ll need to watch Tom’s previous research video from last summer (see below), on “Revisiting the planetary boundary for water”.
Every April, the European Geophysical Union (EGU) holds an annual meeting in Vienna. With thousands of presentations spread out over a full week, it can feel like you’re surrounded by a deluge of water-related options – particularly since the conference center is on an island! To help narrow down the schedule! Here, we present a few water-related sessions and events each day that caught our attention. Feel free to suggest more highlights on Twitter (using #EGU19) or in the comments section!
This short course is for everyone who has some dealings with people in their research, such as stakeholders, citizen science, The aim of the session is to demystify Social Science and give practical tips & tricks.
Several other groups and blogs have also compiled water-relevant sessions. Make sure to check out their recommendations, as well!
‘Groundwater-surface water interactions’ has become standard hydrologic lexicon and a perennial favorite session title at various conferences… but how often do you hear the phrase ‘groundwater-climate interactions’?
Groundwater representation, assimilation and evaluation in climate models
Remote Sensing and in-situ observations on groundwater
Groundwater-climate interactions with a special focus on Nebraska
And in the afternoons we convened discussion groups focused on ‘groundwater representation in continental to global hydrologic models’ and ‘groundwater-climate interactions’ and arguably just as importantly we ate lots of great food including an awesome fusion dinner and dumplings at the famous Din Tai Fung.
I would love to say that we could provide you with a simple, robust answer to the leading question of how and where groundwater is connected to climate – a holy grail of Earth System science. But like all good questions, the answer at least right now is ‘a little bit in some places, and it depends how you look at it’. We discussed the first enticing but preliminary results of potential hotspots of groundwater-climate interactions, expounded on the importance to water sustainability and dissected vadose zone parameterizations in land surface models but the quest for this holy grail goes on… We plan to meet again in a few years in Saskatchewan and maybe have a few more answers. Do you want to join us on this holy grail quest, and maybe end up making ‘groundwater-climate interactions’ more standard lexicon?
P.S. Thanks to Min-Hui Lo and his group at National Taiwan University for the excellent hospitality and organization!
P.S.S. Just in case it goes viral, the term ‘baddest-ass model’ was first used by Jay Famiglietti (see below).
Have you ever taken a walk on the beach during a lowering (ebbing) tide and see mini-rivers grow and create beautiful drainage patterns before your eyes? These short-lived groundwater seepage features (Fig. 1A) are tiny (and fast) analogs of how groundwater has shaped some parts of Mars! It appears that groundwater loosening sediments can lead to all sorts of scales of erosion on both Earth and Mars.
But isn’t Mars too cold for liquid water? The answer is generally a strong yes for the past few billion years, but amazingly enough, there appears to have been some local places where groundwater discharged to the Martian surface and left behind telltale signs.
Because Mars is cold at its land surface (mean surface temperature of -50 C with daily swings from 0 C to -100 C) with a thinner atmosphere than Earth’s, water on the Martian surface can exist as ice (as in the polar ice cap), but sublimation and evaporation would quickly wick any water near the surface. So, liquid water on Mars needs both more pressure and a good bit of heat for mobile groundwater based on the phase diagram below (circle with M shows the present day Martian surface conditions).
It turns out that the most expansive evidence of liquid groundwater on Mars comes from deep at the bottom of craters (…deeper than 5 km!), where the Martian geothermal gradient (~10 C/km [Michalski et al.2013]) heats up to the point where groundwater systems, probably made up of brines, can seep across the crater walls. Without the craters, the groundwater wouldn’t have anywhere to discharge, but extraterrestrial hydrogeologists (really based on the geomorphology, but using E.T. hydrogeology principles) have identified numerous craters with groundwater seepage erosional patterns (Figure 1). The question remains open on how connected the Martian “aquifers” could be, or if the craters represent only local flow systems.
With liquid groundwater transporting the chemical-rich waters from deeper geothermal areas, the conditions could be right for supporting a deep Martian biosphere. Buried in under the Martian ice, soil, and rock microbial life could have evolved in the subterranean shelter from cosmic radiation. Groundwater flow, potentially related to geothermal conditions, could then have served as the conveyor belt for energy-rich molecules to feed microbial life in the subsurface (and still could?).
So far, Earth is the only celestial body in our solar system with an active water-hydrologic cycle, making us the lucky green planet. But, there could be a methane-based hydrologic cycle on Titan with “methanifers” as methane aquifers! For more information on extraterrestrial hydrogeology, Baker et al. (2005) provides a great overview of the planetary, lunar, and exo-planetary potential for water and groundwater, loosely summarized in this table.
At the moment, Earthlings don’t know that much yet about the paleo-hydrologic processes on Mars. But with new boots…I mean wheels…on the ground in two water-focused locations, new clues could start rolling in on Martian groundwater. The recently-arrived InSight lander will probe the Martian subsurface by drilling 5 m deep and listen for acoustic signals for even more information on the interior of Mars. The next Mars Rover is scheduled to take flight in 2020 for the Jezero Crater, where a river delta could help unravel the water-life story of Mars. And could have some groundwater surprises! At only about 1 km deep, the focus in mainly on tracking down signs of life and unravelling surface hydrologic and erosional processes on Mars, but a long list of expected outcomes does show the mission will keep an eye out for evidence of groundwater activities. Keep your feet grounded, eyes in the sky, and visions of Martian groundwater flying high and drilling low!
References Malin, M. C., and K. S. Edgett (2000), Evidence for Recent Groundwater Seepage and Surface Runoff on Mars, Science, 288(5475), 2330–2335, doi:10.1126/science.288.5475.2330. Michalski, J. R., J. Cuadros, P. B. Niles, J. Parnell, A. Deanne Rogers, and S. P. Wright (2013), Groundwater activity on Mars and implications for a deep biosphere, Nat. Geosci., 6(2), 133–138, doi:10.1038/ngeo1706.
 Stofan, E. R. et al. (2007), The lakes of Titan, Nature, 445(7123), 61–64, doi:10.1038/nature05438. Baker, V. R., J. M. Dohm, A. G. Fairén, T. P. A. Ferré, J. C. Ferris, H. Miyamoto, and D. Schulze-Makuch (2005), Extraterrestrial hydrogeology, Hydrogeol. J., 13(1), 51–68, doi:10.1007/s10040-004-0433-2. Robinson, K. L., and G. J. Taylor (2014), Heterogeneous distribution of water in the Moon, Nat. Geosci., 7(6), 401–408, doi:10.1038/ngeo2173. Jurac, S., M. A. McGrath, R. E. Johnson, J. D. Richardson, V. M. Vasyliunas, and A. Eviatar (2002), Saturn: Search for a missing water source, Geophys. Res. Lett., 29(24), 25-1-25–4, doi:10.1029/2002GL015855.
Kevin Befus leads the groundwater hydrology group in the Civil and Architectural Engineering Department at the University of Wyoming. With his research group, he studies how groundwater systems respond to hydrologic conditions over glacial timescales and in mountainous and coastal environments. You can follow along with Kevin’s research through any of the links below:
Episode 4 – Karst Groundwater: quick and slow at the same time?
We often associate groundwater with large water storage and very slow water movement for instance compared to rivers. But is it possible that groundwater flow can be as quick as stream flow and, at the same aquifer, flow for several months or years before it is reaching the surface again? Of karst, it is possible! When chemical weathering is able dissolve carbonate rock, cracks and fissures may grow to a subsurface channel system that can take vast amounts of water flow (see Of Karst! – episode 2).
The schematic figure below shows how this affects water flow in a karst system. At the surface, water may flow for some distance (external runoff towards the recharge area or internal runoff within the recharge area), before it reaches a dissolution widened vertical crack or fissure. On its way, part of it may slowly infiltrate into the soil but the stronger the rainfall event, the more water will infiltrate quickly into cracks and fissures after being redistributed laterally. Consequently, slow and quick infiltration will be followed by slow and quick vertical flow through the vadose zone. The former through the carbonate rock matrix, the latter through the interconnected system of dissolution caves. Finally, recharge and groundwater flow take place, again quickly through the caves and slowly through the matrix. When passing the system through the cave network, water can enter and leave the system within several hours. When taking the slow and diffuse path, the transit through the system may take months to years.
Because of this behavior, hydrogeologists often speak about the Duality of Karstic Groundwater Flow and storage, although it is known that there is a wide range of dynamics between quick flow through the caves and slow flow through the matrix and that lateral redistribution between the interconnected caves and the matrix takes place at almost every part of the system.
Figure 1: Schematic description of karstic groundwater flow and storage (Hartmann et al., 2014; modified)
A rather uncomfortable lesson on quick flow processes in karst was learned by a group of school students on a trip through a karstic cave in Thailand. Due to the quick recharge processes explained above, the groundwater tables could quickly rise blocking the return path of the group and resulting in a dramatic rescue mission:
In order to predict the impact of interplay of quick and slow karstic groundwater processes on cave water levels or water resources in general, karst-specific simulation models are necessary. If you are interested in those, follow the Water Underground blog’s postings and wait for Of Karst! Episode 5, which will introduce karstic groundwater modelling.
While climate change makes dramatic changes to weather and ecosystems on the surface, the impact on the world’s groundwater is likely to be delayed, representing a challenge for future generations.
Groundwater stores are replenished by rainfall at the surface in a process known as “recharge”. Unless intercepted by human-made pumps, this water eventually flows by gravity to “discharge” in streams, lakes, springs, wetlands and the ocean. A balance is naturally maintained between rates of groundwater recharge and discharge, and the amount of water stored underground.
When changes in climate or land use affect the rate of groundwater recharge, the depths of water tables and rates of groundwater discharge must also change to find a new balance.
The time it takes for this new equilibrium to be found – known as the groundwater response time – ranges from months to tens of thousands of years, depending on the hydraulic properties of the subsurface and how connected groundwater is to changes at the land surface.
Estimates of response times for individual aquifers – the valuable stores of groundwater which humans exploit with pumps – have been made previously, but the global picture of how quickly or directly Earth’s groundwater will respond to climate change in the coming years and decades has been uncertain. To investigate this, we mapped the connection between groundwater and the land surface and how groundwater response time varies across the world.
The long memory of groundwater
We found that below approximately three quarters of the Earth’s surface, groundwater response times last over 100 years. Recharge happens unevenly around the world so this actually represents around half of the active groundwater flow on Earth.
This means that in these areas, any changes to recharge currently occurring due to climate change will only be fully realised in changes to groundwater levels and discharge to surface ecosystems more than 100 years in the future.
We also found that, in general, the driest places on Earth have longer groundwater response times than more humid areas, meaning that groundwater stores beneath deserts take longer to fully respond to changes in recharge.
In wetter areas where the water table is closer to the surface, groundwater tends to intersect the land surface more frequently, discharging to streams or lakes.
This means there are shorter distances between recharge and discharge areas helping groundwater stores come to equilibrium more quickly in wetter landscapes.
Hence, some groundwater systems in desert regions like the Sahara have response times of more than 10,000 years. Groundwater there is still responding to changes in the climate which occurred at the end of the last glacial period, when that region was much wetter.
In contrast, many low lying equatorial regions, such as the Amazon and Congo basins, have very short response times and will re-equilibrate on timescales of less than a decade, largely keeping pace with climate changes to the water cycle.
Despite both being in the UK and existing in the same climate, they have distinctly different hydraulic properties and, therefore, groundwater response times. Chalk responds in months to years while the sandstone aquifers take years to centuries.
In comparison to surface water bodies such as rivers and lakes which respond very quickly and visibly to changes in climate, the hidden nature of groundwater means that these vast lag times are easily forgotten. Nevertheless, the slow pace of groundwater is very important for managing freshwater supplies.
The long response time of the UK’s Permo-Triassic sandstone aquifers means that they may provide excellent buffers during drought in the short term. Relying on groundwater from these aquifers may seem to have little impact on their associated streams and wetlands, but diminishing flows and less water could become more prevalent as time goes on.
This is important to remember when making decisions about what rates of groundwater abstraction are sustainable. Groundwater response times may be much longer than human lifetimes, let alone political and electoral cycles.
Mark Cuthbert is a Research Fellow and Lecturer in the School of Earth and Ocean Sciences, at Cardiff University in the United Kingdom. Mark’s work currently focuses on coupled hydrological-climate process dynamics in order to: understand groundwater sustainability; improve interpretations of terrestrial paleoclimate proxy archives; and understand how Quaternary paleoenvironments influenced human evolution.
Kevin Befus leads the groundwater hydrology group in the Civil and Architectural Engineering Department at the University of Wyoming. With his research group, he studies how groundwater systems respond to hydrologic conditions over glacial timescales and in mountainous and coastal environments.
Tom Gleeson leads the Groundwater Science and Sustainability group in the Civil Engineering Department at the University of Victoria. His research interests include groundwater sustainability, mega-scale groundwater systems, groundwater recharge and discharge and fluid flow around geologic structures. Tom is also the founder of this blog, WaterUnderground.
I am currently on sabbatical with Thorsten Wagener’s group at the University of Bristol. While on campus, I stumbled upon this quote from Nelson Henderson (a farmer from Manitoba). It encapsulates what I have been thinking about groundwater sustainability for a number of years: “The true meaning of life is to plant trees, under whose shade you do not expect to sit”. For me, as a hydrogeologist, I would re-write it to be something like: “The true meaning of life is to protect recharge and flow in an aquifer, from which you do not expect to pump.
Take a look at the original plaque and my doctored, groundwater-centric version. You never know, groundwater sustainability may just become the next fad in the inspirational quote universe …