Skip to content

from_processor crashes: set_stratigraphic_column raises DeprecationWarning unconditionally #296

Description

@manduinca

Version: master (1.7.1), Python 3.12

GeologicalModel.from_processor ends by assigning the processor's column to the model:

# LoopStructural/modelling/core/geological_model.py:495
model.stratigraphic_column = processor.stratigraphic_column

The setter routes dicts to set_stratigraphic_column, which raises unconditionally:

# LoopStructural/modelling/core/geological_model.py:837
raise DeprecationWarning(
    "set_stratigraphic_column is deprecated, use model.stratigraphic_column.add_units instead"
)

So every processor path (ProcessInputData, Map2LoopProcessor, LoopProjectfileProcessor) crashes, including the bundled example examples/4_advanced/plot_1_model_from_geological_map.py. The dict-to-column conversion code after the raise is unreachable, and the column is cleared before raising.

Reproducer

from LoopStructural import GeologicalModel
from LoopStructural.datasets import load_geological_map_data
from LoopStructural.modelling import ProcessInputData

(contacts, orientations, thickness, order_df, bbox, *_rest) = load_geological_map_data()

processor = ProcessInputData(
    contacts=contacts,
    contact_orientations=orientations.rename({"formation": "name"}, axis=1),
    thicknesses=dict(zip(thickness["name"], thickness["thickness"])),
    stratigraphic_order=[("supergroup_0", list(order_df["unit name"]))],
    origin=bbox.loc["origin"].to_numpy(),
    maximum=bbox.loc["maximum"].to_numpy(),
)
model = GeologicalModel.from_processor(processor)
DeprecationWarning: set_stratigraphic_column is deprecated, use model.stratigraphic_column.add_units instead

I have a small fix ready: turn the raise into warnings.warn so the conversion code below it runs again, plus a regression test. PR incoming. Happy to rework it if you would rather port from_processor to the new add_units API directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions