Skip to content

Commit

Permalink
Merge branch 'main' into setup-retentions
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Oct 24, 2024
2 parents e247847 + 505ed05 commit 385bf9b
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 39 deletions.
2 changes: 1 addition & 1 deletion examples/build_1d2dmodel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/dflowfm_piave/dflowfm/DFlowFM.mdu
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
7 changes: 6 additions & 1 deletion examples/dflowfm_piave/dflowfm/bnd.ext
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# written by HYDROLIB-core 0.5.2
# written by HYDROLIB-core 0.8.0

[General]
fileVersion = 2.01
Expand All @@ -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.

19 changes: 19 additions & 0 deletions examples/dflowfm_piave/dflowfm/meteo_boundaryconditions.bc
Original file line number Diff line number Diff line change
@@ -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

6 changes: 3 additions & 3 deletions tests/data/dflowfm_build_local.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
16 changes: 0 additions & 16 deletions tests/data/piave/dimr_config.xml

This file was deleted.

6 changes: 1 addition & 5 deletions tests/test_dflowfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
13 changes: 7 additions & 6 deletions tests/test_hydromt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
},
}

Expand All @@ -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')
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand All @@ -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'])

0 comments on commit 385bf9b

Please sign in to comment.