Add Description to Resultfile with python macro

· 3 · 1980
*

Mark

  • *
  • Posts: 5
    • View Profile
Add Description to Resultfile with python macro
« on: May 15, 2024, 09:04:26 AM »
Hello,
I would like to add a description to a result file (FlowDict and Filterdict). I run the modules with a Python macro. Is it possible to define a description in the args dictionary? If not, how can I define the description after the run?

Best regards
Mark

*

hilden

  • *****
  • Posts: 9
    • View Profile
Re: Add Description to Resultfile with python macro
« Reply #1 on: May 15, 2024, 12:46:12 PM »
Hello Mark,

you can change the result file from Python after the generation using the stringmap package. This package is described in the GeoPy scripting User Guide in the chapter "Access to GeoDict result files (*.gdr)" on page 81.
 https://www.math2market.com/fileadmin/UserGuide/GeoDict2024/Automation2024.pdf

I give you a short example code to change the description in the metadata tab of a FlowDict result viewer:

Code: [Select]
import stringmap
gdr=stringmap.parseGDR('StokesResult.gdr')
GDR_Description=gdr['Description']
gdr['Description']='some text\n'+GDR_Description
gdr.toFile('new.gdr')

Find the needed keys for the result part to change by printing the gdr in the console
Code: [Select]
print(gdr)
Best regards,
Janine

*

Mark

  • *
  • Posts: 5
    • View Profile
Re: Add Description to Resultfile with python macro
« Reply #2 on: May 15, 2024, 05:33:22 PM »
Hello Janine,
thank you very much for your reply. It works perfectly. I just noticed that the comments are lost in the saved result file and the formatting is slightly changed.

Best regards
Mark