Fault Polygons

Python script
 1"""Export fault lines polygons.
 2
 3This example contains two cases of exporting: directly from the RMS project or from
 4already exported files. These two cases are indicated with comments where appropriate.
 5"""
 6
 7from pathlib import Path
 8
 9import xtgeo
10from fmu.config import utilities as ut
11
12from fmu.dataio import ExportData
13
14CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml")
15
16HORIZON_NAMES = CFG["rms"]["horizons"]["TOP_RES"]
17
18# If inside RMS, set the polygon category.
19RMS_POL_CATEGORY = "GL_faultlines_extract_postprocess"
20
21# If re-exporting already exported files for Sumo, set the directory where the files
22# have been exported.
23POL_DIR = Path("../output/polygons")
24
25
26def export_fault_lines():
27    """Re-export fault lines polygons with metadata in two formats."""
28
29    # Export both csv (keeping xtgeo column names) and irap text format The difference
30    # bewtween "csv" and "csv|xtgeo" is that the latter will keep xtgeo column names
31    # as-is while "csv" will force column names to "X Y Z ID"
32    for fmt in ["csv|xtgeo", "irap_ascii"]:
33        ExportData.polygons_fformat = fmt
34        export_data = ExportData(
35            config=CFG,
36            content="fault_lines",
37            unit="m",
38            tagname="faultlines",
39            workflow="rms structural model",
40        )
41
42        for name in HORIZON_NAMES:
43            # RMS: read the polygon directly from RMS
44            # poly = xtgeo.polygons_from_roxar(project, name, RMS_POL_CATEGORY)
45
46            # From an already exported polygon
47            pol_file = POL_DIR / f"{name.lower()}.pol"
48            poly = xtgeo.polygons_from_file(pol_file)
49            poly.name = name
50
51            export_data.export(poly)
52
53
54def main():
55    print("\nExporting fault lines polygons and metadata...")
56    export_fault_lines()
57    print("Done exporting fault lines polygons and metadata.")
58
59
60if __name__ == "__main__":
61    main()

Press + to see generated YAML file.

class: polygons
masterdata:
  smda:
    coordinate_system:
      identifier: ST_WGS84_UTM37N_P32637
      uuid: ad214d85-dac7-19da-e053-c918a4889309
    country:
    - identifier: Norway
      uuid: ad214d85-8a1d-19da-e053-c918a4889309
    discovery:
    - short_identifier: DROGON
      uuid: ad214d85-8a1d-19da-e053-c918a4889309
    field:
    - identifier: DROGON
      uuid: 00000000-0000-0000-0000-000000000000
    stratigraphic_column:
      identifier: DROGON_2020
      uuid: ad214d85-8a1d-19da-e053-c918a4889310
tracklog:
- datetime: '2026-06-05T10:36:38.301052Z'
  event: created
  user:
    id: docs
  sysinfo:
    fmu-dataio:
      version: 2.29.2.dev3+g7b3b17db7
    operating_system:
      hostname: build-33005878-project-703197-fmu-dataio
      operating_system: Linux-7.0.0-1004-aws-x86_64-with-glibc2.35
      release: 7.0.0-1004-aws
      system: Linux
      version: '#4-Ubuntu SMP PREEMPT Mon Apr 13 13:14:24 UTC 2026'
source: fmu
version: 0.22.0
$schema: https://main-fmu-schemas-prod.radix.equinor.com/schemas/0.22.0/fmu_results.json
fmu:
  case:
    name: MyCase
    user:
      id: docs
    uuid: de3299d8-4460-462e-a359-5b274d40164a
  model:
    name: ff
    revision: 21.1.0.dev
  context:
    stage: realization
  ensemble:
    name: iter-0
    uuid: c68ca28f-f0d5-c895-fe21-63a2d127bb9e
    id: 0
  iteration:
    name: iter-0
    uuid: c68ca28f-f0d5-c895-fe21-63a2d127bb9e
    id: 0
  workflow:
    reference: rms structural model
  realization:
    id: 0
    name: example_exports
    uuid: fe066697-5ecf-1432-b881-5a5e7a993a67
  entity:
    uuid: 3fea7c8c-0380-7a41-c7fb-1dc0f7862bfe
  ert:
    experiment:
      id: 00000000-0000-0000-0000-000000000000
    simulation_mode: test_run
    ensemble:
      name: iter-0
      uuid: b027f225-c45d-477d-8f33-73695217ba14
      id: 0
access:
  asset:
    name: Drogon
  classification: internal
  ssdl:
    access_level: internal
    rep_include: false
data:
  content: fault_lines
  name: VOLANTIS GP. Top
  alias:
  - TopVOLANTIS
  - TOP_VOLANTIS
  - TopVolantis
  tagname: faultlines
  stratigraphic: true
  smda_entity:
    identifier: VOLANTIS GP. Top
  bbox:
    xmin: 459480.7
    xmax: 465790.141
    ymin: 5929993.362
    ymax: 5937737.446
    zmin: 1557.431
    zmax: 1825.486
  format: irap_ascii
  is_observation: false
  is_prediction: true
  layout: unset
  offset: 0.0
  spec:
    npolys: 6
  undef_is_zero: false
  unit: m
  vertical_domain: depth
  domain_reference: msl
file:
  absolute_path: /home/docs/checkouts/readthedocs.org/user_builds/fmu-dataio/checkouts/latest/examples/example_exports/share/results/polygons/volantis_gp_top--faultlines.pol
  relative_path: example_exports/share/results/polygons/volantis_gp_top--faultlines.pol
  runpath_relative_path: share/results/polygons/volantis_gp_top--faultlines.pol
  checksum_md5: 7b85a0113a83a450eb945be37d75b537
  size_bytes: 33205
display:
  name: VOLANTIS GP. Top
_preprocessed: false