Extract saturated structures with Python

· 2 · 433


  • *
  • Posts: 4
    • View Profile
Extract saturated structures with Python
« on: May 23, 2024, 12:24:12 PM »

I am creating a GeoApp, and one of the steps ideally would involve getting saturated structures from the "capillary pressure curve" result file. I know that the .gdt files of the saturated structures are saved in a folder, but those are only labeled as "step_index.gdt" without the specified amount of saturation. Is there a way, for example, to obtain only the structures at 0.1, 0.5, and 0.8 saturation (or as close to those saturations as possible) using Python?



  • *****
  • Posts: 8
    • View Profile
Re: Extract saturated structures with Python
« Reply #1 on: May 23, 2024, 04:03:11 PM »

yes, there is. The values can be found in the Resultmap. Thus, you can access them from Python via the stringmap package. Find a detailed description for the stringmap options in the GeoPy Scripting User Guide on page 81 (https://www.math2market.com/fileadmin/UserGuide/GeoDict2024/Automation2024.pdf). Below find an example how the file with the saturation closest to 0.5 can be found.

Code: [Select]
import stringmap

gdr = stringmap.parseGDR("CapillaryPressureResult.gdr")
saturationlist = gdr.getList("SaturationInvading")

def getSaturationIndex(saturationvalue):
  saturationdifference = 1
  for saturation in saturationlist:
    diff = abs(saturationvalue-float(saturation))
    if diff < saturationdifference:
      saturationindex = saturationlist.index(saturation)
  return saturationindex
file = f"CapillaryPressureResult/Step_{getSaturationIndex(0.5):06}.gdt"