geoschem / integrated_methane_inversion

Integrated Methane Inversion workflow repository.
https://imi.readthedocs.org
MIT License
26 stars 24 forks source link

update parse yaml function to convert to shell variables #218

Closed laestrada closed 4 months ago

laestrada commented 4 months ago

Name and Institution (Required)

Name: Lucas Estrada Institution: Harvard ACMG

Describe the update

This PR replaces the parse_yaml.sh function to use python to read and convert yaml variables into shell variables. The original parse_yaml.sh function was very particular about inputted yaml and could not handle yaml lists or comments/ spaces on the same line as a variable. This led to very buggy behavior for some users.

Reading it with python is much more dependable and also allows conversion of lists to bash arrays nicely.

The only complication is that we need to read two variables (CondaFile and CondaEnv) prior to running the new parse_yaml.py function as we need to load the python environment first. I added two shell commands to extract these values in run_imi.sh. These commands extract the variables without grabbing comments or spaces on the same line.