Skip to content

Commit

Permalink
Merge branch 'master' into v1_quarto_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoostBuitink committed Nov 11, 2024
2 parents 0676a72 + 2a63e95 commit 83b91a2
Show file tree
Hide file tree
Showing 80 changed files with 6,130 additions and 10,657 deletions.
12 changes: 12 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Options for the JuliaFormatter auto syntax formatting tool.
# https://domluna.github.io/JuliaFormatter.jl/stable/
# https://docs.sciml.ai/SciMLStyle/stable/

# Based on the default style we do pick these non-default options from SciML style:
whitespace_ops_in_indices = true
remove_extra_newlines = true
always_for_in = true
whitespace_typedefs = true

# And add other options we like:
separate_kwargs_with_semicolon = true
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- v1
tags: '*'
jobs:
test:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/CIWflowServer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- v1
tags: '*'
jobs:
test:
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# General
.DS_Store

# VS Code stuff
.vscode

# Packaging stuff
*.jl.*.cov
*.jl.cov
Expand Down
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"[julia]": {
"editor.formatOnSave": true,
},
"julia.lint.disabledDirs": [
".pixi"
],
"julia.lint.run": true,
}
7 changes: 1 addition & 6 deletions build/create_binaries/download_test_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ end

staticmaps_rhine_path = testdata(v"0.1", "staticmaps.nc", "staticmaps-rhine.nc")
staticmaps_moselle_path =
testdata(v"0.2.8", "staticmaps-moselle.nc", "staticmaps-moselle.nc")
staticmaps_lahn_path = testdata(v"0.2.1", "staticmaps-lahn.nc", "staticmaps-lahn.nc")
staticmaps_meuse_path =
testdata(v"0.2.8", "staticmaps_flex_meuse.nc", "staticmaps_flex_meuse.nc")
testdata(v"0.2.9", "staticmaps-moselle.nc", "staticmaps-moselle.nc")
forcing_moselle_path = testdata(v"0.2.6", "forcing-moselle.nc", "forcing-moselle.nc")
forcing_lahn_path = testdata(v"0.2", "forcing-lahn.nc", "forcing-lahn.nc")
forcing_moselle_sed_path =
testdata(v"0.2.3", "forcing-moselle-sed.nc", "forcing-moselle-sed.nc")
staticmaps_moselle_sed_path =
Expand All @@ -42,7 +38,6 @@ forcing_sbm_gw_path = testdata(
"forcing-sbm-groundwater-part2.nc",
"forcing-sbm-groundwater-part2.nc",
)
forcing_meuse_path = testdata(v"0.2.8", "forcing_meuse.nc", "forcing_meuse.nc")
staticmaps_sbm_gw_path =
testdata(v"0.2.3", "staticmaps-sbm-groundwater.nc", "staticmaps-sbm-groundwater.nc")
instates_sbm_gw_path =
Expand Down
1 change: 0 additions & 1 deletion build/create_binaries/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ testdir = abspath(dirname(pathof(Wflow)), "..", "test")

Wflow.run(joinpath(testdir, "sbm_config.toml"))
Wflow.run(joinpath(testdir, "sbm_gwf_config.toml"))
Wflow.run(joinpath(testdir, "hbv_config.toml"))
Wflow.run(joinpath(testdir, "sediment_config.toml"))
18 changes: 10 additions & 8 deletions build/wflow_cli/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ using Test
using Wflow

extension = Sys.iswindows() ? ".exe" : ""
wflow_exe = normpath(@__DIR__, "../../create_binaries/wflow_bundle/bin/wflow_cli" * extension)
wflow_exe =
normpath(@__DIR__, "../../create_binaries/wflow_bundle/bin/wflow_cli" * extension)

# this assumes that the Wflow tests have already been run, so the data has been downloaded
testdir = abspath(dirname(pathof(Wflow)), "..", "test")
Expand All @@ -14,15 +15,15 @@ outputdir = joinpath(datadir, "output")

