Access to Result Files
Accessing GeoDict result files (*.gdr) from Python macros is possible with the stringmap module. Use it to parse GeoDict key/value text file formats such as GDR files. Stringmaps represent a hierarchical key/value data structure, like a nested dictionary.
An example of usage, assuming a geometric pore size distribution (Granulometry) was run with PoroDict and the result file was saved as PoreSizes.gdr:
import stringmap |
# The module stringmap is # loaded in the beginning. |
gdrPath = "PoreSizes.gdr" |
# assign GeoDict result file # PoreSizes to variable gdrPath |
gdr = stringmap.parseGDR(gdrPath) |
# read and parse the GDR # file into a string map # object and assign it to # variable gdr |
gdr.push("ResultMap") |
# move into the result map # Alternatively, you can omit # this push and write # "ResultMap:MaxDiameter" # in the following line |
maxDiameters = gdr.getList("MaxDiameter") volFracsCumulative = gdr.getList("VolumeFractionCumulative") |
# get the list values called # "MaxDiameter" and # "VolumeFractionCumulative" # from the result map in the GDR # To get other types of values # use one of the following methods: # gdr.getBool(key), gdr.getInt(key), # gdr.getDouble(key) # getList always returns a list # of strings, however |
maxDiameters = [float(x) for x in maxDiameters] |
# do the following to convert # the string lists to numerical values |
volFracsCumulative = [float(x) for x in volFracsCumulative] |
# convert each list entry from a # string to a floating point value |
gdr.pop() |
# go back to the root of the tree # only needed when push was used |
To find the right keys open a result file in the GeoDict Result Viewer by selecting File → Open Results (*.gdr) from the menu bar and move to the desired map tab, here the Results – Map subtab. The Input Map ("InputMap"), the Log Map ("LogMap"), the Post Map ("PostProcessingMap") and the Parameter Map under the Metadata tab ("ParameterMap") can be accessed in the same way.
