2.23.6.3. pycsamt.format.structure#
PCGS - pyCSAMT Common Geological Structure.
PCGS is a small, portable document for field structural evidence – planar measurements (strike/dip), linear measurements (trend/plunge), and fault traces – collected along one or several survey lines, so it can travel between projects and applications on its own and be recognised and loaded straight into Map View’s Geology section.
Like pycsamt.format.geology (PCGL) and
pycsamt.format.borehole (PCBH), PCGS is a thin document envelope
(id, timestamps, provenance, versioning) around an existing pycsamt
class – here, pycsamt.geology.structural.StructuralModel –
rather than a parallel data model.
Canonical encoding is UTF-8 JSON, canonical extension .pcgs.json. A
model can also be assembled from up to three CSV files (one each for
planar measurements, linear measurements, and fault traces), the same
tables pycsamt.geology.structural.StructuralModel.from_csv()
already accepts – see that method for the column layout, including the
optional line column for a multi-line survey.
Example
>>> from pycsamt.format.structure import StructModel
>>> from pycsamt.geology.structural import FaultTrace, StructuralModel
>>> model = StructuralModel(
... faults=[FaultTrace(x=500.0, dip_deg=70.0, downthrown_side="right")],
... )
>>> doc = StructModel.from_structural_model(model, title="Site A structure")
>>> doc.issues()
[]
Functions
|
Read a |
|
Module-level convenience alias for |
|
Build and validate a |
|
Return a canonical JSON-safe dict for doc. |
|
Write doc as canonical |
Classes
|
A versioned, portable structural-geology document. |
Exceptions
Raised when a PCGS document fails validation. |
- class pycsamt.format.structure.StructModel(document_id, created_at, created_by, model, pcgs_version='0.1.0', title='', description='', metadata=<factory>)[source]
Bases:
PyCSAMTObject,MetadataMixinA versioned, portable structural-geology document.
- Parameters:
- document_id: str
- created_at: str
- created_by: str
- model: StructuralModel
- pcgs_version: str = '0.1.0'
- title: str = ''
- description: str = ''
- property planar[source]
- property linear[source]
- property faults[source]
- classmethod from_structural_model(model=None, *, document_id=None, created_by='pycsamt', title='', description='')[source]
- Parameters:
model (StructuralModel | None)
document_id (str | None)
created_by (str)
title (str)
description (str)
- Return type:
- classmethod from_csv(*, planar_path=None, linear_path=None, faults_path=None, delimiter=',', document_id=None, created_by='pycsamt CSV importer', title='')[source]
Load a document from up to three CSV files – see
pycsamt.geology.structural.StructuralModel.from_csv().
- validate()[source]
Validate object state.
Subclasses can override this hook. The base implementation intentionally accepts all states.
- Return type:
None
- exception pycsamt.format.structure.StructModelValidationError[source]
Bases:
ValueErrorRaised when a PCGS document fails validation.
- pycsamt.format.structure.read_structure(path)[source]
Read a
.pcgs.jsonfile.- Parameters:
- Return type:
- pycsamt.format.structure.write_structure(doc, path)[source]
Write doc as canonical
.pcgs.json.- Parameters:
doc (StructModel)
- Return type:
- pycsamt.format.structure.structure_from_csv(**kwargs)[source]
Module-level convenience alias for
StructModel.from_csv().- Parameters:
kwargs (Any)
- Return type:
- pycsamt.format.structure.structure_to_dict(doc)[source]
Return a canonical JSON-safe dict for doc.
- Parameters:
doc (StructModel)
- Return type:
- pycsamt.format.structure.structure_from_dict(payload)[source]
Build and validate a
StructModelfrom a dict.- Parameters:
- Return type: