• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nens / ThreeDiToolbox / #2587

16 Sep 2025 02:45PM UTC coverage: 35.061% (-0.09%) from 35.146%
#2587

push

coveralls-python

web-flow
Merge 874d1f506 into f6f4be1e7

57 of 228 new or added lines in 40 files covered. (25.0%)

5 existing lines in 4 files now uncovered.

4856 of 13850 relevant lines covered (35.06%)

0.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

43.18
/processing/gpkg_conversion_algorithm.py
1
from collections import OrderedDict
1✔
2
from qgis.PyQt.QtCore import QCoreApplication
1✔
3
from qgis.core import (
1✔
4
    QgsProcessingAlgorithm,
5
    QgsProcessingException,
6
    QgsProcessingParameterFile,
7
    QgsProcessingParameterFileDestination,
8
)
9
from threedi_results_analysis.processing.processing_utils import gridadmin2geopackage, load_computational_layers
1✔
10

11

12
class ThreeDiConvertToGpkgAlgorithm(QgsProcessingAlgorithm):
1✔
13
    """Convert gridadmin.h5 to GeoPackage with vector layers and add subset of those layers to the map canvas."""
14

15
    INPUT = "INPUT"
1✔
16
    OUTPUT = "OUTPUT"
1✔
17
    LAYERS_TO_ADD = OrderedDict()
1✔
18

19
    def flags(self):
1✔
NEW
20
        return super().flags() | QgsProcessingAlgorithm.Flag.FlagNoThreading
×
21

22
    def tr(self, string):
1✔
23
        return QCoreApplication.translate("Processing", string)
×
24

25
    def createInstance(self):
1✔
26
        return ThreeDiConvertToGpkgAlgorithm()
×
27

28
    def name(self):
1✔
29
        return "threedi_convert_gridadmin_to_gpkg"
×
30

31
    def displayName(self):
1✔
32
        return self.tr("Computational grid from gridadmin.h5 file")
×
33

34
    def group(self):
1✔
35
        return self.tr("Computational Grid")
×
36

37
    def groupId(self):
1✔
38
        return "computational_grid"
×
39

40
    def shortHelpString(self):
1✔
41
        return self.tr("Create computational grid from gridadmin.h5 file")
×
42

43
    def initAlgorithm(self, config=None):
1✔
44

45
        self.addParameter(
×
46
            QgsProcessingParameterFile(
47
                self.INPUT, self.tr("Gridadmin.h5 file"), extension="h5",
48
            )
49
        )
50

51
        self.addParameter(
×
52
            QgsProcessingParameterFileDestination(
53
                self.OUTPUT, self.tr("Output GeoPackage file"), fileFilter="*.gpkg",
54
            )
55
        )
56

57
    def processAlgorithm(self, parameters, context, feedback):
1✔
58
        input_gridadmin = self.parameterAsString(parameters, self.INPUT, context)
×
59
        if input_gridadmin is None:
×
60
            raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))
×
61

62
        gpkg_path = self.parameterAsFileOutput(parameters, self.OUTPUT, context)
×
63
        if gpkg_path is None:
×
64
            raise QgsProcessingException(self.invalidSourceError(parameters, self.OUTPUT))
×
65
        if gpkg_path.endswith(".file"):
×
66
            gpkg_path = gpkg_path.rsplit(".", 1)[0] + ".gpkg"
×
67

68
        gpkg_layers = gridadmin2geopackage(input_gridadmin, gpkg_path, context, feedback)
×
69
        self.LAYERS_TO_ADD.update(gpkg_layers)
×
70

71
        return {}
×
72

73
    def postProcessAlgorithm(self, context, feedback):
1✔
74
        project = context.project()
×
75
        load_computational_layers(self.LAYERS_TO_ADD, project)
×
76
        self.LAYERS_TO_ADD.clear()
×
77
        return {}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc