Documentation
¶
Overview ¶
gohbv is an implementation of the HBV hydrological model, written in Go.
The model can be called directly with Go (see examples/gohbv-example) or combiled and called using the cli.
Index ¶
- func LindstromMeasure(sim []float64, obs []float64, w float64) float64
- func NashSutcliffeEfficiency(sim []float64, obs []float64) float64
- func PowArray(arr []float64, y float64) []float64
- func Q_obs_to_array(inData []InputData) []float64
- func Q_sim_to_array(mState []ModelState) []float64
- func RSquared(sim []float64, obs []float64) float64
- func ResponseRoutine(mState []ModelState, mPars Parameters, i int)
- func RoutingMaxbasWeights(mPars Parameters) []float64
- func RoutingRoutine(mState []ModelState, mPars Parameters, inData []InputData, i int, ...)
- func SnowRoutine(mState []ModelState, mPars Parameters, inData []InputData, i int)
- func SoilRoutine(mState []ModelState, mPars Parameters, inData []InputData, i int)
- func VolumeError(sim []float64, obs []float64) float64
- func WriteCSVResults(mState []ModelState, outputFile string)
- type InputData
- type ModelState
- type Parameters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LindstromMeasure ¶
Penalize the NSE measure with remaining weighted volume error
func NashSutcliffeEfficiency ¶
Calculate Nash-Sutcliffe efficiency 1 - ( sum((obs-sim)**2) / sum((obs-mean_obs)**2) )
func Q_obs_to_array ¶
func Q_sim_to_array ¶
func Q_sim_to_array(mState []ModelState) []float64
func ResponseRoutine ¶
func ResponseRoutine(mState []ModelState, mPars Parameters, i int)
func RoutingMaxbasWeights ¶
func RoutingMaxbasWeights(mPars Parameters) []float64
Calculate MAXBAS triangular weights using trapezoidal integration
func RoutingRoutine ¶
func RoutingRoutine(mState []ModelState, mPars Parameters, inData []InputData, i int, maxbas []float64)
The RoutingRoutine applies maxbas weights to the groundwater response to calculate the simulated runoff
func SnowRoutine ¶
func SnowRoutine(mState []ModelState, mPars Parameters, inData []InputData, i int)
Snow routine (also called precipitation routine) for calculating snow- or rainfall accumulation, melt and refreezing of snow storage.
func SoilRoutine ¶
func SoilRoutine(mState []ModelState, mPars Parameters, inData []InputData, i int)
func VolumeError ¶
Calculate the relative volume error (i.e. bias) This evalulates systematic volume errors over longer periods See Lindström, G. (1997). A Simple Automatic Calibration Routine for the HBV Model. Nordic Hydrology, 28(3), 153–168. https://doi.org/10.2166/nh.1997.009 Note: returns single float64, alternativelty return array of dv ?
func WriteCSVResults ¶
func WriteCSVResults(mState []ModelState, outputFile string)
Write model result (array of ModelState structs) to outputFile
Types ¶
type InputData ¶
type InputData struct {
Date string
Precipitation float64
Temperature float64
Discharge float64
PotentialET float64
}
Input forcing and observations
func ParseInputData ¶
Parse input data csv rows to InputData struct
func ReadInputData ¶
Read csv input forcing data to InputData struct CSV data must be in order Date, Precipitation, Temperature, Discharge, Potential ET
type ModelState ¶
type ModelState struct {
AET float64 // Actual evapotranspiration [mm]
Q_gw float64 // Groundwater discharge [mm]
Q_sim float64 // Simulated runoff [mm]
Snowfall float64 // Snowfall [mm]
Rainfall float64 // Rainfall [mm]
S_snow float64 // Storage snow, Snow_solid + Snow_liquid [mm]
Snow_solid float64 // Solid water content in snowpack [mm]
Snow_liquid float64 // Liquid water content in snowpack [mm]
Snow_cover int // Snow cover [0/1]
Snow_melt float64 // Snow melt [mm]
Liquid_in float64 // Snow melt + liquid precipitation [mm]
S_soil float64 // Soil water storage [mm]
S_gw_suz float64 // Groundwater storage upper zone [mm]
S_gw_slz float64 // Groundwater storage lower zone [mm]
Recharge_sm float64 // Recharge/infiltration to soil moisture storage [mm]
Recharge_gwuz float64 // Recharge to upper groundwater storage [mm]
}
Model state and fluxes - available across module
func RunModel ¶
func RunModel(mPars Parameters, inData []InputData) ([]ModelState, error)
GoHBV function is used to run the HBV model based on an InputData and Parameters structs. The function call returns an array of ModelState structs
type Parameters ¶
type Parameters struct {
TT float64
CFMAX float64
SFCF float64
CFR float64
CWH float64
FC float64
LP float64
BETA float64
PERC float64
UZL float64
K0 float64
K1 float64
K2 float64
MAXBAS float64
PCALT float64
TCALT float64
}
Parameters struct
func ParseParameters ¶
func ParseParameters(jsonData []byte) (Parameters, error)
Parse parameter .json file Unmarshal to Parameters struct
func ReadParameters ¶
func ReadParameters(parameterFile string) Parameters
Read parameter json file and parse it to Parameters struct
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
gohbv-example
command
Example running gohbv from Go
|
Example running gohbv from Go |