Lake calibrator is a tool designed for automating the calibration of hydrodynamic lake models. The goal is to provide a consistent interface for a range of models and calibration frameworks.
Simulations | Calibration Frameworks |
---|---|
Simstrat | scipy.optimize.minimize PEST |
Clone the repository and install it manually:
git clone git@github.com:eawag-surface-waters-research/lake-calibrator.git
cd lake-calibrator
pip install requirements.txt
It is suggested to install the python packages in a virtual environment
python src/calibrate.py <path>
Where path is the path of the input arguments file. path should either be absolute or relative to the directory from which you run the script.
For example:
python src/calibrate.py args/simstrat_pest_example.json
from calibrate import calibrator
arguments = {...}
results = calibrate(arguments)
Example argument dictionary's can be seen in the args
folder.
Argument | Description | Example |
---|---|---|
simulation_folder | Path to simulation folder that contains the input files for running the simulation | /path/lake_name |
calibration_folder | Path to location for calibration file generation | runs/lake_name |
observations | List of dictionaries describing observation files (see below for more info on files) | [{"file": "observations/lake_name/temperature.csv","parameter": "temperature","unit": "degC","start": "1982-01-01T01:00:00+00:00","end": "2022-01-01T01:00:00+00:00"}] |
simulation | Simulation software name | simstrat |
execute | Simulation execution command where {calibration_folder} will be replaced by the calibration folder | docker run --rm --user $(id -u):$(id -g) -v {calibration_folder}:/simstrat/run eawag/simstrat:3.0.4 Settings.par |
parameters | List of dictionaries describing parameters to optimize | [{"name": "a_seiche", "initial": 2.0e-5, "min": 1e-5, "max": 0.5}, {"name": "p_absorb", "initial": 1.49916053, "min": 0.5, "max": 1.5}] |
calibration_framework | Calibration framework name | scipy |
calibration_options | Parameters for the calibration | See example argument files |
Observation files should be csv files with the following structure:
time | depth | latitude | longitude | value | weight |
---|---|---|---|---|---|
2024-08-12T22:27:54+00:00 | 1.6 | 46.5 | 6.67 | 18.3 | 1 |
2024-08-12T23:27:54+00:00 | 8.4 | 46.5 | 6.67 | 8.5 | 1 |
- Time values should be ISO 8601 with timezone information.
- The values should all have the same units.
- There should be one file per lake and per parameter, e.g. lake_name/temperature.csv, lake_name/secchi.csv
Observation frequency both in time and in depth can have a large impact on calibration results. A disproportionate amount of observations in a given season or at a given depth will bias the calibration. This can be handled by down sampling the observation to specific time intervals e.g. monthly and fixed depth values e.g. 1, 2, 5, 20 or by adjusting the weight given to each observation. This should be done prior to producing the observation files.
This package is licensed under the MIT License.
This package is based on existing projects for calibrating 1D lake models from the Applied System Analysis group at Eawag.