A borehole log tells you where water was struck on the day it was drilled. A standpipe tells you where the water sits, month after month. In Part 8 we read the laboratory tests from the A417 Missing Link investigation. The same AGS4 file holds two and a half years of groundwater monitoring on Crickley Hill, and this part turns it into hydrographs, maps and an animated QGIS project.
There are 68 installations and 103,309 readings. By the end you will know which of those readings are water levels, which pipes were dry, which unit each pipe is measuring, how the water rose and fell from 2019 to 2021, and where it sits in the limestone under the escarpment.
The steps are:
- read the monitoring groups, MONG and MOND;
- separate the water level dips from everything else and flag dry pipes;
- find the response zone of each pipe and the unit it is in;
- draw hydrographs for each unit;
- map the depth to groundwater and contour the groundwater level in the limestone;
- write the standpipes, readings and contours to a GeoPackage;
- animate the readings with the QGIS Temporal Controller.
The code is groundwater_monitoring.py and qgis_groundwater.py for the QGIS project. Like Part 8, it uses a417_ags.py from Part 1 for the repaired borehole locations and geology.
Step 1: read the monitoring groups
The monitoring data is only in the file the contractor deposited with the BGS, the same one Part 8 downloaded. If you ran Part 8, the script finds it in data/ and skips the download.
path = fetch(f"{ACCESSIONS}/download/{A.ITEM}?fileName={quote(ORIGINAL)}", DATA / ORIGINAL)tables, headings = AGS4.AGS4_to_dataframe(str(path))mon = A.numeric({g: tables[g] for g in ["MONG", "MOND"]})mong, mond = mon["MONG"], mon["MOND"]mond["MOND_RDNG"] = pd.to_numeric(mond.MOND_RDNG.astype(str).str.strip(), errors="coerce") # typed XNmond["time"] = pd.to_datetime(mond.MOND_DTIM, errors="coerce")print(f"MONG: {len(mong)} installations in {mong.LOCA_ID.nunique()} holes; types: " + ", ".join(f"{t or '(blank)'} {n}" for t, n in mong.MONG_TYPE.value_counts().items()))print(f"MOND: {len(mond):,} readings from {mond.time.min():%d %b %Y} to {mond.time.max():%d %b %Y}")kinds = mond.groupby(["MOND_TYPE", "MOND_UNIT"]).size().rename("rows").reset_index()print(kinds.to_string(index=False))=== Step 1: the monitoring installations and readings ===MONG: 68 installations in 62 holes; types: SP 56, ICM 7, (blank) 3, SPIE 2MOND: 103,309 readings from 31 Jan 2019 to 20 Oct 2021MOND_TYPE MOND_UNIT rows DBSE - 3 DBSE m 2140 DO mg/l 8750 EC uS/cm 11343 PH - 11144 RDX mV 11343 RES ohmcm 11342 SAL PSU 11218 SAMPTEMP degC 11344 TDS ppm 11343 WDEP - 4 WDEP m 13335MONG has one row per installation: 56 standpipes (SP), two standpipe piezometers (SPIE), three with no type, and seven inclinometers (ICM), which measure ground movement rather than water. MOND has one row per measurement, and the table of MOND_TYPE shows what most of them are: dissolved oxygen, conductivity, pH, redox, resistivity, salinity, temperature and dissolved solids from a water quality sonde. The water levels are the WDEP rows, and DBSE is the measured depth to the base of the pipe.
MONG describes each installation: LOCA_ID and MONG_ID identify it, MONG_TYPE says what it is, MONG_TRZ and MONG_BRZ are the top and base of the response zone in metres below ground, and MONG_DIS is the installed depth. MOND holds the readings, keyed to the installation by LOCA_ID and MONG_ID: the date and time MOND_DTIM, the type MOND_TYPE, the value MOND_RDNG with its unit MOND_UNIT, and the field remarks MOND_REM.
Step 2: separate the water level dips and flag dry pipes
Two things hide inside the WDEP rows. When the sonde was lowered down a pipe, each of its readings was logged with the depth it was taken at, as a WDEP row with the remark “Water quality monitoring level”. And some visits recorded no reading at all. We drop both, after counting them:
wdep = mond[mond.MOND_TYPE.eq("WDEP")]quality = wdep.MOND_REM.eq("Water quality monitoring level")dips = wdep[~quality].copy()base = (mond[mond.MOND_TYPE.eq("DBSE")].groupby(PIPE + ["MOND_DTIM"], dropna=False).MOND_RDNG.first() .rename("base"))dips = dips.join(base, on=PIPE + ["MOND_DTIM"])dips["base"] = dips.base.fillna(dips.MONG_DIS) # measured depth to the base of the pipe, else as installedblank = dips[dips.MOND_RDNG.isna()]dips = dips[dips.MOND_RDNG.notna()].rename(columns={"MOND_RDNG": "depth"})dips["dry"] = dips.depth >= dips.base - DRY_TOLdips = dips.join(loca[["LOCA_NATE", "LOCA_NATN", "LOCA_GL"]], on="LOCA_ID")dips["level"] = dips.LOCA_GL - dips.depthA dip meter lowered into a dry pipe stops at the bottom, so a “depth to water” equal to the depth of the pipe means there was no water. DRY_TOL is 5 cm: any dip within 5 cm of the base measured on the same visit, or of the installed depth when the base was not measured, is flagged as dry. The level in metres above Ordnance Datum is the repaired ground level from Part 1 minus the depth.
Then we look for readings far out of step with the ones either side. A single dip more than 3 m away from both its neighbours, in the same direction, is more likely a misread tape or a typing slip than a real change in the groundwater:
dips = dips.sort_values(PIPE + ["time"])step = dips.groupby(PIPE, dropna=False)["level"]before, after = dips.level - step.shift(1), dips.level - step.shift(-1)dips["spike"] = ~dips.dry & (before.abs() > SPIKE) & (after.abs() > SPIKE) & (np.sign(before) == np.sign(after))wet = dips[~dips.dry & ~dips.spike]=== Step 2: separate the water level dips and flag dry pipes ===WDEP rows: 13,339; 10,893 are the depths of water quality readings, in 24 holes2,446 dips; 681 with no reading. Remarks on those: '(none)' 665, '19mm standpipe' 4, 'Turf has possibly regrown over the cover.' 3, 'Unable to monitor due to access constraints' 3, '19mm piezometer' 3, 'Unable to monitor - vehicle parked on position.' 1, '50mm standpipe' 1, 'Fly tipped over (mattress and timber).' 11,765 readings in 57 pipes, Jan 2019 to Jul 2021; 29 drydry readings by pipe: DSRC310 G1 1, DSRC314 G1 2, DSRC401 G1 1, DSRC404 G1 2, DSRC420 G1 2, OH407 G1 21out of step with the readings either side (kept, but left out of the statistics): DSRC224 23 Oct 2019 (-6.7 m), DSRCOH304 16 Jun 2021 (-8.5 m), OH417 18 Dec 2020 (+8.8 m)Of 13,339 WDEP rows, only 2,446 are dips, and 681 of those are blank. The remarks explain a few: a 19 mm pipe too narrow for the dip meter, a cover lost under turf, a parked van, a fly-tipped mattress. That leaves 1,765 readings in 57 pipes. Twenty-one of the 29 dry readings are in OH407, and DSRC310, dipped 27 times, gave a reading only once, at 30.05 m in a 30 m pipe: dry. So 56 pipes have a water level.
The dry and out-of-step readings stay in the data with a dry or spike flag, and they go into the GeoPackage too. Leaving them out of medians and ranges is a judgement you can see and reverse, which a silent delete is not.
Step 3: find what each pipe is measuring
A water level only means something once you know which ground it comes from. A standpipe reads the groundwater in its response zone, so we take the unit at the middle of each zone from GEOL, using the same interval join as Parts 6 and 8. One pipe, DSRC229, has its response zone entered upside down, with the top deeper than the base, so we swap those first:
pipes = mong[~mong.MONG_TYPE.eq("ICM")].copy() # inclinometers measure movement, not waterswap = pipes.MONG_TRZ > pipes.MONG_BRZpipes.loc[swap, ["MONG_TRZ", "MONG_BRZ"]] = pipes.loc[swap, ["MONG_BRZ", "MONG_TRZ"]].valuespipes["mid"] = (pipes.MONG_TRZ + pipes.MONG_BRZ) / 2m = pipes.reset_index().merge(geol, on="LOCA_ID")inside = m[(m.GEOL_TOP <= m.mid) & (m.mid < m.GEOL_BASE)].drop_duplicates("index").set_index("index")pipes["UNIT"] = inside.UNIT.reindex(pipes.index).fillna("NR")The script then works out each pipe’s median depth and level, its range and its number of readings, and flags any pipe where the water only ever sits in the bottom 75 cm of the response zone (SUMP). Water there may just be what drained into the sump of the pipe, so the real water table could be lower.
=== Step 3: the response zone of each pipe and the unit it is in ===response zones entered upside down: DSRC229 pipes readings median_depth median_level widest_rangegroupGreat Oolite Group 7 232 4.7 271.7 8.0Inferior Oolite Group 18 469 32.6 211.0 7.2Lias Group 13 464 15.9 172.2 18.6Other 4 75 10.3 240.8 7.8Superficial 14 493 3.8 162.6 3.1water only ever in the bottom 75 cm of the response zone: DSRC311 G1 (39.3 of 40.0 m), DSRC404 G1 (33.4 of 34.0 m), DSRC314 G1 (14.9 of 15.0 m), OH407 G1 (15.1 of 15.5 m)
The chart is worth reading pipe by pipe. The landslide deposits at the foot of the escarpment have shallow pipes with water within a few metres of the surface. The Inferior Oolite pipes on the plateau are long, mostly in the Birdlip Limestone, with the water 15 to 80 m down near the bottom of the response zone. The Great Oolite and Fuller’s Earth pipes, highest up the slope, hold water close to ground level, perched on the clays of the Fuller’s Earth.
Step 4: draw hydrographs for each unit
The pipes span 160 m of elevation, so plotting levels on one axis would squash every seasonal swing flat. Instead each reading is plotted as its change from that pipe’s own median, and the black line is the monthly median of the group. Lines break where a pipe went unmonitored for more than 90 days, so a gap is not drawn as a straight trend:
wet = wet.merge(pipes[PIPE + ["pipe", "group", "level_median"]], on=PIPE)wet["change"] = wet.level - wet.level_medianfor ax, grp in zip(axes, shown): g = wet[wet.group == grp] for pipe, p in g.groupby("pipe"): gap = p.time.diff() > pd.Timedelta(days=90) # break the line where monitoring paused p = pd.concat([p, p[gap].assign(time=p.time[gap] - pd.Timedelta(days=1), change=np.nan)]).sort_values("time") ax.plot(p.time, p.change, color=GROUPS[grp][1], lw=0.8, alpha=0.55, marker="o", ms=1.6) monthly = g.set_index("time").change.resample("MS").median() ax.plot(monthly.index + pd.Timedelta(days=14), monthly, color="black", lw=1.8)=== Step 4: hydrographs === Superficial: 14 pipes, highest monthly median +0.4 m in Jan 2021, lowest -0.5 m in Sep 2019; median range in a pipe 1.4 m Lias Group: 13 pipes, highest monthly median +0.5 m in Apr 2020, lowest -1.1 m in Jan 2019; median range in a pipe 2.0 m Inferior Oolite Group: 18 pipes, highest monthly median +0.5 m in Feb 2021, lowest -0.8 m in Sep 2020; median range in a pipe 2.2 m Great Oolite Group: 7 pipes, highest monthly median +1.2 m in Mar 2020, lowest -1.6 m in Sep 2020; median range in a pipe 2.0 m
All four units breathe with the seasons, but by different amounts. The landslide deposits barely move: the median pipe ranges over 1.4 m. The Great Oolite pipes respond most, rising 1.2 m above their medians in March 2020 and falling 1.6 m below by September 2020. September 2020 is the low point in the limestones too, and the winter of 2020/21 the high point: some Inferior Oolite pipes rose about 7 m, and the frames at the top of this page are those two moments.
The widest range, 18.6 m in the Lias Group, belongs to DSRC224. After it was installed in May 2019, its level fell from 217 m to about 205 m by September 2019, then settled near 201.7 m. That is the falling line at the top of the Lias panel. It looks like a pipe slowly equilibrating with low-permeability mudstone after installation, which is worth knowing before reading the first months of any new pipe as the groundwater level.
Step 5: map the depth to groundwater and the level in the limestone
Every pipe’s median depth to water goes on the LIDAR hillshade from Part 2, with the symbol shape showing the unit and its size the range of levels:
=== Step 5: depth to groundwater and the groundwater level in the limestone === Superficial: depth to water 1.1 to 15.4 m, median 3.8 m Lias Group: depth to water 0.3 to 38.0 m, median 15.9 m Inferior Oolite Group: depth to water 14.9 to 81.8 m, median 32.6 m Great Oolite Group: depth to water 1.8 to 12.8 m, median 4.7 m Other: depth to water 2.2 to 50.6 m, median 10.3 mThe depth to water depends far more on the unit than on where you stand. On the lower slopes, in the landslide deposits and Lias, water is a few metres down. In the Inferior Oolite limestones along the escarpment it is 15 to 82 m down. On the plateau to the south-east, the Great Oolite and Fuller’s Earth hold water within 13 m of the surface, well above the limestone’s water table below.
So a single groundwater surface across every pipe would mix separate bodies of water. The Birdlip Limestone is the one unit with enough pipes to contour on its own, 14 of them. We triangulate their median levels, mask the thin sliver triangles at the edge of the network, and contour every 2 m. Three pipes where the water only ever sat in the sump are drawn as open circles and kept out of the surface, because the water table there is somewhere below the bottom of the pipe:
lime = pipes[pipes.UNIT.eq("BLPL")]aq, low = lime[~lime.at_base], lime[lime.at_base]tri = Triangulation(aq.LOCA_NATE, aq.LOCA_NATN)tri.set_mask(TriAnalyzer(tri).get_flat_tri_mask(min_circle_ratio=0.05)) # drop sliver triangles at the edgesfilled = ax.tricontourf(tri, aq.level_median, levels=levels, cmap="Blues_r", alpha=0.6, zorder=2)lines = ax.tricontour(tri, aq.level_median, levels=levels, colors="#08306b", linewidths=0.9, zorder=3)Birdlip Limestone: 14 pipes contoured, median levels 196.7 to 217.1 m OD; highest DSRCOH414 217.1, DSRC418 215.7, DSRCOH308 215.5 near the escarpment edge (north of 215,900 N, west of 393,500 E): 8 pipes, 206.8 to 215.7 m OD on the plateau to the south-east (south of 215,400 N): 4 pipes, 196.7 to 205.7 m ODleft off the contours, water only in the sump: DSRC311 G1, DSRC404 G1, DSRC314 G1
The levels do not fall steadily in one direction. They are highest in the middle of the network, about 215 to 217 m OD at DSRCOH414, DSRC418 and DSRCOH308, and fall both ways: to 206.8 m among the pipes at the escarpment edge and to 196.7 m on the plateau to the south-east. That is a groundwater divide. North-west of it, water in the limestone drains towards the escarpment and the springs along its face; south-east of it, water drains down the dip of the beds, away from the scarp.
Step 6: write a GeoPackage for QGIS
Three layers go into one GeoPackage in British National Grid: standpipes, one point per pipe with its response zone, unit and statistics; readings, one point per dip with its time, depth, level, change and the dry and spike flags; and limestone_contours, the 2 m contour lines.
readings = dips.merge(pipes[PIPE + ["pipe", "group", "UNIT", "level_median"]], on=PIPE)readings = readings.assign(group=readings.group.astype(str), change=readings.level - readings.level_median, remark=readings.MOND_REM.fillna(""))readings = gpd.GeoDataFrame( readings[["pipe", "LOCA_ID", "MONG_ID", "time", "depth", "level", "change", "dry", "spike", "group", "UNIT", "remark"]], geometry=gpd.points_from_xy(readings.LOCA_NATE, readings.LOCA_NATN), crs="EPSG:27700")segs = [(lvl, LineString(seg)) for lvl, ss in zip(lines.levels, lines.allsegs) for seg in ss if len(seg) > 1]contours = gpd.GeoDataFrame({"level": [s[0] for s in segs]}, geometry=[s[1] for s in segs], crs="EPSG:27700")for name, gdf in [("standpipes", standpipes), ("readings", readings), ("limestone_contours", contours)]: gdf.to_file(gpkg, layer=name, driver="GPKG")=== Step 6: write the standpipes, readings and contours to a GeoPackage ===a417_groundwater.gpkg | standpipes: 56 Point features in EPSG:27700a417_groundwater.gpkg | readings: 1764 Point features in EPSG:27700, time 2019-01-31 to 2021-07-23a417_groundwater.gpkg | limestone_contours: 37 LineString features in EPSG:27700figures: 01-standpipe-response-zones.png, 02-groundwater-hydrographs.png, 03-depth-to-groundwater-map.png, 04-limestone-groundwater-contours.png, 05-qgis-temporal-frames.pngThe readings layer has 1,764 points, one fewer than the 1,765 readings, because DSRC310’s single dry dip belongs to a pipe with no water level. The time field is a real date and time, which is what QGIS needs to animate it.
Step 7: animate the readings with the QGIS Temporal Controller
qgis_groundwater.py builds the QGIS project. Run it with the Python that comes with QGIS, as in Part 2:
"C:\Program Files\QGIS 3.40.12\bin\python-qgis-ltr.bat" qgis_groundwater.pyIt loads the DTM as a hillshade, the contours with labels, every standpipe as an open circle, and the readings coloured by change in five classes, from more than 2 m below the pipe’s median to more than 2 m above. The dry and out-of-step readings are filtered in the layer source, so they never draw. Then it switches on the readings layer’s temporal properties and sets the project’s time range and step:
readings = QgsVectorLayer(f'{GPKG}|layername=readings|subset="dry" = 0 AND "spike" = 0', "Water level readings", "ogr")...temporal = readings.temporalProperties()temporal.setIsActive(True)temporal.setMode(Qgis.VectorTemporalMode.FeatureDateTimeInstantFromField)temporal.setStartField("time")navigation = project.timeSettings()navigation.setTemporalRange(QgsDateTimeRange(QDateTime(QDate(2019, 1, 1), QTime(0, 0)), QDateTime(QDate(2021, 8, 1), QTime(0, 0))))navigation.setTimeStep(1)navigation.setTimeStepUnit(QgsUnitTypes.TemporalUnit.TemporalMonths)navigation.setFramesPerSecond(2)QGIS 3.40.12-BratislavaLIDAR DTM (hillshade): valid=TrueBirdlip Limestone groundwater (m OD): valid=True, 37 featuresStandpipes: valid=True, 56 featuresWater level readings: valid=True, 1733 featuressaved output/a417_groundwater.qgz with temporal readings, monthly stepsSeptember 2020: 31 readings in the frame, 14 more than 0.5 m below the pipe's median and 1 more than 0.5 m above; scale 1:19,864; render errors: 0February 2021: 43 readings in the frame, 0 more than 0.5 m below the pipe's median and 16 more than 0.5 m above; scale 1:19,864; render errors: 0rendered 05-qgis-temporal-frames.png, 1820 x 1170 pxEach reading is an instant in time, so with one-month steps every frame shows the dips made in that month. Open output/a417_groundwater.qgz in QGIS, open View > Panels > Temporal Controller, choose the animated mode (the play icon) and press play. The groundwater rises and falls across the hillside two frames a second, month by month from January 2019 to July 2021.
To do the same by hand with any layer that has a date field:
- Right-click the layer, choose Properties > Temporal and tick Dynamic Temporal Control.
- Set Configuration to Single Field with Date/Time and Field to
time. Leave the event duration at 0 so each feature shows only in the step that contains it. - In the Temporal Controller, click Set to full range (the refresh icon beside the dates), set Step to 1 month and press play.
The script also renders two frames side by side, the image at the top of this page. In September 2020, 14 of the 31 pipes dipped were more than half a metre below their median and only one above it. In February 2021, none of the 43 was below and 16 were above. The standpipes layer stays visible in every frame, so you can see which pipes were not dipped that month.
Frequently asked questions
Where is groundwater monitoring in an AGS4 file?
In two groups. MONG has one row per installation, with its type and response zone (MONG_TRZ to MONG_BRZ). MOND has one row per reading, keyed to the installation by LOCA_ID and MONG_ID, with MOND_TYPE saying what was measured. Water level dips are WDEP and the depth to the base of the pipe is DBSE. Water strikes during drilling are in different groups, WSTG and WSTD.
How do I tell a dry pipe from a real water level?
Compare the dip with the depth of the pipe. If the “depth to water” is at the base of the pipe, within a few centimetres, the dip meter reached the bottom without finding water. Use the base measured on the same visit (DBSE) where there is one, and the installed depth otherwise. Field remarks in MOND_REM sometimes say “dry” outright, so read them too.
Why plot change from the median instead of the water level?
Because the pipes on Crickley Hill span 160 m of elevation, and a 2 m seasonal swing disappears on an axis that wide. Subtracting each pipe’s median puts every pipe on the same zero, so the seasonal pattern, and any pipe that behaves differently, stands out.
Can I contour groundwater levels from every standpipe together?
Only when the pipes measure the same body of water. Here the pipes in the landslide deposits, the Lias, the Inferior Oolite and the Great Oolite read separate water levels, tens of metres apart in places. Contour one unit at a time, as we did for the Birdlip Limestone, and treat pipes with water only in the sump as an upper limit rather than a level.
Can I use this with any AGS file?
Yes, if it has MONG and MOND, plus LOCA and GEOL to place the pipes. Check MOND_TYPE and MOND_REM first, because contractors record water quality depths, dry pipes and missed visits in different ways. Change DRY_TOL, SPIKE and SUMP to suit the site.
Next steps
- Part 10 of the series turns to cone penetration tests and how to interpret them from AGS4.
- Part 8: laboratory classification maps how plastic the clays are that hold up the perched water on the plateau.
- Part 5: the ground model builds the unit surfaces that you could compare with the Birdlip Limestone groundwater contours.
- Back to Part 2: mapping the boreholes in QGIS for more on PyQGIS projects.
Data and licences
- A417 Missing Link ground investigation (BGS deposited data item 173984; client Highways England, now National Highways; contractor Geotechnical Engineering Ltd). The monitoring groups come from the original AGS4 file deposited with the BGS, and the repaired locations and geology from the BGS AGS export used in Part 1. Contains British Geological Survey materials © UKRI 2026, licensed under the Open Government Licence v3.0. Every figure carries the credit.
- Environment Agency LIDAR Composite DTM 1 m, requested at 5 m from the Defra Data Services Platform WCS. © Environment Agency copyright and/or database right, licensed under the Open Government Licence v3.0. It is the hillshade and contours in the maps, which carry the credit. No other basemap is used.
- Code:
groundwater_monitoring.py,qgis_groundwater.pyanda417_ags.py, tested with Python 3.12.0, python-ags4 1.2.0, pandas 2.3.3, GeoPandas 1.2.0, rasterio 1.5.2, matplotlib 3.11.2 and QGIS 3.40.12.