Build Status |
---|
Hydrological models implemented in the Julia programming language. The package currently provides a set of conceptual hydrological models including methods for computing potential evapotranspiration. The models are built using different components and can be combined in different constellations.
The package can be installed with the Julia package manager. From the Julia REPL, type ]
to enter the Pkg REPL mode and run:
pkg> add WaterFlows
And load the package using the command:
using WaterFlows
WaterFlows currently reads data in a specific text format (see examples for Atnasjø and Fetvatn).
First, read the data for one of the example datasets, here Atnasjø:
path = joinpath(dirname(pathof(WaterFlows)), "..", "data", "atnasjo")
date, tair, prec, q_obs, frac_lus, frac_area, elev = load_data(path)
Second, compute potential evapotranspiration for the catchment:
lat = 60.0
epot = oudin(date, tair, lat, frac_area)
Third, create an object containing the input data that is required for running the models:
input = InputPTE(date, prec, tair, epot)
The most user-friendly method to run a model is to use a predefined model structure.
Start by specifying the time step length in hours and the time for the first input data:
tstep = 24.0
tstart = date[1]
Next setup a model object containing necessary data required for running the model:
model = model_hbv_light(tstep, tstart, frac_lus)
Finally run the model:
q_sim = run_model(model, input)
A complete model can be built from existing components.
Again, start by specifying the time step length in hours and the time for the first input data:
tstep = 24.0
tstart = date[1]
Next specify a snow, glacier and subsurface component:
snow = HbvLightSnow(tstep, tstart, frac_lus)
glacier = NoGlacier()
subsurf = Gr4j(tstep, tstart)
and create a model object:
model = ModelComp(snow, glacier, subsurf)
Finally run the model:
q_sim = run_model(model, input)
A model can be calibrated by running:
param_tuned = run_model_calib(model, input, q_obs, warmup = 1, verbose = :verbose)
The model can be ran using the best-fit parameters with the following command:
set_params!(model, param_tuned)
q_sim = run_model(model, input)
Currently, a complete model is splitted into three components representing snow melt, glacier melt and subsurface hydrological processes, respectivily.
Available snow components:
Available glacier components:
Available subsurface components:
The components can be ordered in any combination. However, note that the input arguments may differ between the components. For looking at the implementation of the components, click here. The components are combined together to a complete model using this code.
Currently only the HBV light model setup is available as a complete model as described above.