Coverage for C:\src\imod-python\imod\mf6\src.py: 100%
18 statements
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-08 14:15 +0200
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-08 14:15 +0200
1import numpy as np
3from imod.logging import init_log_decorator
4from imod.mf6.boundary_condition import BoundaryCondition
5from imod.mf6.package import Package
6from imod.mf6.validation import BOUNDARY_DIMS_SCHEMA
7from imod.schemata import (
8 AllInsideNoDataSchema,
9 AllNoDataSchema,
10 DTypeSchema,
11 IndexesSchema,
12 OtherCoordsSchema,
13)
16class MassSourceLoading(BoundaryCondition):
17 """
18 Mass Source Loading (SRC) package for structured discretization (DIS)
19 models. Any number of SRC Packages can be specified for a single
20 groundwater flow model.
21 https://water.usgs.gov/water-resources/software/MODFLOW-6/mf6io_6.3.0.pdf#page=202
23 Parameters
24 ----------
25 rate: xr.DataArray of floats
26 is the mass source loading rate. A positive value indicates addition of
27 solute mass and a negative value indicates removal of solute mass
28 (smassrate).
29 print_input: ({True, False}, optional), default is False.
30 keyword to indicate that the list of mass source information will be
31 written to the listing file immediately after it is read.
32 print_flows: ({True, False}, optional), default is False.
33 keyword to indicate that the list of mass source flow rates will be
34 printed to the listing file for every stress period time step in which
35 "BUDGET PRINT" is specified in Output Control. If there is no Output
36 Control option and "PRINT FLOWS" is specified, then flow rates are
37 printed for the last time step of each stress period.
38 save_flows: ({True, False}, optional)
39 Indicates that the mass source flow terms will be written to the file specified
40 with "BUDGET FILEOUT" in Output Control.
41 Default is False.
42 observations: [Not yet supported.]
43 Default is None.
44 validate: {True, False}
45 Flag to indicate whether the package should be validated upon
46 initialization. This raises a ValidationError if package input is
47 provided in the wrong manner. Defaults to True.
48 """
50 _pkg_id = "src"
51 _template = Package._initialize_template(_pkg_id)
52 _period_data = ("rate",)
53 _keyword_map = {}
55 _init_schemata = {
56 "rate": (
57 DTypeSchema(np.floating),
58 IndexesSchema(),
59 BOUNDARY_DIMS_SCHEMA,
60 )
61 }
63 _write_schemata = {
64 "rate": [
65 OtherCoordsSchema("idomain"),
66 AllNoDataSchema(), # Check for all nan, can occur while clipping
67 AllInsideNoDataSchema(other="idomain", is_other_notnull=(">", 0)),
68 ],
69 }
71 @init_log_decorator()
72 def __init__(
73 self,
74 rate,
75 print_input=False,
76 print_flows=False,
77 save_flows=False,
78 observations=None,
79 validate: bool = True,
80 ):
81 dict_dataset = {
82 "rate": rate,
83 "print_input": print_input,
84 "print_flows": print_flows,
85 "save_flows": save_flows,
86 "observations": observations,
87 }
88 super().__init__(dict_dataset)
89 self._validate_init_schemata(validate)