@testset "no_config" begin
# Clean output directory
rm(outputdir; force=true, recursive=true)
rm(outputdir; force = true, recursive = true)
@test_throws ProcessFailedException run(`$wflow_exe`)
# Check if no files are being created
@test !(isdir(outputdir))
end

@testset "wflow_sbm" begin
# Clean directory
rm(outputdir; force=true, recursive=true)
rm(outputdir; force = true, recursive = true)
# Run cli with the toml
toml = normpath(testdir, "sbm_config.toml")
run(`$wflow_exe $toml`)
Expand All @@ -43,7 +44,7 @@ end

@testset "wflow_sbm-gwf" begin
# Clean directory
rm(outputdir; force=true, recursive=true)
rm(outputdir; force = true, recursive = true)
# Run cli with the toml
toml = normpath(testdir, "sbm_gwf_config.toml")
run(`$wflow_exe $toml`)
Expand All @@ -63,7 +64,7 @@ end

@testset "wflow_sediment" begin
# Clean directory
rm(outputdir; force=true, recursive=true)
rm(outputdir; force = true, recursive = true)
# Run cli with the toml
toml = normpath(testdir, "sediment_config.toml")
run(`$wflow_exe $toml`)
Expand All @@ -82,11 +83,12 @@ end
end

@testset "wflow_sbm_timing" begin

toml = normpath(testdir, "sbm_config.toml")
time_sbm_1thread = @elapsed run(Cmd(`$wflow_exe $toml`, env=("JULIA_NUM_THREADS" => "1",)))
time_sbm_1thread =
@elapsed run(Cmd(`$wflow_exe $toml`; env = ("JULIA_NUM_THREADS" => "1",)))

time_sbm_4thread = @elapsed run(Cmd(`$wflow_exe $toml`, env=("JULIA_NUM_THREADS" => "4", )))
time_sbm_4thread =
@elapsed run(Cmd(`$wflow_exe $toml`; env = ("JULIA_NUM_THREADS" => "4",)))

# Test if run with more threads is indeed faster
@test time_sbm_4thread < time_sbm_1thread
Expand Down
27 changes: 22 additions & 5 deletions docs/changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,31 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.0.0
## Unreleased

### Fixed
- Initialization of `LateralSSF` variables `ssf` and `ssfmax` with vertical hydraulic
conductivity profile `exponential_constant`. Removed parameter `khfrac` from the
computation, as it is already part of parameter `kh_0`.

### Changed
- Removed vertical concepts `HBV` and `FLEXTopo`.
- Removed metadata macros `exchange`, `grid_type` and `grid_location`. The macro `grid_type`
is not required because this functionality is already part of `BMI`. The macros `exchange`
and `grid_location` are replaced by functions resulting in cleaner code.
- Removed metadata macros `exchange` and `grid_type`. The macro `grid_type` is not required
because this functionality is already part of `BMI`. The macro `exchange` is replaced by a
function used by `BMI`. Remaining metadata macros `get_units` and `grid_loc` are only used
by `BMI`.
- Refactor the vertical `SBM` concept: divide the long struct `SBM` into different model
components for interception, snow, glacier, (open water) runoff, soil, water demand and
allocation stored in the struct `LandHydrologySBM`. Additionally, the atmospheric forcing
and a shared vegetation parameterset are stored as separate fields in struct
`LandHydrologySBM` (with soil model `SbmSoilModel`). The model component structs have
model `variables`, `parameters` and `boundary_conditions` (if applicable), including
associated functions for initializing and updating these model components. The original
long update function of the `SBM` soil part has been split into separate functions.

### Added
- Support direct output of snow and glacier melt, and add computation of snow water
equivalent (SWE).

## v0.x releases

