diff --git a/.github/workflows/core_tests.yml b/.github/workflows/core_tests.yml index 3f0718576..f5a143e4b 100644 --- a/.github/workflows/core_tests.yml +++ b/.github/workflows/core_tests.yml @@ -44,6 +44,8 @@ jobs: - uses: julia-actions/julia-processcoverage@v1 with: directories: core/src - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 with: files: lcov.info + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/julia_auto_update.yml b/.github/workflows/julia_auto_update.yml index 3ffb81597..c55dcc8b2 100644 --- a/.github/workflows/julia_auto_update.yml +++ b/.github/workflows/julia_auto_update.yml @@ -2,8 +2,8 @@ name: Julia auto update on: schedule: - # At 03:00 on day 1 of the month - - cron: "0 3 1 * *" + # At 03:00 on day 2 of the month + - cron: "0 3 2 * *" # on demand workflow_dispatch: diff --git a/.github/workflows/pixi_auto_update.yml b/.github/workflows/pixi_auto_update.yml index 1276a5335..0b9096599 100644 --- a/.github/workflows/pixi_auto_update.yml +++ b/.github/workflows/pixi_auto_update.yml @@ -2,8 +2,8 @@ name: Pixi auto update on: schedule: - # At 03:00 on day 1 of the month - - cron: "0 3 1 * *" + # At 03:00 on day 3 of the month + - cron: "0 3 3 * *" # on demand workflow_dispatch: diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index 6089785e8..024e31f9a 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -43,4 +43,6 @@ jobs: run: pytest --numprocesses=auto --cov=ribasim --cov-report=xml python/ribasim/tests - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/core/Project.toml b/core/Project.toml index a8010212a..dd3b5b263 100644 --- a/core/Project.toml +++ b/core/Project.toml @@ -2,7 +2,7 @@ name = "Ribasim" uuid = "aac5e3d9-0b8f-4d4f-8241-b1a7a9632635" authors = ["Deltares and contributors "] manifest = "../Manifest.toml" -version = "0.7.0" +version = "2024.02.0" [deps] Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" diff --git a/core/src/main.jl b/core/src/main.jl index 465dfe4be..a1227d89a 100644 --- a/core/src/main.jl +++ b/core/src/main.jl @@ -41,6 +41,9 @@ function main(ARGS::Vector{String})::Cint logger = Ribasim.setup_logger(; verbosity = config.logging.verbosity, stream = io) with_logger(logger) do + ribasim_version = pkgversion(Ribasim) + (; starttime, endtime) = config + @info "Starting a Ribasim simulation." ribasim_version starttime endtime model = Ribasim.run(config) if successful_retcode(model) @info "The model finished successfully" diff --git a/core/src/validation.jl b/core/src/validation.jl index ed2b2ed62..8eecc9ca1 100644 --- a/core/src/validation.jl +++ b/core/src/validation.jl @@ -175,11 +175,11 @@ end @version BasinStaticV1 begin node_id::Int - drainage::Float64 - potential_evaporation::Float64 - infiltration::Float64 - precipitation::Float64 - urban_runoff::Float64 + drainage::Union{Missing, Float64} + potential_evaporation::Union{Missing, Float64} + infiltration::Union{Missing, Float64} + precipitation::Union{Missing, Float64} + urban_runoff::Union{Missing, Float64} end @version BasinTimeV1 begin diff --git a/core/test/run_models_test.jl b/core/test/run_models_test.jl index bc93285f8..74f74668c 100644 --- a/core/test/run_models_test.jl +++ b/core/test/run_models_test.jl @@ -111,6 +111,11 @@ end @test ispath(toml_path) model = Ribasim.run(toml_path) @test model isa Ribasim.Model + @test model.integrator.u.storage ≈ [1000] + @test model.integrator.p.basin.precipitation == [0.0] + @test model.integrator.p.basin.potential_evaporation == [0.0] + @test model.integrator.p.basin.drainage == [0.0] + @test model.integrator.p.basin.infiltration == [0.0] @test successful_retcode(model) end diff --git a/docs/contribute/release.qmd b/docs/contribute/release.qmd index a32bd32eb..e069cce55 100644 --- a/docs/contribute/release.qmd +++ b/docs/contribute/release.qmd @@ -5,8 +5,8 @@ title: "Release process" # What is a release The [Ribasim repository](https://github.com/Deltares/Ribasim) contains several components, e.g., the Julia core, the Python tooling and QGIS plugin. -The components are currently only guaranteed to work together if they are built at the same time. -Therefore we release Ribasim as a collection of all the components at once. +The components are currently only guaranteed to work together if they have the same version number. +Therefore we release Ribasim as a collection of all the components at once, all carrying the same version number. For maximum interoperability it is suggested to only release all components together, and not individually. For these releases we use [Calender Versioning](https://calver.org/), which makes it clear in which month the release was made. @@ -19,19 +19,28 @@ This section provides a guide for developers to follow when preparing a new rele Before starting the release process, ensure that all tests are passing and that all features intended for the release are complete and merged into the main branch. -## Update version numbers of the components as needed +## Update version numbers of the components -The components have their own version number which generally uses [Semantic Versioning](https://semver.org/), with minor version signifying a breaking release for pre-1.0 versions, as [documented here](https://pkgdocs.julialang.org/v1/compatibility/#compat-pre-1.0). If a component did not change at all between releases, the version number can stay the same. +Determine the new version number like `2023.08.0`, filling in the current year, month and a sequential "MICRO" number. +This follows `YYYY.0M.MICRO` from [calver](https://calver.org/). -Now submit a pull request which updates the version numbers of the components as needed. -You can use [PR #623](https://github.com/Deltares/Ribasim/pull/623) as an example. +Update the version numbers in the repository to the new version number. +A single find and replace can update all 5 locations: -In general for Python packages the version number is in `__init__.py`, for Julia it is `Project.toml`, and for QGIS `metadata.txt` +- `pixi.toml` +- `core/Project.toml` +- `python/ribasim/ribasim/__init__.py` +- `python/ribasim_api/ribasim_api/__init__.py` +- `ribasim_qgis/metadata.txt` + +Now submit a pull request to update the version numbers. ## Create a new release -Create a new tag like `v2023.08.0`, filling in the current year, month and a sequential "MICRO" number. -This follows `vYYYY.0M.MICRO` from [calver](https://calver.org/). +When the pull request is merged to main, checkout the commit that updates the version numbers. + +Create a new tag, which is the letter `v` followed by the version number, like, `v2023.08.0`. + This can be done by executing: ```bash git tag @@ -59,19 +68,14 @@ All changes ``` -## Release Ribasim Python to PyPI +## Release the Ribasim Python packages to PyPI To be able to install packages with `pip`, they need to be released on the Python Package Index (PyPI). In order to publish Ribasim Python or Ribasim API follow the following steps: -1) Update `__version__` in `__init__.py` - -2) Open a terminal and run `pixi run build-ribasim-python-wheel` or `pixi run build-ribasim-api-wheel` - -3) Make a new commit with the updated version number, and push to remote - -4) Publish on PyPI with `pixi run publish-ribasim-python` or `pixi run publish-ribasim-api` +1) Open a terminal and run `pixi run publish-ribasim-python` +2) Open a terminal and run `pixi run publish-ribasim-api` ## Do manual checks diff --git a/docs/schema/BasinStatic.schema.json b/docs/schema/BasinStatic.schema.json index 2d8366e7f..747de6602 100644 --- a/docs/schema/BasinStatic.schema.json +++ b/docs/schema/BasinStatic.schema.json @@ -10,24 +10,59 @@ "type": "integer" }, "drainage": { - "format": "double", - "type": "number" + "format": "default", + "anyOf": [ + { + "type": "null" + }, + { + "type": "number" + } + ] }, "potential_evaporation": { - "format": "double", - "type": "number" + "format": "default", + "anyOf": [ + { + "type": "null" + }, + { + "type": "number" + } + ] }, "infiltration": { - "format": "double", - "type": "number" + "format": "default", + "anyOf": [ + { + "type": "null" + }, + { + "type": "number" + } + ] }, "precipitation": { - "format": "double", - "type": "number" + "format": "default", + "anyOf": [ + { + "type": "null" + }, + { + "type": "number" + } + ] }, "urban_runoff": { - "format": "double", - "type": "number" + "format": "default", + "anyOf": [ + { + "type": "null" + }, + { + "type": "number" + } + ] }, "remarks": { "description": "a hack for pandera", @@ -37,11 +72,6 @@ } }, "required": [ - "node_id", - "drainage", - "potential_evaporation", - "infiltration", - "precipitation", - "urban_runoff" + "node_id" ] } diff --git a/pixi.toml b/pixi.toml index f0f7583fe..a09507ee2 100644 --- a/pixi.toml +++ b/pixi.toml @@ -1,6 +1,6 @@ [project] name = "Ribasim" -version = "0.5.0" +version = "2024.02.0" description = "Water resources modeling" authors = ["Deltares and contributors "] channels = ["conda-forge"] diff --git a/python/ribasim/ribasim/__init__.py b/python/ribasim/ribasim/__init__.py index e7b2a7de9..a47bff109 100644 --- a/python/ribasim/ribasim/__init__.py +++ b/python/ribasim/ribasim/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.7.0" +__version__ = "2024.02.0" from ribasim import models, utils diff --git a/python/ribasim/ribasim/models.py b/python/ribasim/ribasim/models.py index f5c63246d..d0e8c341b 100644 --- a/python/ribasim/ribasim/models.py +++ b/python/ribasim/ribasim/models.py @@ -25,11 +25,11 @@ class BasinState(BaseModel): class BasinStatic(BaseModel): node_id: int - drainage: float - potential_evaporation: float - infiltration: float - precipitation: float - urban_runoff: float + drainage: float | None = None + potential_evaporation: float | None = None + infiltration: float | None = None + precipitation: float | None = None + urban_runoff: float | None = None remarks: str = Field("", description="a hack for pandera") diff --git a/python/ribasim_api/ribasim_api/__init__.py b/python/ribasim_api/ribasim_api/__init__.py index d3d2ccdda..2418918e8 100644 --- a/python/ribasim_api/ribasim_api/__init__.py +++ b/python/ribasim_api/ribasim_api/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.6.0" +__version__ = "2024.02.0" from ribasim_api.ribasim_api import RibasimApi diff --git a/python/ribasim_testmodels/ribasim_testmodels/backwater.py b/python/ribasim_testmodels/ribasim_testmodels/backwater.py index 42e950ec9..ea90ad597 100644 --- a/python/ribasim_testmodels/ribasim_testmodels/backwater.py +++ b/python/ribasim_testmodels/ribasim_testmodels/backwater.py @@ -101,7 +101,7 @@ def backwater_model(): flow_boundary=flow_boundary, manning_resistance=manning_resistance, starttime="2020-01-01 00:00:00", - endtime="2030-01-01 00:00:00", + endtime="2021-01-01 00:00:00", ) return model diff --git a/python/ribasim_testmodels/ribasim_testmodels/bucket.py b/python/ribasim_testmodels/ribasim_testmodels/bucket.py index f16e06319..3d4fdd6de 100644 --- a/python/ribasim_testmodels/ribasim_testmodels/bucket.py +++ b/python/ribasim_testmodels/ribasim_testmodels/bucket.py @@ -60,11 +60,11 @@ def bucket_model() -> ribasim.Model: static = pd.DataFrame( data={ "node_id": [1], - "drainage": [0.0], - "potential_evaporation": [0.0], - "infiltration": [0.0], - "precipitation": [0.0], - "urban_runoff": [0.0], + "drainage": [np.nan], + "potential_evaporation": [np.nan], + "infiltration": [np.nan], + "precipitation": [np.nan], + "urban_runoff": [np.nan], } ) basin = ribasim.Basin(profile=profile, static=static, state=state) diff --git a/python/ribasim_testmodels/ribasim_testmodels/two_basin.py b/python/ribasim_testmodels/ribasim_testmodels/two_basin.py index 5618ea7b1..afd3e8842 100644 --- a/python/ribasim_testmodels/ribasim_testmodels/two_basin.py +++ b/python/ribasim_testmodels/ribasim_testmodels/two_basin.py @@ -121,6 +121,6 @@ def two_basin_model() -> ribasim.Model: tabulated_rating_curve=rating_curve, terminal=terminal, starttime="2020-01-01 00:00:00", - endtime="2030-01-01 00:00:00", + endtime="2021-01-01 00:00:00", ) return ribasim_model diff --git a/ribasim_qgis/metadata.txt b/ribasim_qgis/metadata.txt index 61134b9ed..2a093277a 100644 --- a/ribasim_qgis/metadata.txt +++ b/ribasim_qgis/metadata.txt @@ -7,7 +7,7 @@ name=Ribasim-QGIS qgisMinimumVersion=3.0 description=QGIS plugin to setup Ribasim models -version=0.7 +version=2024.02.1 author=Deltares and contributors email=ribasim.info@deltares.nl