package for water-statistics and plausibility checker using his- and bui-file

pip install hkvsobekpy==1.5



package for water-statistics and plausibility checker using his- and bui-files. A his-file is a binary file object used for read/write in- and output in SOBEK. The file contains parameters, locations and timesteps. Since it is a binary format it always has been difficult to use this files directly in explorative analysis or automated workflows. This package provide options to work with these his-files within Python.

A bui-file is a text file object used for storing precipitation events for multiple locations. The file is also used for input in SOBEK models. This function provide options to parse this bui-file into a Pandas DataFrame.

Next to reading the his and bui-files, this package also contains some modules for applying statistics to obtain the return period for T10, T25, T50 and T100. This information is useful to compare against actual waterlevels.


install using pypip:

pip install hkvsobekpy


hkvsobekpy requires the following packages to be installed:

  • tqdm
  • fire
  • numpy
  • scipy
  • pandas
  • geopandas (requires Fiona, GDAL and shapely)

The package will install tqdm and fire as dependencies, the other packgages are not included as Windows cannot compile these packages from source. Go to to download these packages on Windows (and use pip install path/to/package.whl), or use pip install directly under linux.

usage package

Import the package and define path to his-file

import hkvsobekpy as hkv
his_file = r'input_data\waterstand-statistiek\CALCPNT.HIS'

Metadata of the his-file is read first and using this metadata block subequent functions can be applied.

calcpnt = hkv.read_his.LeesMetadata(his_file)

Such as the functions to get the locations, timesteps and parameters:

locaties = calcpnt.KrijgLokaties()
tijdstappen = calcpnt.KrijgTijdstappen()
parameters = calcpnt.KrijgParameters()

first 5 locations:     {0}
last 2 timesteps:      {1}
all parameters:        {2}""".format(locaties[0:5],

first 5 locations:     ['1', '126', '11', '8', '14']
last 2 timesteps:      [datetime.datetime(2014, 10, 18, 15, 20), datetime.datetime(2014, 12, 12, 10, 20)]
all parameters:        ['Waterlevel max. (m A', 'Waterdepth max. (m) ']

To read a single timeseries use:

df = calcpnt .EnkeleWaardenArray(locaties[0],
    startMMdd=(1, 1),
    endMMdd=(12, 31),

alt text

See the jupyter notebook 'waterstand statistiek.ipynb' in the notebook folder for more usage examples. For example how to get the return periods T25, T50 and T100 using a Gumbel function fit, while the T10 is computed using a weigted average of the four nearest events

alt text