Skip to content

Commit

Permalink
rename to threedi_results_analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
benvanbasten-ns committed Feb 10, 2023
1 parent 230e3a4 commit b383753
Show file tree
Hide file tree
Showing 79 changed files with 336 additions and 314 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThreeDiToolBox changelog
3Di Results Analysis changelog
========================


Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ RUN qgis_setup.sh
# 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
# Note: we'll mount the current dir into this WORKDIR
WORKDIR /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ThreeDiToolbox
WORKDIR /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/threedi_results_analysis
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#/***************************************************************************
# ThreeDiToolbox
#
# Toolbox for working with 3Di hydraulic models
# -------------------
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ Take a look at the `Wiki`_ for more information.
Installation on windows
-----------------------

You need to install Qgis 3.16.5+ (the "long term release"). Either the
You need to install Qgis 3.22.16+ (the "long term release"). Either the
stand-alone installer or the osgeo4w install is fine. For osgeo4w, pick the
"qgis LTR full" version.

Add the Lizard QGIS repository: via the QGIS menu bar go to "Plugins > Manage
And Install Plugins... > Settings". Add
``https://plugins.lizard.net/plugins.xml`` and reload. Install the plugin by
selecting ThreeDiToolbox.
selecting 3Di Results Analysis.

The extra dependencies that we need are bundled with the plugins and
automatically installed into the ``python\`` directory of your qgis profile.
Expand Down Expand Up @@ -125,7 +125,7 @@ commands and follow their steps::
$ fullrelease

This creates a new release and tag on github. Additionally, a zip file
``ThreeDiToolbox.<version>.zip`` is created. Github actions is configured to also
``threedi_results_analysis.<version>.zip`` is created. Github actions is configured to also
create this zip and upload it to https://plugins.lizard.net/ when a new tag is
created, using the ``upload-artifact.sh`` script.

Expand Down
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def enable_high_dpi_scaling():


def classFactory(iface):
"""Return ThreeDiToolbox class from file ThreeDiToolbox.
"""Return plugin class.
In addition, we set up python logging (see
:py:mod:`ThreeDiToolbox.utils.qlogging`).
:py:mod:`threedi_results_analysis.utils.qlogging`).
args:
iface (QgsInterface): A QGIS interface instance.
Expand Down
6 changes: 3 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""

from ThreeDiToolbox import PLUGIN_DIR
from threedi_results_analysis import PLUGIN_DIR

import os
import pytest
Expand Down Expand Up @@ -39,7 +39,7 @@ def threedi_result():
"""
# Late import, otherwise we get circular import errors.
from ThreeDiToolbox.datasource.threedi_results import ThreediResult
from threedi_results_analysis.datasource.threedi_results import ThreediResult

return ThreediResult(file_path=results_3di_path)

Expand All @@ -52,7 +52,7 @@ def ts_datasources(tmp_path):
"""
# Late import, otherwise we get circular import errors.
from ThreeDiToolbox.tool_result_selection.models import TimeseriesDatasourceModel
from threedi_results_analysis.tool_result_selection.models import TimeseriesDatasourceModel

