In [1]:
import os
import sys
import flopy
print(sys.version)
print('flopy version: {}'.format(flopy.__version__))
In [2]:
path = os.path.join('..', 'data', 'mf2005_test')
In [3]:
m = flopy.modflow.Modflow.load('test1ss.nam', model_ws=path)
m.change_model_ws('data')
By default, the checker performs a model-level check when a set of model files are loaded, unless load is called with check=False
. The load check only produces screen output if load is called with verbose=True
. Checks are also performed at the package level when an individual package is loaded
check()
methodEach model and each package has a check()
method. The check method has three arguments:
In [4]:
help(m.check)
In [5]:
chk = m.check()
In [6]:
chk.summary_array
Out[6]:
This is a numpy record array that summarizes errors and warnings found by the checker. The package, layer-row-column location of the error, the offending value, and a description of the error are provided. In the checker, errors and warnings are loosely defined as follows:
either input that would cause MODFLOW to crash, or inputs that almost certainly mis-represent the intended conceptual model.
inputs that are potentially problematic, but may be intentional.
each package-level check produces a check instance with a summary array. The model level checks combine the summary arrays from the packages into a master summary array. At the model and the package levels, the summary array is used to generate the screen output shown above. At either level, the summary array can be written to a csv file by supply a filename to the f
argument. Specifying level=2
prints the summary array to the screen.
In [7]:
m.check(level=2)
Out[7]:
In [8]:
m.rch.check()
Out[8]:
In [9]:
m.check(f='checksummary.csv')
Out[9]:
In [10]:
try:
import pandas as pd
df = pd.read_csv('data/checksummary.csv')
except:
df = open('data/checksummary.csv').readlines()
df
Out[10]:
write_input()
checking is also performed by default when write_input()
is called at the package or model level. Checking on write is performed with the same verbose
setting as specified for the model. However, if errors or warnings are encountered and level=1
(default) or higher, a screen message notifies the user of the errors.
By default, the checks performed on load()
and write_input()
save results to a summary file, which is named after the packge or the model.
In [11]:
m.write_input()
In [ ]: