mibitrans.data API reference
check_input
Author: Jorrit Bakker.
Module evaluating if a dictionary contains all required (correct) parameters for analysis
DomainValueError
Bases: Exception
Exception raised for values that are outside their possible domain.
Source code in mibitrans/data/check_input.py
MissingValueError
Bases: Exception
Exception raised when one or more required parameters are missing.
Source code in mibitrans/data/check_input.py
check_dictionary(value)
Check if variable is a dictionary, and raise an error if it is not.
check_instant_reaction_acceptor_input(electron_acceptors, utilization_factor)
Check if electron acceptor and utilization factor are of correct datatype. Then pass them to dataclasses.
Source code in mibitrans/data/check_input.py
check_model_type(parameter, allowed_model_types)
Check if variable is of the given allowed model types, and raise an error if it is not.
Source code in mibitrans/data/check_input.py
check_time_in_domain(model, time)
Check if time input is valid, and returns the index of nearest time.
Source code in mibitrans/data/check_input.py
check_x_in_domain(model, x_position)
Check if x-position input is valid, and returns the index of nearest x position.
Source code in mibitrans/data/check_input.py
check_y_in_domain(model, y_position)
Check if y-position input is valid, and returns the index of nearest y position.
Source code in mibitrans/data/check_input.py
validate_input_values(parameter, value)
Validate if input parameter is of correct type and in correct domain.
Source code in mibitrans/data/check_input.py
validate_source_zones(boundary, concentration)
Validate and adapt input of source_zone_boundary and source_zone_concentration arrays.
Source code in mibitrans/data/check_input.py
example_data
Created on Fri Apr 10 11:33:06 2026.
@author: alraune
BioscreenATData
Class loading .json file with example output data from BIOSCREEN-AT to compare with mibitrans models.
Source code in mibitrans/data/example_data.py
__init__()
Initialize the example data arrays. Corresponding with model input specified in benchmarking_BIOSCREEN.ipynb.
Properties
nodecay (np.ndarray) : Three-dimensional array with concentrations for no decay model, indexed as C(t,y,x). lineardecay (np.ndarray) : Three-dimensional array with concentrations for linear decay model, indexed as C(t,y,x).
Source code in mibitrans/data/example_data.py
BioscreenData
Class loading .json file with example output data from BIOSCREEN to compare with mibitrans models.
Source code in mibitrans/data/example_data.py
__init__()
Initialize the example data arrays. Corresponding with model input specified in benchmarking_BIOSCREEN.ipynb.
Properties
nodecay (np.ndarray) : Three-dimensional array with concentrations for no decay model, indexed as C(t,y,x). lineardecay (np.ndarray) : Three-dimensional array with concentrations for linear decay model, indexed as C(t,y,x). instant (np.ndarray) : Three-dimensional array with concentrations for instant reaction model, indexed as C(t,y,x).
Source code in mibitrans/data/example_data.py
parameter_information
Author: Jorrit Bakker.
File containing various dictionaries used for evaluation of names, value types and units of input data.
ElectronAcceptors
dataclass
Make object with concentrations of electron acceptors.
Dataclass which handles the entry of electron acceptor concentrations used for the instant reaction biodegradation method. As plume concentrations for reduced electron acceptor species and as difference between plume and background concentrations for the electron acceptors themselves.
delta_oxygen (float) : Difference between background oxygen and plume oxygen concentrations, in [g/m^3]. Only required for instant reaction models. delta_nitrate (float) : Difference between background nitrate and contaminant plume nitrate concentrations, in [g/m^3]. Only required for instant reaction models. ferrous_iron (float) : Ferrous iron concentration in contaminant plume, in [g/m^3]. Only required for instant reaction models. delta_sulfate (float) : Difference between background sulfate and plume sulfate concentrations, in [g/m^3]. Only required for instant reaction models. methane (float) : Methane concentration in contaminant plume, in [g/m^3]. Only required for instant reaction models.
Source code in mibitrans/data/parameter_information.py
array
property
Return electron acceptor concentrations in the form of an array, in order of [O2, NO3, Fe, SO4, CH4].
dictionary
property
Returns electron acceptors in the form of a dictionary.
__setattr__(parameter, value)
Override parent method to validate input when attribute is set.
UtilizationFactor
dataclass
Make object containing information about electron acceptor utilization factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
util_oxygen (float)
|
utilization factor of oxygen, as mass of oxygen consumed per mass of biodegraded contaminant [g/g]. |
required | |
util_nitrate (float)
|
utilization factor of nitrate, as mass of nitrate consumed per mass of biodegraded contaminant [g/g]. |
required | |
util_ferrous_iron (float)
|
utilization factor of ferrous iron, as mass of ferrous iron generated per mass of biodegraded contaminant [g/g]. |
required | |
util_sulfate (float)
|
utilization factor of sulfate, as mass of sulfate consumed per mass of biodegraded contaminant [g/g]. |
required | |
util_methane (float)
|
utilization factor of methane, as mass of methane generated per mass of biodegraded contaminant [g/g]. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If input parameters are incomplete or outside the valid domain. |
TypeError
|
If input parameters of incorrect datatype. |
Source code in mibitrans/data/parameter_information.py
array
property
Return utilization factors in the form of an array, in order of [O2, NO3, Fe, SO4, CH4].
dictionary
property
Returns utilization factors in the form of a dictionary.
__setattr__(parameter, value)
Override parent method to validate input when attribute is set.
parameters
Author: Jorrit Bakker.
Module handling data input in the form of a dictionary.
AttenuationParameters
dataclass
Dataclass handling parameters related to adsorption and degradation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
retardation (float)
|
Retardation factor for transported contaminant [-]. Default is 1. |
required | |
decay_rate (float)
|
First order (linear) decay coefficient in [1/day]. Only required for linear decay models. Default is 0. Also sets corresponding half life. |
required | |
half_life (float)
|
Contaminant half life for 1st order (linear) decay, in [days]. Only required for linear decay models. Default is 0. Also sets corresponding decay_rate. |
required | |
bulk_density (float)
|
Soil bulk density, in [g/m^3]. Optional if retardation is specified. |
required | |
partition_coefficient (float)
|
Partition coefficient of the transported contaminant to soil organic matter, in [m^3/g]. Optional if retardation is specified. |
required | |
fraction_organic_carbon (float)
|
Fraction of organic material in the soil [-]. Optional if retardation is specified. |
required | |
verbose
|
bool
|
Verbose mode. Defaults to False. |
False
|
Methods:
| Name | Description |
|---|---|
calculate_retardation |
Calculate retardation factor from bulk density, partition coefficient and fraction organic carbon when given porosity [-] |
Raises:
| Type | Description |
|---|---|
ValueError
|
If input parameters are incomplete or outside the valid domain. |
TypeError
|
If input parameters of incorrect datatype. |
Source code in mibitrans/data/parameters.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
__post_init__()
__setattr__(parameter, value)
Override parent method to validate input when attribute is set.
Source code in mibitrans/data/parameters.py
calculate_retardation(porosity)
Calculate retardation factor from soil adsorption parametrers and porosity.
Source code in mibitrans/data/parameters.py
HydrologicalParameters
dataclass
Dataclass handling input of hydrological parameters, dispersion and diffusion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
velocity (float)
|
Flow velocity in the direction of the groundwater gradient, in [m/d]. Optional if h_gradient and h_conductivity are specified. |
required | |
h_gradient (float)
|
Hydraulic gradient of the groundwater, in [m/m]. Optional if velocity is specified. |
required | |
h_conductivity (float)
|
Hydraulic conductivity of the aquifer, in [m/d]. Optional if velocity is specified. |
required | |
porosity (float)
|
Effective soil porosity [-] |
required | |
alpha_x (float)
|
The dispersivity in the x (longitudinal) direction in [m] |
required | |
alpha_y (float)
|
The dispersivity in the y (transverse-horizontal) direction in [m] |
required | |
alpha_z (float, optional)
|
The dispersivity in the z (transverse-vertical) direction in [m]. Defaults to 1e-10. |
required | |
diffusion (float)
|
Molecular diffusion [m2/day]. Default is 0. |
required | |
verbose
|
bool
|
Verbose mode. Defaults to False. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If input parameters are incomplete or outside the valid domain. |
TypeError
|
If input parameters of incorrect datatype. |
Source code in mibitrans/data/parameters.py
__post_init__()
Check argument presence, types and domain. Calculate velocity if not given.
Source code in mibitrans/data/parameters.py
__setattr__(parameter, value)
Override parent method to validate input when attribute is set.
ModelParameters
dataclass
Dataclass handling model discretization parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_length (float)
|
Model extent in the longitudinal (x) direction in [m]. |
required | |
model_width (float)
|
Model extent in the transverse horizontal (y) direction in [m]. |
required | |
model_time (float)
|
Model duration in [days]. |
required | |
dx (float, optional)
|
Model grid discretization step size in the longitudinal (x) direction, in [m]. By default, dx = (model_length / 100). |
required | |
dy (float, optional)
|
Model grid discretization step size in the transverse horizontal (y) direction, in [m]. By default, dy = (model_width / 50). |
required | |
dt (float, optional)
|
Model time discretization step size, in [days]. By default, dt = (model_time / 10). |
required | |
verbose
|
bool
|
Verbose mode. Defaults to False. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If input parameters are incomplete or outside the valid domain. |
ValueError
|
If model dimensions are smaller than their given step size. |
TypeError
|
If input parameters of incorrect datatype. |
Source code in mibitrans/data/parameters.py
__post_init__()
Set model discretization parameters if not provided.
Source code in mibitrans/data/parameters.py
__setattr__(parameter, value)
Override parent method to validate input when attribute is set.
SourceParameters
dataclass
Dataclass handling source parameters. Specifying concentrations and extent of source zone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_zone_boundary (np.ndarray)
|
Outer boundary of each source zone, in transverse horizontal direction (y-coordiante) [m]. y=0 is at the middle of the contaminant source. Input as numpy array of length equal to the amount of source zone. Last value in the array is the limit of the source. For a source with a single source zone, only one value is required. Source is symmetrical in the x-axis. |
required | |
source_zone_concentration (np.ndarray)
|
Contaminant concentration in each source zone [g/m^3]. Input as numpy array in the same order and of the same length as specified in source_zone_boundary. |
required | |
depth (float)
|
Depth (transverse vertical or z-dimension) of the source zone in [m]. |
required | |
total_mass (float | str)
|
Mass of contaminant present in source zone, either expressed in [g], or set to ‘infinite’. The latter meaning that the source mass and therefore, the source zone concentrations do not diminish over time. |
required | |
verbose
|
bool
|
Verbose mode. Defaults to False. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If input parameters are incomplete or outside the valid domain. |
TypeError
|
If input parameters of incorrect datatype. |
Source code in mibitrans/data/parameters.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
__post_init__()
__setattr__(parameter, value)
Override parent method to validate input when attribute is set.
Source code in mibitrans/data/parameters.py
interpolate(n_zones, method)
Rediscretize source to n zones. Either through linear interpolation or using a normal distribution.
visualize_source_depletion(hydrological_parameters, electron_acceptors=None, utilization_factor=None, **kwargs)
Plot source depletion over time.
Provide electron acceptor concentrations and utilization factor when plotting instant reaction source depletion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hydrological_parameters (mibitrans.data.parameters.HydrologicalParameters)
|
Dataclass object containing hydrological parameters, dispersion and diffusion from HydrologicalParameters. Needed for flow velocity and porosity. |
required | |
electron_acceptors
|
ElectronAcceptors
|
ElectronAcceptor dataclass containing electron acceptor concentrations. Alternatively provided as list, numpy array or dictionary corresponding with delta_oxygen, delta_nitrate, ferrous_iron, delta_sulfate and methane. For more information, see documentation for ElectronAcceptors. |
None
|
utilization_factor
|
UtilizationFactor
|
UtilizationFactor dataclass containing electron acceptor utilization factors. Alternatively provided as list, numpy array or dictionary corresponding with information, see documentation of UtilizationFactor. By default, electron acceptor utilization factors for a BTEX mixture are used, based on values by Wiedemeier et al. (1995). |
None
|
**kwargs
|
Arguments to be passed to plt.plot(). |
required |