shutil.copytree(bergermeer_dir, tmp_path / "v2_bergermeer")
copied_results_3di_path = tmp_path / "v2_bergermeer" / "results_3di.nc"
Expand Down
23 changes: 23 additions & 0 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by dependencies.py
SQLAlchemy<1.4
GeoAlchemy2==0.10.2
lizard-connector==0.7.3
pyqtgraph>=0.11.1,<0.12
threedigrid>=2.0.0
threedi-schema==0.214.*
threedi-modelchecker==1.0.*
threedidepth==0.4
click>=8.0
alembic==1.8.*
importlib-resources
zipp
Mako
netCDF4
cftime>=1.5.0
packaging
colorama
networkx
condenser>=0.1.1
Shapely>=2.0.0
threedigrid_builder>=1.8.0
hydxlib==1.4.*
20 changes: 10 additions & 10 deletions datasource/test_datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from qgis.PyQt.QtCore import QVariant
from threedigrid.admin import gridresultadmin
from threedigrid.admin.constants import NO_DATA_VALUE
from ThreeDiToolbox.datasource import base
from ThreeDiToolbox.datasource.spatialite import Spatialite
from ThreeDiToolbox.datasource.threedi_results import find_aggregation_netcdf
from ThreeDiToolbox.datasource.threedi_results import find_h5_file
from ThreeDiToolbox.datasource.threedi_results import normalized_object_type
from ThreeDiToolbox.datasource.threedi_results import ThreediResult
from ThreeDiToolbox.tests.utilities import ensure_qgis_app_is_initialized
from ThreeDiToolbox.tests.utilities import TemporaryDirectory
from threedi_results_analysis.datasource import base
from threedi_results_analysis.datasource.spatialite import Spatialite
from threedi_results_analysis.datasource.threedi_results import find_aggregation_netcdf
from threedi_results_analysis.datasource.threedi_results import find_h5_file
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 ensure_qgis_app_is_initialized
from threedi_results_analysis.tests.utilities import TemporaryDirectory

import h5py
import mock
Expand Down Expand Up @@ -101,10 +101,10 @@ def test_constructor(self):
ThreediResult()

@mock.patch(
"ThreeDiToolbox.datasource.threedi_results.ThreediResult.available_subgrid_map_vars",
"threedi_results_analysis.datasource.threedi_results.ThreediResult.available_subgrid_map_vars",
["s1"],
)
@mock.patch("ThreeDiToolbox.datasource.threedi_results.ThreediResult.result_admin")
@mock.patch("threedi_results_analysis.datasource.threedi_results.ThreediResult.result_admin")
def test_get_timeseries(self, result_admin_mock):
threedi_result = ThreediResult()
threedi_result.get_timeseries("s1", 3)
Expand Down
6 changes: 3 additions & 3 deletions datasource/threedi_results.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from functools import cached_property
from threedigrid.admin.constants import NO_DATA_VALUE
from ThreeDiToolbox.datasource.base import BaseDataSource
from ThreeDiToolbox.datasource.result_constants import LAYER_OBJECT_TYPE_MAPPING
from ThreeDiToolbox.datasource.result_constants import SUBGRID_MAP_VARIABLES
from threedi_results_analysis.datasource.base import BaseDataSource
from threedi_results_analysis.datasource.result_constants import LAYER_OBJECT_TYPE_MAPPING
from threedi_results_analysis.datasource.result_constants import SUBGRID_MAP_VARIABLES
from threedigrid.admin.gridadmin import GridH5Admin
from threedigrid.admin.gridresultadmin import GridH5AggregateResultAdmin
from threedigrid.admin.gridresultadmin import GridH5ResultAdmin
Expand Down
6 changes: 3 additions & 3 deletions dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def ensure_everything_installed():
if restart_required or not restart_marker.exists():
if _is_windows():
# We always want to restart when deps are missing
from ThreeDiToolbox.utils.user_messages import pop_up_info
from threedi_results_analysis.utils.user_messages import pop_up_info

