Skip to content

Commit

Permalink
Change river parameters to standard names
Browse files Browse the repository at this point in the history
  • Loading branch information
vers-w committed Dec 11, 2024
1 parent 24f9435 commit 2ba909b
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 84 deletions.
15 changes: 7 additions & 8 deletions server/test/sbm_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ vegetation__specific-leaf_storage = "Sl"
vegetation_woody-part__storage_capacity = "Swood"
vegetation_root__depth = "RootingDepth"

river__length = "wflow_riverlength"
river_water_flow__manning_n_parameter = "N_River"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"
river_bank_water__depth = "RiverDepth"
river_bank_water__elevation = "RiverZ"

# specify the internal IDs of the parameters which vary over time
# the external name mapping needs to be below together with the other mappings
forcing = [
Expand All @@ -105,14 +112,6 @@ netcdf.variable.name = "KsatVer"
scale = 1.0
offset = 0.0

[input.lateral.river]
length = "wflow_riverlength"
mannings_n = "N_River"
slope = "RiverSlope"
width = "wflow_riverwidth"
bankfull_elevation = "RiverZ"
bankfull_depth = "RiverDepth"

[input.lateral.river.reservoir]
area = "ResSimpleArea"
areas = "wflow_reservoirareas"
Expand Down
13 changes: 3 additions & 10 deletions src/routing/surface_kinwave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,30 +91,23 @@ function RiverFlowParameters(dataset, config, indices, river_length, river_width
mannings_n = ncread(
dataset,
config,
"lateral.river.mannings_n";
"river_water_flow__manning_n_parameter";
sel = indices,
defaults = 0.036,
type = Float,
)
bankfull_depth = ncread(
dataset,
config,
"lateral.river.bankfull_depth";
alias = "lateral.river.h_bankfull",
"river_bank_water__depth";
sel = indices,
defaults = 1.0,
type = Float,
)
if haskey(config.input.lateral.river, "h_bankfull")
@warn string(
"The `h_bankfull` key in `[input.lateral.river]` is now called ",
"`bankfull_depth`. Please update your TOML file.",
)
end
slope = ncread(
dataset,
config,
"lateral.river.slope";
"river__slope";
optional = false,
sel = indices,
type = Float,
Expand Down
6 changes: 3 additions & 3 deletions src/routing/surface_local_inertial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ function LocalInertialRiverFlowParameters(
bankfull_elevation_2d = ncread(
dataset,
config,
"lateral.river.bankfull_elevation";
"river_bank_water__elevation";
optional = false,
type = Float,
fill = 0,
)
bankfull_depth_2d = ncread(
dataset,
config,
"lateral.river.bankfull_depth";
"river_bank_water__depth";
optional = false,
type = Float,
fill = 0,
Expand All @@ -76,7 +76,7 @@ function LocalInertialRiverFlowParameters(
mannings_n = ncread(
dataset,
config,
"lateral.river.mannings_n";
"river_water_flow__manning_n_parameter";
sel = indices,
defaults = 0.036,
type = Float,
Expand Down
4 changes: 2 additions & 2 deletions src/sbm_gwf_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function initialize_sbm_gwf_model(config::Config)
river_width_2d = ncread(
dataset,
config,
"lateral.river.width";
"river__width";
optional = false,
type = Float,
fill = 0,
Expand All @@ -69,7 +69,7 @@ function initialize_sbm_gwf_model(config::Config)
river_length_2d = ncread(
dataset,
config,
"lateral.river.length";
"river__length";
optional = false,
type = Float,
fill = 0,
Expand Down
4 changes: 2 additions & 2 deletions src/sbm_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function initialize_sbm_model(config::Config)
river_width_2d = ncread(
dataset,
config,
"lateral.river.width";
"river__width";
optional = false,
type = Float,
fill = 0,
Expand All @@ -67,7 +67,7 @@ function initialize_sbm_model(config::Config)
river_length_2d = ncread(
dataset,
config,
"lateral.river.length";
"river__length";
optional = false,
type = Float,
fill = 0,
Expand Down
8 changes: 4 additions & 4 deletions test/run_sbm_gwf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ tomlpath = joinpath(@__DIR__, "sbm_gwf_config.toml")
config = Wflow.Config(tomlpath)
config.model.river_routing = "local-inertial"

config.input.lateral.river.bankfull_elevation = "bankfull_elevation"
config.input.lateral.river.bankfull_depth = "bankfull_depth"
config.input.river_bank_water__elevation = "bankfull_elevation"
config.input.river_bank_water__depth = "bankfull_depth"

model = Wflow.initialize_sbm_gwf_model(config)
Wflow.run_timestep!(model)
Expand All @@ -108,8 +108,8 @@ config = Wflow.Config(tomlpath)
config.model.river_routing = "local-inertial"
config.model.land_routing = "local-inertial"

config.input.lateral.river.bankfull_elevation = "bankfull_elevation"
config.input.lateral.river.bankfull_depth = "bankfull_depth"
config.input.river_bank_water__elevation = "bankfull_elevation"
config.input.river_bank_water__depth = "bankfull_depth"
config.input.lateral.land.elevation = "wflow_dem"

pop!(Dict(config.state.lateral.land.variables), "q")
Expand Down
15 changes: 7 additions & 8 deletions test/sbm_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ vegetation__specific-leaf_storage = "Sl"
vegetation_woody-part__storage_capacity = "Swood"
vegetation_root__depth = "RootingDepth"

river__length = "wflow_riverlength"
river_water_flow__manning_n_parameter = "N_River"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"
river_bank_water__depth = "RiverDepth"
river_bank_water__elevation = "RiverZ"

# specify the internal IDs of the parameters which vary over time
# the external name mapping needs to be below together with the other mappings
forcing = [
Expand All @@ -105,14 +112,6 @@ netcdf.variable.name = "KsatVer"
scale = 1.0
offset = 0.0

[input.lateral.river]
length = "wflow_riverlength"
mannings_n = "N_River"
slope = "RiverSlope"
width = "wflow_riverwidth"
bankfull_elevation = "RiverZ"
bankfull_depth = "RiverDepth"

[input.lateral.river.reservoir]
area = "ResSimpleArea"
areas = "wflow_reservoirareas"
Expand Down
11 changes: 5 additions & 6 deletions test/sbm_gw.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ vegetation__specific-leaf_storage = "Sl"
vegetation_woody-part__storage_capacity = "Swood"
vegetation_root__depth = "RootingDepth"

river__length = "wflow_riverlength"
river_water_flow__manning_n_parameter = "N_River"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"

# specify the internal IDs of the parameters which vary over time
# the external name mapping needs to be below together with the other mappings
forcing = [
Expand All @@ -95,12 +100,6 @@ potential_evaporation = "pet"
precipitation = "precip"
temperature = "temp"

[input.lateral.river]
length = "wflow_riverlength"
mannings_n = "N_River"
slope = "RiverSlope"
width = "wflow_riverwidth"

[input.lateral.river.reservoir]
area = "ResSimpleArea"
areas = "wflow_reservoirareas"
Expand Down
11 changes: 5 additions & 6 deletions test/sbm_gwf_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ vegetation_root__depth = "rootingdepth"
vegetation_canopy__gap_fraction = "canopygapfraction"
vegetation_water__storage_capacity = "cmax"

river__length = "wflow_riverlength"
river_water_flow__manning_n_parameter = "N_river"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"

# specify the internal IDs of the parameters which vary over time
# the external name mapping needs to be below together with the other mappings
forcing = [
Expand All @@ -71,12 +76,6 @@ forcing = [
potential_evaporation = "PET"
precipitation = "P"

[input.lateral.river]
length = "wflow_riverlength"
mannings_n = "N_river"
slope = "RiverSlope"
width = "wflow_riverwidth"

[input.lateral.land]
mannings_n = "N"
slope = "Slope"
Expand Down
13 changes: 6 additions & 7 deletions test/sbm_gwf_piave_demand_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ vegetation_woody-part__storage_capacity = "Swood"
vegetation_root__depth = "RootingDepth"
vegetation__crop_factor = "crop_factor"

river__length = "wflow_riverlength"
river_water_flow__manning_n_parameter = "N_River"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"
river_bank_water__depth = "RiverDepth"

forcing = [
"vertical.atmospheric_forcing.precipitation",
"vertical.atmospheric_forcing.temperature",
Expand Down Expand Up @@ -168,13 +174,6 @@ irrigation_trigger = "irrigation_trigger"
irrigation_areas = "nonpaddy_irrigation_areas"
irrigation_trigger = "irrigation_trigger"

[input.lateral.river]
length = "wflow_riverlength"
n = "N_River"
slope = "RiverSlope"
width = "wflow_riverwidth"
bankfull_depth = "RiverDepth"

[input.lateral.subsurface]
constant_head = "constant_head"
conductivity_profile = "exponential"
Expand Down
13 changes: 6 additions & 7 deletions test/sbm_piave_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ vegetation_woody-part__storage_capacity = "Swood"
vegetation_root__depth = "RootingDepth"
vegetation__crop_factor = "crop_factor"

river__length = "wflow_riverlength"
river_water_flow__manning_n_parameter = "N_River"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"
river_bank_water__depth = "RiverDepth"

forcing = [
"vertical.atmospheric_forcing.precipitation",
"vertical.atmospheric_forcing.temperature",
Expand Down Expand Up @@ -118,13 +124,6 @@ q = "q_land"
h = "h_land"
h_av = "h_av_land"

[input.lateral.river]
length = "wflow_riverlength"
mannings_n = "N_River"
slope = "RiverSlope"
width = "wflow_riverwidth"
bankfull_depth = "RiverDepth"

[input.lateral.subsurface]
ksathorfrac = "KsatHorFrac"

Expand Down
13 changes: 6 additions & 7 deletions test/sbm_piave_demand_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ vegetation_woody-part__storage_capacity = "Swood"
vegetation_root__depth = "RootingDepth"
vegetation__crop_factor = "crop_factor"

river__length = "wflow_riverlength"
river_water_flow__manning_n_parameter = "N_River"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"
river_bank_water__depth = "RiverDepth"

forcing = [
"vertical.atmospheric_forcing.precipitation",
"vertical.atmospheric_forcing.temperature",
Expand Down Expand Up @@ -162,13 +168,6 @@ irrigation_trigger = "irrigation_trigger"
irrigation_areas = "nonpaddy_irrigation_areas"
irrigation_trigger = "irrigation_trigger"

[input.lateral.river]
length = "wflow_riverlength"
mannings_n = "N_River"
slope = "RiverSlope"
width = "wflow_riverwidth"
bankfull_depth = "RiverDepth"

[input.lateral.subsurface]
ksathorfrac = "KsatHorFrac"

Expand Down
11 changes: 5 additions & 6 deletions test/sbm_simple.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ vegetation__specific-leaf_storage = "Sl"
vegetation_woody-part__storage_capacity = "Swood"
vegetation_root__depth = "RootingDepth"

river__length = "wflow_riverlength"
river_water_flow__manning_n_parameter = "N_River"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"

# specify the internal IDs of the parameters which vary over time
# the external name mapping needs to be below together with the other mappings
forcing = [
Expand All @@ -67,12 +72,6 @@ potential_evaporation = "pet"
precipitation = "precip"
temperature = "temp"

[input.lateral.river]
length = "wflow_riverlength"
n = "N_River"
slope = "RiverSlope"
width = "wflow_riverwidth"

[input.lateral.river.reservoir]
area = "ResSimpleArea"
areas = "wflow_reservoirareas"
Expand Down
15 changes: 7 additions & 8 deletions test/sbm_swf_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ vegetation__specific-leaf_storage = "Sl"
vegetation_woody-part__storage_capacity = "Swood"
vegetation_root__depth = "RootingDepth"

river__length = "wflow_riverlength"
river_water_flow__manning_n_parameter = "N_River"
river__slope = "RiverSlope"
river__width = "wflow_riverwidth"
river_bank_water__depth = "RiverDepth"
river_bank_water__elevation = "RiverZ"

# specify the internal IDs of the parameters which vary over time
# the external name mapping needs to be below together with the other mappings
forcing = [
Expand All @@ -96,14 +103,6 @@ potential_evaporation = "pet"
precipitation = "precip"
temperature = "temp"

[input.lateral.river]
length = "wflow_riverlength"
mannings_n = "N_River"
slope = "RiverSlope"
width = "wflow_riverwidth"
bankfull_elevation = "RiverZ"
bankfull_depth = "RiverDepth"

[input.lateral.river.reservoir]
area = "ResSimpleArea"
areas = "wflow_reservoirareas"
Expand Down

0 comments on commit 2ba909b

Please sign in to comment.