Expand Down Expand Up @@ -92,7 +106,10 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- For improved code readability it is now discouraged to use non-ASCII characters for the
names of variables, structs, functions and macros. Using the non-ASCII character for
built-in operators is still allowed. This change in naming convention is now in effect and
all invalid uses of non-ASCII characters have been replaced by ASCII equivalents.
all invalid uses of non-ASCII characters have been replaced by ASCII equivalents. This
change also impacts the TOML keys `kv₀`, `θᵣ` and `θₛ`. These keys have been replaced with
the ASCII versions `kv_0`, `theta_r` and `theta_s` in v0.4.0 and the old keys are not
supported anymore.
- Docs: 1) improved description of different model configurations in model-setup.md, also in
relation to hydromt\_wflow in docs, 2) citing info related to wflow\_sbm publication in
Geosci. Model Dev. (from in review to published).
Expand Down
11 changes: 11 additions & 0 deletions docs/home/publications.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ R., Francés, F., Kollet, S., Rigon, R., Weerts, A. & Samaniego, L, 2024. Multi-
hydrological reference dataset over continental Europe and an African basin. Sci Data, 11,
1009\. <https://doi.org/10.1038/s41597-024-03825-9>.

Droppers, B., Rakovec, O., Avila, L., Azimi, S., Cortés-Torres N., De León Pérez, D.,
Imhoff, R., Francés, F., Kollet, S., Rigon, R., Weerts, A. & Samaniego, L, 2024. Multi-model
hydrological reference dataset over continental Europe and an African basin. Sci Data, 11,
1009\. <https://doi.org/10.1038/s41597-024-03825-9>.

Emerton, R.E., Stephens, E.M., Pappenberger, F., Pagano, T.C., Weerts, A.H., Wood, A.W.,
Salamon, P., Brown, J.D., Hjerdt, N., Donnelly, C., Baugh, C.A., Cloke, H.L., 2016. Continental
and global scale flood forecasting systems. WIREs Water 3, 391–418.
Expand Down Expand Up @@ -167,6 +172,12 @@ van der Laan, E., P. Hazenberg, A.H. Weerts, 2024. Simulation of long-term stora
headwater reservoirs across the globe using public cloud computing infrastructure. Science of
The Total Environment, 172678, <https://doi.org/10.1016/j.scitotenv.2024.172678>.

Pranoto, B., Soekarno, H., Hartulistiyoso, E., Nur Aidi, M., Sutrisno, D., Pohan, D.,
Radhika, Sutejo, B., Heru Kuncoro, A., Nahib, I., 2024. Integrating Flood Early Warning
System (FEWS) for Optimizing Small Hydropower Sites: A West Java Case Study. EVERGREEN Joint
Journal of Novel Carbon Resource Sciences & Green Asia Strategy, 11, 3, 2691-2699.
<https://www.tj.kyushu-u.ac.jp/evergreen/contents/EG2024-11_3_content/pdf/p2691-2699.pdf>

van Osnabrugge, B., Weerts, A.H., Uijlenhoet, R., 2017. genRE: A method to extend gridded
precipitation climatology data sets in near real-time for hydrological forecasting purposes.
Water Resources Research, 53. <https://doi.org/10.1002/2017WR021201>.
Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide/toml_file.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ e_r = "EoverR"
infiltcappath = "InfiltCapPath"
infiltcapsoil = "InfiltCapSoil"
kext = "Kext"
"kv_0" = "KsatVer"
kv_0 = "KsatVer"
leaf_area_index = "LAI" # Cyclic variable
m = "M"
maxleakage = "MaxLeakage"
Expand All @@ -173,8 +173,8 @@ ttm = "TTM"
w_soil = "wflow_soil"
water_holding_capacity = "WHC"
waterfrac = "WaterFrac"
"theta_r" = "thetaR"
"theta_s" = "thetaS"
theta_r = "thetaR"
theta_s = "thetaS"

[input.lateral.river]
length = "wflow_riverlength"
Expand Down
Loading

0 comments on commit 83b91a2

Please sign in to comment.