bearecinos / smith_glacier

Experiments with Fenics_ice over Smith, Pope, and Kohler Glaciers; three narrow ∼ 10 km wide, interconnected West Antarctic ice streams (Note: this repository documentation is still a work in progress).
1 stars 0 forks source link

potential inconsistency between paths in .toml and in bash scripts #20

Closed dngoldberg closed 2 years ago

dngoldberg commented 2 years ago

In bash run scripts (e.g. https://github.com/bearecinos/smith_glacier/blob/main/scripts/run_experiments/run_workflow/run_inv.sh) paths are set to certain locations, for instance

input_run_inv=$INPUT_DIR/input_run_inv export run_inv_output_dir=$OUTPUT_DIR/03_run_inv

which then rely on a consistent location being set in .toml files:

input_dir = "/scratch/local/brecinos/smith_glacier/input_data/input_run_inv" output_dir = "/scratch/local/brecinos/smith_glacier/output/03_run_inv/output"

but these could be set inconsistently.

A suggestion is to use sed (a linux utility) to create a copy of the toml file with the locations set to those defined in the bash script:

if $toml is a bash variable with the toml file location, the following should replace $toml with a toml file containing the paths you want:

newstring="input_dir = \"$input_run_inv\"" sed "s@.input_dir.@$newstring@" "$toml" > temp_toml cp temp_toml "$toml"

and similarly can be done for output_dir (and possibly diagnostics_dir) if these need to be set to specific values in the .toml for the script to succeed.

bearecinos commented 2 years ago

Solved in PR #25