2.3. floodestimation.fehdata — Accessing gauged catchment data

This module provides methods to download a complete set of published gauged catchment data from the National River Flow Archive.

Downloaded data files are stored in a Cache folder under the user’s application data folder. On Windows, this is folder is located at C:\Users\{Username}\AppData\Local\Open Hydrology\fehdata\Cache.

A typical data retrieval is as follows:

>>> from floodestimation import fehdata
>>> fehdata.clear_cache()
>>> fehdata.download_data()
>>> fehdata.unzip_data()

Data files can then be accessed as follows:

>>> cd3_files = fehdata.cd3_files()
>>> amax_files = fehdata.amax_files()

For parsing CD3 files and AMAX files see floodestimation.parsers.

floodestimation.fehdata.update_available(after_days=1)[source]

Check whether updated NRFA data is available.

Parameters:after_days (float) – Only check if not checked previously since a certain number of days ago
Returns:True if update available, False if not, None if remote location cannot be reached.
Return type:bool or None
floodestimation.fehdata.download_data()[source]

Downloads complete station dataset including catchment descriptors and amax records. And saves it into a cache folder.

floodestimation.fehdata.nrfa_metadata()[source]

Return metadata on the NRFA data.

Returned metadata is a dict with the following elements:

  • url: string with NRFA data download URL
  • version: string with NRFA version number, e.g. ‘3.3.4’
  • published_on: datetime of data release/publication (only month and year are accurate, rest should be ignored)
  • downloaded_on: datetime of last download
Returns:metadata
Return type:dict
floodestimation.fehdata.unzip_data()[source]

Extract all files from downloaded FEH data zip file.

floodestimation.fehdata.clear_cache()[source]

Delete all files from cache folder.

floodestimation.fehdata.amax_files()[source]

Return all annual maximum flow (*.am) files in cache folder and sub folders.

Returns:List of file paths
Return type:list
floodestimation.fehdata.cd3_files()[source]

Return all catchment descriptor files (*.cd3) files in cache folder and sub folders.

Returns:List of file paths
Return type:list