Tutorial 4: load ArchPy project

This notebook demonstrates how to import an ArchPy using a yaml file as input

[1]:
import numpy as np
import matplotlib
from matplotlib import colors
import matplotlib.pyplot as plt
import geone
import geone.covModel as gcm
import geone.imgplot3d as imgplt3
import pyvista as pv
# pv.set_jupyter_backend('static')
import sys
import yaml
import os

#For loading ArchPy, the path where ArchPy is must be added with sys
sys.path.append("../../")
#my modules
from ArchPy.base import * #ArchPy main functions
from ArchPy.tpgs import * #Truncated plurigaussians
from ArchPy.inputs import * #Truncated plurigaussians
[2]:
#load file
ws = "3_fillAndSave"

with open(os.path.join(ws, "Exemple_3.yaml"), "r") as f:
    dic_project = yaml.load(f, Loader=yaml.FullLoader)
[3]:
dic_project
[3]:
{'Facies': {'Clay': {'ID': 4, 'color': 'blue'},
  'GM': {'ID': 3, 'color': 'blueviolet'},
  'Gravel': {'ID': 2, 'color': 'lightgreen'},
  'SM': {'ID': 5, 'color': 'brown'},
  'Sand': {'ID': 1, 'color': 'yellow'},
  'Silt': {'ID': 6, 'color': 'goldenrod'},
  'basement': {'ID': 7, 'color': 'red'}},
 'Pile_master': 'P1',
 'Piles': {'P1': {'list_units': ['D', 'C', 'B', 'A'],
   'name': 'P1',
   'seed': 1,
   'verbose': 1}},
 'Results': {'facies': 'Exemple_3.fac',
  'properties': 'Exemple_3.pro',
  'surfaces': 'Exemple_3.sf',
  'surfaces_bot': 'Exemple_3.sfb',
  'units': 'Exemple_3.unt'},
 'Units': {'A': {'ID': 4,
   'color': 'red',
   'dic_facies': {'f_method': 'homogenous'},
   'list_facies': ['basement'],
   'name': 'A',
   'order': 4,
   'surface': {'contact': 'erode',
    'dic_surf': {'N_transfo': False,
     'bandwidth_mult': 1,
     'covmodel': {'alpha': 0.0,
      'elem': [('spherical', {'r': [10.0, 10.0], 'w': 1.0})]},
     'int_method': 'grf_ineq',
     'tau': 0},
    'name': 'Surface_1'}},
  'B': {'ID': 3,
   'color': 'green',
   'dic_facies': {'TI': 'B_dic_facies_TI.gslib',
    'angle1': 0,
    'angle2': 0,
    'angle3': 0,
    'anisotropyRatioMode': 'one',
    'ax': 1,
    'ay': 1,
    'az': 1,
    'azi_bot': 'gradient',
    'azi_top': 'gradient',
    'constantThreshold': 0.001,
    'dataImage': None,
    'deactivationDistance': 4.0,
    'dip_bot': 'gradient',
    'dip_top': 'gradient',
    'distanceType': ['categorical'],
    'f_method': 'MPS',
    'homo_usage': 1,
    'localPdf': None,
    'localPdfRadius': 12.0,
    'maxscan': 0.1,
    'neig': 24,
    'npost': 1,
    'nv': 1,
    'outputVarFlag': None,
    'probaUsage': 1,
    'probability': [0.33, 0.37, 0.2, 0.1],
    'radiusMode': 'large_default',
    'rotAzi': 90,
    'rotAziLoc': False,
    'rotDip': 0,
    'rotDipLoc': False,
    'rotPlunge': 0,
    'rotPlungeLoc': False,
    'rot_usage': 1,
    'rx': 19.950000792741776,
    'ry': 10.05000039935112,
    'rz': 9.299976348876953,
    'thresh': 0.05,
    'varname': 'code',
    'xloc': False,
    'xr': 0.5,
    'yloc': False,
    'yr': 0.5,
    'zloc': False,
    'zr': 0.3},
   'list_facies': ['Sand', 'Gravel', 'GM', 'SM'],
   'name': 'B',
   'order': 3,
   'surface': {'contact': 'onlap',
    'dic_surf': {'N_transfo': False,
     'bandwidth_mult': 1,
     'covmodel': {'alpha': 0.0,
      'elem': [('cubic', {'r': [6.0, 6.0], 'w': 0.6})]},
     'int_method': 'grf_ineq',
     'tau': 0},
    'name': 'Surface_1'}},
  'C': {'ID': 2,
   'color': 'blue',
   'dic_facies': {'SIS_orientation': False,
    'azimuth': 0,
    'dip': 0,
    'f_covmodel': [{'alpha': 0.0,
      'beta': 0.0,
      'elem': [('exponential', {'r': [10.0, 10.0, 3.0], 'w': 0.25})],
      'gamma': 0.0},
     {'alpha': 45.0,
      'beta': 30.0,
      'elem': [('exponential', {'r': [20.0, 20.0, 5.0], 'w': 0.21})],
      'gamma': 0.0}],
    'f_method': 'SIS',
    'follow_surfaces_smooth': 5,
    'neig': 10,
    'plunge': 0,
    'probability': None,
    'r': 1},
   'list_facies': ['Clay', 'Silt'],
   'name': 'C',
   'order': 2,
   'surface': {'contact': 'onlap',
    'dic_surf': {'N_transfo': False,
     'bandwidth_mult': 1,
     'covmodel': {'alpha': 0.0,
      'elem': [('cubic', {'r': [8.0, 8.0], 'w': 0.2})]},
     'int_method': 'grf_ineq',
     'tau': 0},
    'name': 'Surface_1'}},
  'D': {'ID': 1,
   'color': 'gold',
   'dic_facies': {'Flag': {1: [[(-inf, -0.3), (-inf, 0)]],
     2: [[(0.3, inf), (-inf, 0.5)]],
     3: [[(-inf, -0.3), (0, inf)]],
     5: [[(-0.3, 0.3), (-inf, inf)], [(0.3, inf), (0.5, inf)]]},
    'G_cm': [{'alpha': 0.0,
      'beta': 0.0,
      'elem': [('cubic', {'r': [5.0, 5.0, 2.0], 'w': 1.0}),
       ('nugget', {'w': 0.0})],
      'gamma': 0.0},
     {'alpha': 30.0,
      'beta': 0.0,
      'elem': [('spherical', {'r': [10.0, 10.0, 5.0], 'w': 1.0}),
       ('nugget', {'w': 0.0})],
      'gamma': 0.0}],
    'f_method': 'TPGs',
    'grf_method': 'sgs',
    'neig': 20,
    'nit': 100},
   'list_facies': ['Sand', 'Gravel', 'GM', 'SM'],
   'name': 'D',
   'order': 1,
   'surface': {'contact': 'onlap',
    'dic_surf': {'N_transfo': False,
     'bandwidth_mult': 1,
     'covmodel': {'alpha': 0.0,
      'elem': [('cubic', {'r': [6.0, 6.0], 'w': 0.6})]},
     'int_method': 'grf_ineq',
     'tau': 0},
    'name': 'Surface_1'}}},
 'boreholes': {'facies_data': 'Exemple_3.fd',
  'facies_fake_data': 'fake_Exemple_3.fd',
  'list_bhs': 'Exemple_3.lbh',
  'list_fake_bhs': 'fake_Exemple_3.lbh',
  'units_data': 'Exemple_3.ud',
  'units_fake_data': 'fake_Exemple_3.ud'},
 'facies_computed': 1,
 'grid': {'bot': 'Exemple_3.bot',
  'dimensions': (133, 67, 62),
  'mask': 'Exemple_3.msk',
  'origin': (0.0, 0.0, -15.0),
  'rotation_angle': 0,
  'spacing': (0.15, 0.15, 0.15),
  'top': 'Exemple_3.top'},
 'name': 'Exemple_3',
 'ncpu': 7,
 'nreal_fa': 1,
 'nreal_prop': 5,
 'nreal_units': 2,
 'prop_computed': 1,
 'properties': {'K': {'covmodels': [{'alpha': 0,
     'beta': 0.0,
     'elem': [('spherical', {'r': [3.0, 3.0, 1.0], 'w': 0.1})],
     'gamma': 0.0},
    {'alpha': -20,
     'beta': 0.0,
     'elem': [('exponential', {'r': [5.0, 5.0, 1.0], 'w': 0.3})],
     'gamma': 0.0},
    {'alpha': -20.0,
     'beta': 0.0,
     'elem': [('exponential', {'r': [5.0, 5.0, 1.0], 'w': 0.3})],
     'gamma': 0.0},
    None,
    {'alpha': 0.0,
     'beta': 0.0,
     'elem': [('spherical', {'r': [3.0, 3.0, 1.0], 'w': 0.1})],
     'gamma': 0.0},
    {'alpha': -20.0,
     'beta': 0.0,
     'elem': [('exponential', {'r': [5.0, 5.0, 1.0], 'w': 0.3})],
     'gamma': 0.0},
    None],
   'def_mean': -5,
   'facies': ['Sand', 'Gravel', 'GM', 'Clay', 'SM', 'Silt', 'basement'],
   'int_method': ['sgs',
    'sgs',
    'sgs',
    'homogenous',
    'sgs',
    'sgs',
    'homogenous'],
   'means': [-3.5, -2.0, -4.5, -8.0, -5.5, -6.5, -10.0],
   'name': 'K',
   'vmax': None,
   'vmin': None},
  'Porosity': {'covmodels': [{'alpha': 0,
     'beta': 0.0,
     'elem': [('exponential', {'r': [5.0, 5.0, 5.0], 'w': 0.005})],
     'gamma': 0.0},
    {'alpha': 0.0,
     'beta': 0.0,
     'elem': [('exponential', {'r': [5.0, 5.0, 5.0], 'w': 0.005})],
     'gamma': 0.0},
    {'alpha': 0.0,
     'beta': 0.0,
     'elem': [('exponential', {'r': [5.0, 5.0, 5.0], 'w': 0.005})],
     'gamma': 0.0}],
   'def_mean': 0.3,
   'facies': ['Sand', 'GM', 'Clay'],
   'int_method': ['sgs', 'sgs', 'sgs'],
   'means': [0.4, 0.3, 0.2],
   'name': 'Porosity',
   'vmax': None,
   'vmin': 0}},
 'seed': 1000000,
 'surfaces_computed': 1,
 'verbose': 1,
 'ws': '3_fillAndSave'}
