Skip to content

Commit e6fa63c

Browse files
committed
fix test_basal_contacts
1 parent ec389b3 commit e6fa63c

2 files changed

Lines changed: 3 additions & 38 deletions

File tree

72 KB
Binary file not shown.

tests/qgis/test_basal_contacts.py

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ def setUp(self):
2121

2222
self.geology_file = self.input_dir / "geol_clip_no_gaps.shp"
2323
self.faults_file = self.input_dir / "faults_clip.shp"
24+
self.strati_file = self.input_dir / "stratigraphic_column.gpkg"
2425

2526
self.assertTrue(self.geology_file.exists(), f"geology not found: {self.geology_file}")
26-
27+
self.assertTrue(self.strati_file.exists(), f"strati not found: {self.strati_file}")
2728
if not self.faults_file.exists():
2829
QgsMessageLog.logMessage(f"faults not found: {self.faults_file}, will run test without faults", "TestBasalContacts", Qgis.Warning)
2930

@@ -43,43 +44,7 @@ def test_basal_contacts_extraction(self):
4344

4445
QgsMessageLog.logMessage(f"geology layer: {geology_layer.featureCount()} features", "TestBasalContacts", Qgis.Critical)
4546

46-
strati_column = [
47-
"Turee Creek Group",
48-
"Boolgeeda Iron Formation",
49-
"Woongarra Rhyolite",
50-
"Weeli Wolli Formation",
51-
"Brockman Iron Formation",
52-
"Mount McRae Shale and Mount Sylvia Formation",
53-
"Wittenoom Formation",
54-
"Marra Mamba Iron Formation",
55-
"Jeerinah Formation",
56-
"Bunjinah Formation",
57-
"Pyradie Formation",
58-
"Fortescue Group",
59-
"Hardey Formation",
60-
"Boongal Formation",
61-
"Mount Roe Basalt",
62-
"Rocklea Inlier greenstones",
63-
"Rocklea Inlier metagranitic unit"
64-
]
65-
strati_table = QgsVectorLayer(faults_layer.crs().authid(), "strati_column", "memory")
66-
# define the single field
67-
provider = strati_table.dataProvider()
68-
vtype=QVariant.String
69-
provider.addAttributes([QgsField("unit_name", vtype)])
70-
strati_table.updateFields()
71-
72-
# add features (one row per value)
73-
feats = []
74-
fields = strati_table.fields()
75-
for val in strati_column:
76-
f = QgsFeature(fields)
77-
f.setAttributes([val])
78-
feats.append(f)
79-
80-
if feats:
81-
provider.addFeatures(feats)
82-
strati_table.updateExtents()
47+
strati_table = QgsVectorLayer(str(self.strati_file), "strati", "ogr")
8348
algorithm = BasalContactsAlgorithm()
8449
algorithm.initAlgorithm()
8550

0 commit comments

Comments
 (0)