Skip to content

Fix fault dip display: retrieve from shapefile data instead of normal vector#83

Merged
lachlangrose merged 4 commits intomainfrom
copilot/fix-fault-dip-display
Feb 19, 2026
Merged

Fix fault dip display: retrieve from shapefile data instead of normal vector#83
lachlangrose merged 4 commits intomainfrom
copilot/fix-fault-dip-display

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

Fault dip values from shapefiles were always displayed as 90° in the Geological Features panel instead of showing the actual shapefile values.

Changes

  • Modified FaultFeatureDetailsPanel.__init__() to retrieve dip and pitch from model_manager.faults[fault.name]['data'] (where shapefile values are stored) before falling back to normal vector calculation
  • Added unit tests covering data retrieval paths and fallback behavior

Technical Details

Previous implementation:

dip = normal_vector_to_strike_and_dip(fault.fault_normal_vector)[0, 1]
pitch = 0  # hardcoded

New implementation retrieves from stored data:

# Try stored fault data first
dip = None
if model_manager is not None and fault.name in model_manager.faults:
    fault_data = model_manager.faults[fault.name].get('data')
    if fault_data is not None and 'dip' in fault_data.columns and not fault_data.empty:
        dip = fault_data['dip'].mean()

# Fallback to calculation if not available
if dip is None:
    dip = normal_vector_to_strike_and_dip(fault.fault_normal_vector)[0, 1]

The fault normal vector may not reflect the original shapefile dip value, causing the mismatch. This change preserves the original data from update_fault_points() where shapefile fields are mapped to fault data columns.

Original prompt

This section details on the original issue you should resolve

<issue_title>Fault dip not displayed properly</issue_title>
<issue_description>### What is the bug or the crash?

If a fault has a dip measurement in the shapefile, this value is not copied over to the Geological Features panel Fault Dip (they all display as 90). I think the correct value is used in the model calc, so the Fault Dip text item is probably not (yet?) used.

Steps to reproduce the issue

  1. initialise model with fault layer
  2. Click on a fault in Geological Feature area,
  3. Scroll to Fault Dip text edit box

Versions

QGIS version3.44.4-Solothurn
QGIS code revision108203c541e
 
Libraries
Qt version5.15.13
Python version3.12.11
GDAL version3.11.4 — Eganville
PROJ version9.7.0
EPSG Registry database versionv12.022 (2025-08-30)
GEOS version3.13.1-CAPI-1.19.2
SQLite version3.50.4
PDAL version2.9.0
PostgreSQL client version17.3
SpatiaLite version5.1.0
QWT version6.3.0
QScintilla2 version2.14.1
OS versionWindows 10 Version 2009
 
Active Python plugins
a00_qpip1.4.2
geochem_plots0.0.1
geol_qmaps3.1.5
GeoSubSampler0.1
loopstructuralv0.1.12
mapswipetool_plugin1.4
plugin_reloader0.18
processing_saga_nextgen1.1.0
qgis-stereonet0.3.01
sgtool0.3.01
SRTM-Downloader3.3.1
tomofast_x_q0.2.13
db_manager0.1.20
grassprovider2.12.99
MetaSearch0.3.6
processing2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the official roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 19, 2026 01:58
Co-authored-by: lachlangrose <7371904+lachlangrose@users.noreply.github.com>
Co-authored-by: lachlangrose <7371904+lachlangrose@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix fault dip not displayed properly in Geological Features panel Fix fault dip display: retrieve from shapefile data instead of normal vector Feb 19, 2026
Copilot AI requested a review from lachlangrose February 19, 2026 02:01
@lachlangrose lachlangrose marked this pull request as ready for review February 19, 2026 03:03
@lachlangrose lachlangrose merged commit 9c468f5 into main Feb 19, 2026
2 of 4 checks passed
@lachlangrose lachlangrose deleted the copilot/fix-fault-dip-display branch February 19, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fault dip not displayed properly

2 participants

Comments