[4]:
#The only requirements are model name (here P1) and working directory
T1 = import_project("Exemple_3", ws=ws)
### IMPORTING PROJECT Exemple_3 IN 3_fillAndSave DIRECTORY ###

Unit A: Surface added for interpolation
Facies basement added to unit A ✅
Unit B: TI added
Unit B: Surface added for interpolation
Facies Sand added to unit B ✅
Facies Gravel added to unit B ✅
Facies GM added to unit B ✅
Facies SM added to unit B ✅
Unit C: Surface added for interpolation
Facies Clay added to unit C ✅
Facies Silt added to unit C ✅
Unit D: Surface added for interpolation
Facies Sand added to unit D ✅
Facies Gravel added to unit D ✅
Facies GM added to unit D ✅
Facies SM added to unit D ✅
Stratigraphic unit D added ✅
Stratigraphic unit C added ✅
Stratigraphic unit B added ✅
Stratigraphic unit A added ✅
Pile sets as Pile master
Property K added
Property Porosity added
## Adding Grid ##
## Grid added and is now simulation grid ##
Borehole 1 added
Borehole 2 added
Borehole 3 added
Borehole 4 added
Borehole 5 added
Borehole 6 added


 ##LOADING RESULTS##


#### Units loaded ####
#### Facies loaded ####
#### Properties loaded ####
#### Surfaces loaded ####
#### Bottom surfaces loaded ####
hierarchical relations set


 ### SUCCESSFUL IMPORT ###

[5]:
T1.plot_facies()