flopy.utils.compare module
- compare_budget(namefile1: str | PathLike | None = None, namefile2: str | PathLike | None = None, max_cumpd=0.01, max_incpd=0.01, outfile: str | PathLike | None = None, files1: str | PathLike | list[Union[str, os.PathLike]] | None = None, files2: str | PathLike | list[Union[str, os.PathLike]] | None = None)
Compare list file budget results from two simulations.
- Parameters:
namefile1 (str or PathLike, optional) – namefile path for base model
namefile2 (str or PathLike, optional) – namefile path for comparison model
max_cumpd (float) – maximum percent discrepancy allowed for cumulative budget terms (default is 0.01)
max_incpd (float) – maximum percent discrepancy allowed for incremental budget terms (default is 0.01)
outfile (str or PathLike, optional) – budget comparison output file name. If outfile is None, no comparison output is saved. (default is None)
files1 (str, PathLike, or list, optional) – base model output file. If files1 is not None, results will be extracted from files1 and namefile1 will not be used. (default is None)
files2 (str, PathLike, or list, optional) – comparison model output file. If files2 is not None, results will be extracted from files2 and namefile2 will not be used. (default is None)
- Returns:
success – boolean indicating if the difference between budgets are less than max_cumpd and max_incpd
- Return type:
- compare_cell_budget(fpth0: str | PathLike, fpth1: str | PathLike, precision: str = 'double', outfile: str | PathLike | None = None, rclose: float = 0.001, verbose: bool = False) bool[source]
Compare the cell-by-cell budget results from two simulations.
- compare_concentrations(namefile1: str | PathLike | None = None, namefile2: str | PathLike | None = None, precision='auto', ctol=0.001, outfile: str | PathLike | None = None, files1: str | PathLike | list[str | os.PathLike] | None = None, files2: str | PathLike | list[str | os.PathLike] | None = None, difftol=False, verbose=False)[source]
Compare the concentration results from two simulations.
- Parameters:
namefile1 (str or PathLike, optional) – namefile path for base model
namefile2 (str or PathLike, optional) – namefile path for comparison model
precision (str) – precision for binary head file (“auto”, “single”, or “double”) default is “auto”
ctol (float) – maximum allowed concentration difference (default is 0.001)
outfile (str or PathLike, optional) – concentration comparison output file name. If outfile is None, no comparison output is saved. (default is None)
files1 (str, PathLike, or list of str or PathLike, optional) – base model output file. If files1 is not None, results will be extracted from files1 and namefile1 will not be used. (default is None)
files2 (str, PathLike, or list of str or PathLike, optional) – comparison model output file. If files2 is not None, results will be extracted from files2 and namefile2 will not be used. (default is None)
difftol (bool) – boolean determining if the absolute value of the concentration difference greater than ctol should be evaluated (default is False)
verbose (bool) – boolean indicating if verbose output should be written to the terminal (default is False)
- Returns:
success – boolean indicating if the concentration differences are less than ctol.
- Return type:
- Returns:
success – boolean indicating if the concentration differences are less than ctol.
- Return type:
- compare_heads(namefile1: str | PathLike | None = None, namefile2: str | PathLike | None = None, precision='auto', text='head', text2=None, htol=0.001, outfile: str | PathLike | None = None, files1: str | PathLike | list[str | os.PathLike] | None = None, files2: str | PathLike | list[str | os.PathLike] | None = None, difftol=False, verbose=False, exfile: str | PathLike | None = None, exarr=None, maxerr=None)[source]
Compare the head results from two simulations.
- Parameters:
namefile1 (str or PathLike, optional) – namefile path for base model
namefile2 (str or PathLike, optional) – namefile path for comparison model
precision (str) – precision for binary head file (“auto”, “single”, or “double”) default is “auto”
htol (float) – maximum allowed head difference (default is 0.001)
outfile (str or PathLike) – head comparison output file name. If outfile is None, no comparison output is saved. (default is None)
files1 (str or PathLike or list of str or PathLike, optional) – base model output files. If files1 is not None, results will be extracted from files1 and namefile1 will not be used. (default is None)
files2 (str or PathLike or list of str or PathLike, optional) – comparison model output files. If files2 is not None, results will be extracted from files2 and namefile2 will not be used. (default is None)
difftol (bool) – boolean determining if the absolute value of the head difference greater than htol should be evaluated (default is False)
verbose (bool) – boolean indicating if verbose output should be written to the terminal (default is False)
exfile (str or PathLike, optional) – path to a file with exclusion array data. Head differences will not be evaluated where exclusion array values are greater than zero. (default is None)
exarr (numpy.ndarry) – exclusion array. Head differences will not be evaluated where exclusion array values are greater than zero. (default is None).
maxerr (int) – maximum number of head difference greater than htol that should be reported. If maxerr is None, all head difference greater than htol will be reported. (default is None)
- Returns:
success – boolean indicating if the head differences are less than htol.
- Return type:
- compare_list_budget(namefile1: str | PathLike | None = None, namefile2: str | PathLike | None = None, max_cumpd=0.01, max_incpd=0.01, outfile: str | PathLike | None = None, files1: str | PathLike | list[Union[str, os.PathLike]] | None = None, files2: str | PathLike | list[Union[str, os.PathLike]] | None = None)[source]
Compare list file budget results from two simulations.
- Parameters:
namefile1 (str or PathLike, optional) – namefile path for base model
namefile2 (str or PathLike, optional) – namefile path for comparison model
max_cumpd (float) – maximum percent discrepancy allowed for cumulative budget terms (default is 0.01)
max_incpd (float) – maximum percent discrepancy allowed for incremental budget terms (default is 0.01)
outfile (str or PathLike, optional) – budget comparison output file name. If outfile is None, no comparison output is saved. (default is None)
files1 (str, PathLike, or list, optional) – base model output file. If files1 is not None, results will be extracted from files1 and namefile1 will not be used. (default is None)
files2 (str, PathLike, or list, optional) – comparison model output file. If files2 is not None, results will be extracted from files2 and namefile2 will not be used. (default is None)
- Returns:
success – boolean indicating if the difference between budgets are less than max_cumpd and max_incpd
- Return type:
- compare_stages(namefile1: str | PathLike | None = None, namefile2: str | PathLike | None = None, files1: str | PathLike | list[str | os.PathLike] | None = None, files2: str | PathLike | list[str | os.PathLike] | None = None, htol=0.001, outfile: str | PathLike | None = None, difftol=False, verbose=False)[source]
Compare stage results from two simulations.
- Parameters:
namefile1 (str or PathLike, optional) – namefile path for base model
namefile2 (str or PathLike, optional) – namefile path for comparison model
precision (str) – precision for binary head file (“auto”, “single”, or “double”) default is “auto”
htol (float) – maximum allowed stage difference (default is 0.001)
outfile (str or PathLike, optional) – head comparison output file name. If outfile is None, no comparison output is saved. (default is None)
files1 (str, PathLike, or list of str or PathLike, optional) – base model output file. If files1 is not None, results will be extracted from files1 and namefile1 will not be used. (default is None)
files2 (str, PathLike, or list of str or PathLike, optional) – comparison model output file. If files2 is not None, results will be extracted from files2 and namefile2 will not be used. (default is None)
difftol (bool) – boolean determining if the absolute value of the stage difference greater than htol should be evaluated (default is False)
verbose (bool) – boolean indicating if verbose output should be written to the terminal (default is False)
- Returns:
success – boolean indicating if the stage differences are less than htol.
- Return type:
- compare_swrbudget(namefile1: str | PathLike | None = None, namefile2: str | PathLike | None = None, max_cumpd=0.01, max_incpd=0.01, outfile: str | PathLike | None = None, files1: str | PathLike | list[str | os.PathLike] | None = None, files2: str | PathLike | list[str | os.PathLike] | None = None)[source]
Compare the SWR budget results from two simulations.
- Parameters:
namefile1 (str or PathLike, optional) – namefile path for base model
namefile2 (str or PathLike, optional) – namefile path for comparison model
max_cumpd (float) – maximum percent discrepancy allowed for cumulative budget terms (default is 0.01)
max_incpd (float) – maximum percent discrepancy allowed for incremental budget terms (default is 0.01)
outfile (str or PathLike, optional) – budget comparison output file name. If outfile is None, no comparison output is saved. (default is None)
files1 (str, PathLike, or list, optional) – base model output file. If files1 is not None, results will be extracted from files1 and namefile1 will not be used. (default is None)
files2 (str, PathLike, or list, optional) – comparison model output file. If files2 is not None, results will be extracted from files2 and namefile2 will not be used. (default is None)
- Returns:
success – boolean indicating if the difference between budgets are less than max_cumpd and max_incpd
- Return type:
- eval_bud_diff(fpth: str | PathLike, b0: CellBudgetFile, b1: CellBudgetFile, ia: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, dtol: float = 1e-06)[source]
Evaluate differences in cell-by-cell budget terms between two simulations.
Notes
term, which is stored in the diagonal position of the flowja array.
The following code can be used to extract ia from the grb file.
`python import flopy import os # get ia/ja from binary grid file fname = '{}.dis.grb'.format(os.path.basename(sim.name)) fpth = os.path.join(sim.simpath, fname) grbobj = flopy.mf6.utils.MfGrdFile(fpth) ia = grbobj._datadict['IA'] - 1 `- Parameters:
fpth (str or PathLike) – path to summary output file
b0 (flopy.utils.CellBudgetFile) – cell budget file object for the base model
b1 (flopy.utils.CellBudgetFile) – cell budget file object for the comparison model
ia (np.ndarray, optional) – array of ia values for the model grid. ia is used to identify residuals (default is None)
dtol (float) – maximum allowed difference in budget terms (default is 1e-6)