It’s useful to know how much water enters a system, particularly as part of the runoff model. I’ve always thought of the budget of precipiation (Prec) & potential evapotranspiration (PET) as effective rainfall (Raineff), but you rarely see it calculated with anything other than precipitation data, which is what I’m using here.
Using Precipitation and PET data from the Climate, Hydrology and Ecology research Support System (CHESS), we can generate effective rainfall data at a 1km resolution for most of GB (sorry, Shetland). The monthly NetCDF files (.nc) available for download include data for every day as a separate layer.
Before we get into the nuts and bolts, let’s have a look at some outputs! Shown below is the variation in effective rainfall over the last 10 years, centred on the Kintyre peninsula. Although there are a couple of dry years, there are annual values of over 3000mm on the higher ground – that’s 3 metres of rain!
So how do we go about generating this?
Calculating Effective Rainfall
The basic formula to calculate these values is as follows:
Raineff = Prec – PET
But there are a couple of caveats:
- You can’t evaporate more water than there is
- The remaining water at the end of each day is the starting point for the next
Essentially every day you have a starting point which is the previous day’s end point. By way of example, here’s a running total:
|Day||Eff Rain (Day-1)||Prec||PET||Eff Rain|
|1||0.0||1.1||0.7||0.0 + 1.1 – 0.7 = 0.4|
|2||0.4||0.9||0.8||0.4 + 0.9 – 0.8 = 0.5|
|3||0.5||0.1||0.7||0.5 + 0.1 – 0.7 = -0.1 -> 0.0|
|4||0.0||0.8||0.6||0.0 + 0.8 – 0.6 = 0.2|
From that you can see the running equation for any given day (d) is actually:
Raineffd = Raineffd-1 + Precd – PETd
Processing the Data
Handling NetCDF is really easy in R, and more intuitive than other GIS systems. Using the raster package we can quickly run through each .nc file and access loop through the daily layers one at a time. I’ve written this script to expect the same number of months in each year and for all months to be concurrent. The output files are named for each year, so I would recomment having a all twelve months for each year also. It’s worth noting that each year starts again using a ‘running total’ of zero, but this will have little impact on the annual sum – it’s common to see each year treated as a separate entity.
Other than downloading your desired data and setting the range at the top of the script, there’s not much to do but run it – the running equation shown above is implemented and annual raster files (.tif) are exported. I’ve made the script available on GitHub, but it’s also embedded below:
It’s worth noting that downloads can be automated using the CEH THREDDS server (requires login), or downloaded individually from these sources:
This article is an attempt to use a new approach to writing and publishing code. The code lives on GitHub and is automatically synced above using gist-it and synced to Zenodo to get a DOI (linked below). Many thanks to Mike Spencer for highlighting this approach at FOSS4G UK 2019.
Robinson, E.L.; Blyth, E.; Clark, D.B.; Comyn-Platt, E.; Finch, J.; Rudd, A.C. (2016). Climate hydrology and ecology research support system potential evapotranspiration dataset for Great Britain (1961-2015) [CHESS-PE] . NERC Environmental Information Data Centre. DOI: 10.5285/8baf805d-39ce-4dac-b224-c926ada353b7
Robinson, E.L.; Blyth, E.; Clark, D.B.; Comyn-Platt, E.; Finch, J.; Rudd, A.C. (2017). Climate hydrology and ecology research support system meteorology dataset for Great Britain (1961-2015) [CHESS-met] v1.2. NERC Environmental Information Data Centre. DOI: 10.5285/b745e7b1-626c-4ccc-ac27-56582e77b9007