pop_up_info(
"Please restart QGIS to complete the installation process of "
Expand Down Expand Up @@ -191,9 +191,9 @@ def _ensure_h5py_installed():
problems.
Situations B occur when a user upgrades/downgrades their Qgis version when
the ThreediToolbox is already installed with a specific version of h5py.
the plugin is already installed with a specific version of h5py.
In these cases we also need to upgrade/downgrade the h5py version installed with
ThreediToolbox.
the plugin.
In situations B Qgis will crash when trying to import h5py.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import sphinx_rtd_theme
import ThreeDiToolbox.conftest # Ensure the py import fix has been applied.
import threedi_results_analysis.conftest # Ensure the py import fix has been applied.


# -- General configuration ------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions doc/source/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ Some hints:
#: Handy constant for building relative paths.
PLUGIN_DIR = Path(__file__).parent

- Refer to it (:py:data:`ThreeDiToolbox.PLUGIN_DIR`) like this::
- Refer to it (:py:data:`threedi_results_analysis.PLUGIN_DIR`) like this::

:py:data:`ThreeDiToolbox.PLUGIN_DIR`
:py:data:`threedi_results_analysis.PLUGIN_DIR`

- From the regular documentation (so: mostly your ``README.rst`` files), try
to refer to the implementation details to allow going back and forth between
them. See `the sphinx documentation
<https://www.sphinx-doc.org/en/master/domains.html#cross-referencing-python-objects>`_.
For example, :py:class:`ThreeDiToolbox.utils.qlogging.QgisLogHandler` is
For example, :py:class:`threedi_results_analysis.utils.qlogging.QgisLogHandler` is
generated with this::

:py:class:`ThreeDiToolbox.utils.qlogging.QgisLogHandler`
:py:class:`threedi_results_analysis.utils.qlogging.QgisLogHandler`

- Point at documentation files (for example :doc:`documentation`) like this::

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:

volumes:
- /tmp/.X11-unix:/tmp/.X11-unix # Allow GUI application to run in docker
- .:/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ThreeDiToolbox
- .:/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/threedi_results_analysis
- qgis-settings:/root/.local/share/QGIS/
environment:
- DISPLAY=unix${DISPLAY}
Expand Down
12 changes: 6 additions & 6 deletions external-dependencies/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Qgis comes bundled with several python libraries, but we need a few more. The
extra dependencies (as wheels and eggs) are retrieved or stored into the
``external-dependencies/`` directory and bundled with the plugin.

The main ``ThreeDiToolbox/__init__.py`` (see :py:mod:`ThreeDiToolbox`) calls
The main ``threedi_results_analysis/__init__.py`` (see :py:mod:`ThreeDiToolbox`) calls
``dependencies.py`` and installs the dependencies the subfolder ``deps`` of
the plugin folder. The dependency folder is also added (prepended) to the path.

Expand Down Expand Up @@ -87,7 +87,7 @@ two exceptions:
Our dependency handling
-----------------------

``dependencies.py`` (see :py:mod:`ThreeDiToolbox.dependencies`) can be called
``dependencies.py`` (see :py:mod:`threedi_results_analysis.dependencies`) can be called
directly, which generates a ``constraints.txt`` file for use with pip. The
``Makefile`` handles this for us: it updates the constraints file when the
python file changes.
Expand All @@ -104,8 +104,8 @@ directory with our dependencies so that we can bundle it with the plugin:

- Lastly, it copies the custom built h5py package from the folder 'h5py'.

The :py:func:`ThreeDiToolbox.dependencies.ensure_everything_installed`
function is called by our main ``ThreeDiToolbox/__init__.py``:
The :py:func:`threedi_results_analysis.dependencies.ensure_everything_installed`
function is called by our main ``threedi_results_analysis/__init__.py``:

- It first checks if the correct versions of our dependencies are
installed. It doesn't matter where they're installed: system packages,
Expand All @@ -115,8 +115,8 @@ function is called by our main ``ThreeDiToolbox/__init__.py``:
from the ``external-dependencies/`` directory into the plugin's
``deps/`` directory.

As a last step, ``ThreeDiToolbox/__init__.py`` calls
:py:func:`ThreeDiToolbox.dependencies.check_importability` to make doubly sure
As a last step, ``threedi_results_analysis/__init__.py`` calls
:py:func:`threedi_results_analysis.dependencies.check_importability` to make doubly sure
all dependencies are present. Not only the ones from
``external-dependencies/``, but also ``gdal`` and ``numpy`` to make sure
they're properly included with qgis.
14 changes: 7 additions & 7 deletions misc_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from qgis.PyQt.QtCore import QObject
from qgis.PyQt.QtCore import pyqtSignal
from qgis.core import QgsProject
from ThreeDiToolbox import PLUGIN_DIR
from ThreeDiToolbox.utils.qlogging import FileHandler
from ThreeDiToolbox.utils.layer_from_netCDF import FLOWLINES_LAYER_NAME
from ThreeDiToolbox.utils.layer_from_netCDF import NODES_LAYER_NAME
from ThreeDiToolbox.utils.layer_from_netCDF import PUMPLINES_LAYER_NAME
from ThreeDiToolbox.utils.user_messages import pop_up_info
from ThreeDiToolbox.utils.user_messages import pop_up_question
from threedi_results_analysis import PLUGIN_DIR
from threedi_results_analysis.utils.qlogging import FileHandler
from threedi_results_analysis.utils.layer_from_netCDF import FLOWLINES_LAYER_NAME
from threedi_results_analysis.utils.layer_from_netCDF import NODES_LAYER_NAME
from threedi_results_analysis.utils.layer_from_netCDF import PUMPLINES_LAYER_NAME
from threedi_results_analysis.utils.user_messages import pop_up_info
from threedi_results_analysis.utils.user_messages import pop_up_question

import logging
import os
Expand Down
6 changes: 3 additions & 3 deletions models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from qgis.PyQt.QtCore import QModelIndex
from qgis.PyQt.QtCore import QSize
from qgis.PyQt.QtCore import Qt
from ThreeDiToolbox.models.base_fields import CHECKBOX_FIELD
from ThreeDiToolbox.models.base_fields import COLOR_FIELD
from ThreeDiToolbox.models.base_fields import VALUE_FIELD
from threedi_results_analysis.models.base_fields import CHECKBOX_FIELD
from threedi_results_analysis.models.base_fields import COLOR_FIELD
from threedi_results_analysis.models.base_fields import VALUE_FIELD

import inspect
import logging
Expand Down
2 changes: 1 addition & 1 deletion models/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtGui import QColor
from ThreeDiToolbox.models import base_fields
from threedi_results_analysis.models import base_fields

import mock

Expand Down
12 changes: 6 additions & 6 deletions processing/deps/guess_indicator/guess_indicators_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from sqlalchemy import select
from sqlalchemy import update
from ThreeDiToolbox.sql_models.constants import Constants
from ThreeDiToolbox.sql_models.model_schematisation import BoundaryCondition1D
from ThreeDiToolbox.sql_models.model_schematisation import ConnectionNode
from ThreeDiToolbox.sql_models.model_schematisation import Manhole
from ThreeDiToolbox.sql_models.model_schematisation import Pipe
from ThreeDiToolbox.sql_models.model_schematisation import Pumpstation
from threedi_results_analysis.sql_models.constants import Constants
from threedi_results_analysis.sql_models.model_schematisation import BoundaryCondition1D
from threedi_results_analysis.sql_models.model_schematisation import ConnectionNode
from threedi_results_analysis.sql_models.model_schematisation import Manhole
from threedi_results_analysis.sql_models.model_schematisation import Pipe
from threedi_results_analysis.sql_models.model_schematisation import Pumpstation

import logging

Expand Down
18 changes: 9 additions & 9 deletions processing/deps/guess_indicator/test_guess_indicators.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from pathlib import Path
from sqlalchemy import update
from ThreeDiToolbox.sql_models.constants import Constants
from ThreeDiToolbox.sql_models.model_schematisation import BoundaryCondition1D
from ThreeDiToolbox.sql_models.model_schematisation import ConnectionNode
from ThreeDiToolbox.sql_models.model_schematisation import Manhole
from ThreeDiToolbox.sql_models.model_schematisation import Pipe
from ThreeDiToolbox.sql_models.model_schematisation import Pumpstation
from ThreeDiToolbox.tests.test_init import TEST_DATA_DIR
from ThreeDiToolbox.processing.deps.guess_indicator import guess_indicators_utils
from ThreeDiToolbox.utils.threedi_database import ThreediDatabase
from threedi_results_analysis.sql_models.constants import Constants
from threedi_results_analysis.sql_models.model_schematisation import BoundaryCondition1D
from threedi_results_analysis.sql_models.model_schematisation import ConnectionNode
from threedi_results_analysis.sql_models.model_schematisation import Manhole
from threedi_results_analysis.sql_models.model_schematisation import Pipe
from threedi_results_analysis.sql_models.model_schematisation import Pumpstation
from threedi_results_analysis.tests.test_init import TEST_DATA_DIR
from threedi_results_analysis.processing.deps.guess_indicator import guess_indicators_utils
from threedi_results_analysis.utils.threedi_database import ThreediDatabase

import pytest
import shutil
Expand Down
26 changes: 13 additions & 13 deletions processing/deps/sufhyd/import_sufhyd_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@

from qgis.core import Qgis

from ThreeDiToolbox.sql_models.constants import Constants
from ThreeDiToolbox.sql_models.model_schematisation import BoundaryCondition1D
from ThreeDiToolbox.sql_models.model_schematisation import ConnectionNode
from ThreeDiToolbox.sql_models.model_schematisation import CrossSectionDefinition
from ThreeDiToolbox.sql_models.model_schematisation import ImperviousSurface
from ThreeDiToolbox.sql_models.model_schematisation import ImperviousSurfaceMap
from ThreeDiToolbox.sql_models.model_schematisation import Manhole
from ThreeDiToolbox.sql_models.model_schematisation import Orifice
from ThreeDiToolbox.sql_models.model_schematisation import Pipe
from ThreeDiToolbox.sql_models.model_schematisation import Pumpstation
from ThreeDiToolbox.sql_models.model_schematisation import Weir
from ThreeDiToolbox.processing.deps.sufhyd.sufhyd_importer import SufhydReader
from ThreeDiToolbox.utils.user_messages import messagebar_message
from threedi_results_analysis.sql_models.constants import Constants
from threedi_results_analysis.sql_models.model_schematisation import BoundaryCondition1D
from threedi_results_analysis.sql_models.model_schematisation import ConnectionNode
from threedi_results_analysis.sql_models.model_schematisation import CrossSectionDefinition
from threedi_results_analysis.sql_models.model_schematisation import ImperviousSurface
from threedi_results_analysis.sql_models.model_schematisation import ImperviousSurfaceMap
from threedi_results_analysis.sql_models.model_schematisation import Manhole
from threedi_results_analysis.sql_models.model_schematisation import Orifice
from threedi_results_analysis.sql_models.model_schematisation import Pipe
from threedi_results_analysis.sql_models.model_schematisation import Pumpstation
from threedi_results_analysis.sql_models.model_schematisation import Weir
from threedi_results_analysis.processing.deps.sufhyd.sufhyd_importer import SufhydReader
from threedi_results_analysis.utils.user_messages import messagebar_message
from threedi_schema import errors

logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions processing/deps/sufhyd/read_sufhyd_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ThreeDiToolbox.processing.deps.sufhyd.import_sufhyd_main import Importer
from ThreeDiToolbox.processing.deps.sufhyd.sufhyd_importer import SufhydReader
from threedi_results_analysis.processing.deps.sufhyd.import_sufhyd_main import Importer
from threedi_results_analysis.processing.deps.sufhyd.sufhyd_importer import SufhydReader

import unittest

Expand Down
4 changes: 2 additions & 2 deletions processing/deps/sufhyd/sufhyd_importer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# (c) Nelen & Schuurmans, see LICENSE.rst.
from ThreeDiToolbox.sql_models.constants import Constants
from ThreeDiToolbox.processing.deps.sufhyd.turtleurbanclasses import (
from threedi_results_analysis.sql_models.constants import Constants
from threedi_results_analysis.processing.deps.sufhyd.turtleurbanclasses import (
HydroObjectFactory,
)

Expand Down
Loading

0 comments on commit b383753

Please sign in to comment.