def test_check_external_files(): external_files = glob.glob('mfsetup/tests/tmp/pleasant_mf6/external' + '/*') has_nans = check_external_files_for_nans(external_files) has_nans = '\n'.join(has_nans) if len(has_nans) > 0: assert False, has_nans
def test_model_setup(pleasant_mf6_setup_from_yaml): m = pleasant_mf6_setup_from_yaml assert isinstance(m, MF6model) assert 'tdis' in m.simulation.package_key_dict assert 'ims' in m.simulation.package_key_dict assert set(m.get_package_list()) == { 'DIS', 'IC', 'NPF', 'STO', 'RCHA', 'OC', 'SFR', 'LAK', 'WEL_0', 'OBS_0', # lak obs todo: specify names of mf6 packages with multiple instances 'CHD_0', 'OBS_1' # head obs } external_path = os.path.join(m.model_ws, 'external') external_files = glob.glob(external_path + '/*') has_nans = check_external_files_for_nans(external_files) has_nans = '\n'.join(has_nans) if len(has_nans) > 0: assert False, has_nans
def test_model_setup_no_nans(model_setup): m = model_setup external_path = os.path.join(m.model_ws, 'external') external_files = glob.glob(external_path + '/*') has_nans = check_external_files_for_nans(external_files) has_nans = '\n'.join(has_nans) if len(has_nans) > 0: assert False, has_nans
def test_model_setup_no_nans(model_setup): m = model_setup external_path = os.path.join(m.model_ws, 'external') external_files = glob.glob(external_path + '/*') has_nans = check_external_files_for_nans(external_files) has_nans = '\n'.join(has_nans) if len(has_nans) > 0: assert False, has_nans # verify that "continue" option was successfully translated # to flopy sim constructor arg "continue_" assert m.simulation.name_file.continue_.array
def test_model_setup_nans(pfl_nwt_setup_from_yaml): m = pfl_nwt_setup_from_yaml external_path = os.path.join(m.model_ws, 'external') bad_file = os.path.normpath('external/CHD_9999.dat') with open('external/CHD_0000.dat') as src: with open(bad_file, 'w') as dest: for i, line in enumerate(src): if i in [10, 11]: values = line.strip().split() values[-1] = 'NaN' dest.write(' '.join(values) + '\n') dest.write(line) external_files = glob.glob(external_path + '/*') has_nans = check_external_files_for_nans(external_files) has_nans = [os.path.normpath(f) for f in has_nans] assert bad_file in has_nans os.remove(bad_file)
def test_model_setup(pleasant_mf6_setup_from_yaml, tmpdir): m = pleasant_mf6_setup_from_yaml assert isinstance(m, MF6model) assert 'tdis' in m.simulation.package_key_dict assert 'ims' in m.simulation.package_key_dict assert set(m.get_package_list()) == { 'DIS', 'IC', 'NPF', 'STO', 'RCHA', 'OC', 'SFR_0', 'LAK_0', 'WEL_0', 'OBS_0', # lak obs todo: specify names of mf6 packages with multiple instances 'CHD_0', 'OBS_1' # head obs } external_path = os.path.join(m.model_ws, 'external') external_files = glob.glob(external_path + '/*') has_nans = check_external_files_for_nans(external_files) has_nans = '\n'.join(has_nans) if len(has_nans) > 0: assert False, has_nans make_xsections = False if make_xsections: outpdf = Path('postproc/lake_xsections.pdf') make_lake_xsections(m, i_range=(30, 51), j_range=(30, 41), bathymetry_raster=m.cfg['lak']['source_data'] ['bathymetry_raster']['filename'], datum=298.73, outpdf=outpdf)