diff --git a/examples/build_1d2dmodel.ipynb b/examples/build_1d2dmodel.ipynb index 6c966a19..e7761443 100644 --- a/examples/build_1d2dmodel.ipynb +++ b/examples/build_1d2dmodel.ipynb @@ -129,7 +129,7 @@ "metadata": {}, "outputs": [], "source": [ - "fn_yml = \"dflowfm_build.yml\"\n", + "fn_yml = \"dflowfm_build_piave.yml\"\n", "with open(fn_yml, \"r\") as f:\n", " txt = f.read()\n", "print(txt)" diff --git a/examples/dflowfm_build.yml b/examples/dflowfm_build_piave.yml similarity index 100% rename from examples/dflowfm_build.yml rename to examples/dflowfm_build_piave.yml diff --git a/examples/dflowfm_piave/dflowfm/DFlowFM.mdu b/examples/dflowfm_piave/dflowfm/DFlowFM.mdu index 412b84f1..21be0f1c 100644 --- a/examples/dflowfm_piave/dflowfm/DFlowFM.mdu +++ b/examples/dflowfm_piave/dflowfm/DFlowFM.mdu @@ -189,7 +189,7 @@ restartDateTime = # Restart time [YYYYMMDDHHMMSS], only relevant in case of res [External Forcing] extForceFile = # Old format for external forcings file *.ext, link with tim/cmp-format boundary conditions specification. extForceFileNew = bnd.ext # New format for external forcings file *.ext, link with bcformat boundary conditions specification. -rainfall = # Include rainfall, (0=no, 1=yes). +rainfall = 1 # Include rainfall, (0=no, 1=yes). qExt = # Include user Qin/out, externally provided, (0=no, 1=yes). evaporation = # Include evaporation in water balance, (0=no, 1=yes). windExt = # Include wind, externally provided, (0=no, 1=reserved for EC, 2=yes). diff --git a/examples/dflowfm_piave/dflowfm/bnd.ext b/examples/dflowfm_piave/dflowfm/bnd.ext index 381d622d..4a3d6033 100644 --- a/examples/dflowfm_piave/dflowfm/bnd.ext +++ b/examples/dflowfm_piave/dflowfm/bnd.ext @@ -1,4 +1,4 @@ -# written by HYDROLIB-core 0.5.2 +# written by HYDROLIB-core 0.8.0 [General] fileVersion = 2.01 @@ -24,3 +24,8 @@ quantity = waterlevelbnd nodeId = 1391540.018037_5858077.577220 forcingFile = boundarycondition1d.bc +[Meteo] +quantity = rainfall_rate # Name of the quantity. See UM Section C.5.3 +forcingFile = meteo_boundaryconditions.bc # Name of file containing the forcing for this meteo quantity. +forcingFileType = bcAscii # Type of forcingFile. + diff --git a/examples/dflowfm_piave/dflowfm/meteo_boundaryconditions.bc b/examples/dflowfm_piave/dflowfm/meteo_boundaryconditions.bc new file mode 100644 index 00000000..9a3640b3 --- /dev/null +++ b/examples/dflowfm_piave/dflowfm/meteo_boundaryconditions.bc @@ -0,0 +1,19 @@ +# written by HYDROLIB-core 0.8.0 + +[General] +fileVersion = 1.01 +fileType = boundConds + +[Forcing] +name = global +function = timeseries +timeInterpolation = linear +offset = 0.0 +factor = 1.0 +quantity = time +unit = hours since 2020-01-01 00:00:00 +quantity = rainfall_rate +unit = mm/day +0.0 150.0 +24.0 150.0 + diff --git a/tests/data/test_data.yaml b/tests/data/data_catalog_local.yaml similarity index 100% rename from tests/data/test_data.yaml rename to tests/data/data_catalog_local.yaml diff --git a/tests/data/dflowfm_build_local.yml b/tests/data/dflowfm_build_local.yml index b030587e..e3488246 100644 --- a/tests/data/dflowfm_build_local.yml +++ b/tests/data/dflowfm_build_local.yml @@ -1,7 +1,7 @@ global: - crs: 32647 - network_snap_offset: 25 - openwater_computation_node_distance: 40 + crs: 32647 + network_snap_offset: 25 + openwater_computation_node_distance: 40 setup_rivers: region: diff --git a/tests/data/dflowfm_build.yml b/tests/data/dflowfm_build_piave.yml similarity index 86% rename from tests/data/dflowfm_build.yml rename to tests/data/dflowfm_build_piave.yml index 4783d98c..e818f3cd 100644 --- a/tests/data/dflowfm_build.yml +++ b/tests/data/dflowfm_build_piave.yml @@ -1,7 +1,7 @@ global: - crs: 3857 - network_snap_offset: 25 - openwater_computation_node_distance: 40 + crs: 3857 + network_snap_offset: 25 + openwater_computation_node_distance: 40 setup_rivers_from_dem: region: @@ -62,9 +62,8 @@ setup_maps_from_raster_reclass: reclass_variables: ['roughness_manning', 'infiltcap'] interpolation_method: triangulation -#setup_rainfall_from_constant: -# constant_value: 150 -# this should probably be uncommented: https://github.com/Deltares/hydromt_delft3dfm/issues/177 +setup_rainfall_from_constant: + constant_value: 150 setup_link1d2d: link_direction: 1d_to_2d \ No newline at end of file diff --git a/tests/data/piave/dimr_config.xml b/tests/data/piave/dimr_config.xml deleted file mode 100644 index 46c325a9..00000000 --- a/tests/data/piave/dimr_config.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - 1.3 - hydrolib-core 0.5.2 - 2023-07-03T15:30:24.518574 - - - - - - dflowfm - dflowfm - DFlowFM.mdu - - diff --git a/tests/test_dflowfm.py b/tests/test_dflowfm.py index 2f8d168e..36130a10 100644 --- a/tests/test_dflowfm.py +++ b/tests/test_dflowfm.py @@ -52,11 +52,7 @@ def test_setup_mesh2d_refine(tmpdir): def test_setup_channels(tmpdir): # Instantiate a dummy model - model = DFlowFMModel( - root=join(EXAMPLEDIR, "dflowfm_local"), - mode="r", - data_libs=[join(TESTDATADIR, "test_data.yaml")] - ) + model = DFlowFMModel(root=join(EXAMPLEDIR, "dflowfm_local"), mode="r") model.read() model.set_root(tmpdir, mode="w") diff --git a/tests/test_hydromt.py b/tests/test_hydromt.py index 2a1308bc..7e4bbc26 100644 --- a/tests/test_hydromt.py +++ b/tests/test_hydromt.py @@ -14,12 +14,12 @@ _models = { "piave": { - "ini": "dflowfm_build.yml", + "ini": join(TESTDATADIR, "dflowfm_build_piave.yml"), "data": "artifact_data", }, "local": { - "ini": "dflowfm_build_local.yml", - "data": join(TESTDATADIR, "test_data.yaml"), + "ini": join(TESTDATADIR, "dflowfm_build_local.yml"), + "data": join(TESTDATADIR, "data_catalog_local.yaml"), }, } @@ -41,7 +41,7 @@ def test_model_build(tmpdir, modelname): model_dict = _models[modelname] # Build method options - config = join(TESTDATADIR, model_dict["ini"]) + config = model_dict["ini"] opt = parse_config(config) # pop global section and get model init arguments global_sect = opt.pop('global') @@ -94,7 +94,7 @@ def test_model_build_local_code(tmp_path): """ model_dict = _models["local"] # Build method options - config = join(TESTDATADIR, model_dict["ini"]) + config = model_dict["ini"] opt = parse_config(config) # pop global section and get model init arguments global_sect = opt.pop('global') @@ -138,7 +138,7 @@ def test_model_build_piave_code(tmp_path): """ model_dict = _models["piave"] # Build method options - config = join(TESTDATADIR, model_dict["ini"]) + config = model_dict["ini"] opt = parse_config(config) # pop global section and get model init arguments global_sect = opt.pop('global') @@ -164,4 +164,5 @@ def test_model_build_piave_code(tmp_path): model.setup_mesh2d(**opt['setup_mesh2d']) model.setup_maps_from_rasterdataset(**opt['setup_maps_from_rasterdataset']) model.setup_maps_from_raster_reclass(**opt['setup_maps_from_raster_reclass']) + model.setup_rainfall_from_constant(**opt["setup_rainfall_from_constant"]) model.setup_link1d2d(**opt['setup_link1d2d'])