Skip to content

Commit

Permalink
Merge branch 'master' into leendert-test-threedi-schema-224
Browse files Browse the repository at this point in the history
  • Loading branch information
leendertvanwolfswinkel authored Dec 23, 2024
2 parents f4873b3 + 4651a72 commit ae44c40
Show file tree
Hide file tree
Showing 62 changed files with 6,808 additions and 1,292 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:

- name: test
run: |
docker compose run -e QT_QPA_PLATFORM=offscreen qgis-desktop make check
docker compose run -e QT_QPA_PLATFORM=offscreen qgis-desktop make test
docker compose run -e QT_QPA_PLATFORM=offscreen qgis-desktop make flake8
docker compose run qgis-desktop make docstrings
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ tests/data/small_2019_01_2entries_4tiff.sqlite
.pytest_cache/v/cache/nodeids
.h5py_marker
constraints.txt
requirements.in
36 changes: 34 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
3Di Results Analysis changelog
========================

3.9.4 (unreleased)
------------------
3.13 (unreleased)
-----------------

- Nothing changed yet.


3.12 (2024-12-10)
-----------------

- Compatibility with Python 3.12 (#1061)
- Bumped h5py to 3.10.0 and scipy to 1.13.0 for python 3.12 compatibility (#1061)
- Added Processing Algorithm "Extract structure control actions" (#926)
- Fixed attributeError when loading a QGIS project (#1063)
- Fix in Rasters to NetCDF algorithm to properly convert the units Enum to string (#1067)

3.11 (2024-11-12)
-----------------

- Allow LinestringZ input by using WKB instead of WKT as conversion format (#1040)
- Make "Use selected features" behaviour explicit (#1057)
- Added animation settings (#1046)
- Bump hydxlib to 1.5.3


3.10.0 (2024-09-12)
-------------------

- Add pump support to Result Aggregation tool
- Add preset "Total pumped volume" to Result Aggregation tool
- Add preset "Pumps: % of time at max capacity" to Result Aggregation tool
- Cross-sectional discharge algorithm: allow cross-section lines to have different crs than 3Di results, automatically reproject
- Watershed tool: 2D flowlines intersecting obstacles are no longer shown as 1D flowlines (#1034)
- Model selection dialog: fixed order bug when sorting.
- Bump threedi-mi-utils to 0.1.4
- Fixed attribute error when selecting substance in a model that contains pumps (#1044)
- Added Flow Summary Tool (#725)


3.9.3 (2024-08-14)
------------------

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from qgis/qgis:final-3_28_4
FROM qgis/qgis:final-3_28_4
RUN apt-get update && apt-get install -y python3-pyqt5.qtwebsockets wget python3-scipy python3-h5py zip && apt-get clean
# RUN mkdir -p /tests_directory
COPY requirements-dev.txt /root
Expand All @@ -9,6 +9,6 @@ RUN qgis_setup.sh

# Copied the original PYTHONPATH and added the profile's python dir to
# imitate qgis' behaviour.
ENV PYTHONPATH /usr/share/qgis/python/:/usr/share/qgis/python/plugins:/usr/lib/python3/dist-packages/qgis:/usr/share/qgis/python/qgis:/root/.local/share/QGIS/QGIS3/profiles/default/python
ENV PYTHONPATH=/usr/share/qgis/python/:/usr/share/qgis/python/plugins:/usr/lib/python3/dist-packages/qgis:/usr/share/qgis/python/qgis:/root/.local/share/QGIS/QGIS3/profiles/default/python
# Note: we'll mount the current dir into this WORKDIR
WORKDIR /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/threedi_results_analysis
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ zip: compile
find /tmp/$(PLUGINNAME) -iname "*.pyc" -delete
cd /tmp; zip -9r $(CURDIR)/$(PLUGINNAME).zip $(PLUGINNAME)

check: constraints.txt
# Use pip-compile to check whether all dependencies version constraints are met.
cp constraints.txt requirements.in
pip-compile --dry-run
rm requirements.in

package: compile
# Create a zip package of the plugin named $(PLUGINNAME).zip.
# This requires use of git (your plugin development directory must be a
Expand Down
11 changes: 11 additions & 0 deletions datasource/result_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,14 @@

# TODO: QH is also defined above.
LAYER_OBJECT_TYPE_MAPPING = dict([(a[0], a[1]) for a in layer_information])

"""
Maps action type to affected structure.
This can be used when no control action is present for an object.
"""
ACTION_TYPE_ATTRIBUTE_MAP = {
"set_crest_level": {"variable": "dpumax", "unit": "m MSL", "applicable_structures": ["v2_weir", "v2_orifice"]},
"set_pump_capacity": {"variable": "capacity", "unit": "", "applicable_structures": None},
"set_discharge_coefficients": {"variable": "discharge_coefficient_positive", "unit": "", "applicable_structures": None},
"set_gate_level": {"variable": None, "unit": "m MSL", "applicable_structures": None}
}
14 changes: 2 additions & 12 deletions datasource/test_datasources.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from threedigrid.admin import gridresultadmin
from threedigrid.admin.constants import NO_DATA_VALUE
from threedi_results_analysis.datasource.threedi_results import find_aggregation_netcdf
from threedi_results_analysis.datasource.threedi_results import normalized_object_type
from threedi_results_analysis.datasource.threedi_results import ThreediResult
from threedi_results_analysis.tests.utilities import TemporaryDirectory
from threedigrid.admin import gridresultadmin
from threedigrid.admin.constants import NO_DATA_VALUE

import mock
import numpy as np
Expand Down Expand Up @@ -110,16 +110,6 @@ def test_get_timeseries_filter_node(threedi_result):
np.testing.assert_equal(time_series[:, 1], data.return_value[:, 0])


def test_get_timeseries_filter_content_pk(threedi_result):
with mock.patch(
"threedigrid.orm.base.models.Model.get_filtered_field_value"
) as data:
data.return_value = np.ones((len(threedi_result.timestamps), 1))
time_series = threedi_result.get_timeseries("s1", content_pk=5)
np.testing.assert_equal(time_series[:, 0], threedi_result.get_timestamps())
np.testing.assert_equal(time_series[:, 1], data.return_value[:, 0])


def test_get_timeseries_filter_fill_value(threedi_result):
with mock.patch(
"threedigrid.orm.base.models.Model.get_filtered_field_value"
Expand Down
Loading

0 comments on commit ae44c40

Please sign in to comment.