Skip to content
Snippets Groups Projects
Commit 3a188412 authored by udubey's avatar udubey
Browse files

allow fixing for gateways before Triangle runs from a input file

parent 90c6b3bf
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,8 @@ Bootstrap script to create a new mesh based on the CORE 2 Resolution.
Dr. Paul Gierz, Jan 2020
"""
import cdo
import yaml
import os
import shutil
......@@ -18,6 +20,33 @@ if __name__ == "__main__":
if not os.path.exists("./raw_input_data"):
os.makedirs("./raw_input_data")
shutil.copyfile("{{cookiecutter.input_fpath}}", "./raw_input_data/{{cookiecutter.input_fname}}")
shutil.copyfile("{{cookiecutter.input_fpath}}", "./raw_input_data/{{cookiecutter.input_fname}}_backup")
if os.path.exists("fixup_gateways.yaml"):
with open("fixup_gateways.yaml", "r") as gateway_fixes_file:
gateway_fixes = yaml.load(gateway_fixes_file)
if gateway_fixes:
CDO = cdo.Cdo()
print("Fixup input data:")
for gateway_name, fix_list in gateway_fixes.items():
print(gateway_name)
print(fix_list)
for fix_number, fix in enumerate(fix_list):
print(f"* {fix_number}:")
fix = [int(item) for item in fix.split(",")]
x1 = fix[0]
x2 = fix[1]
y1 = fix[2]
y2 = fix[3]
value = fix[4]
print("* Setting:")
# FIXME:
print(f"{y2} ------ {x2}")
print(f" | |")
print(f" | {value} |")
print(f" | |")
print(f"{x1} ------ {y1}")
output = CDO.setcindexbox(f"{value},{x1},{x2},{y1},{y2}", input="./raw_input_data/{{cookiecutter.input_fname}}")
os.rename(output, "./raw_input_data/{{cookiecutter.input_fname}}")
print(40*"- ")
print("* MATLAB Part:")
os.system("matlab.sh -s -S\"--mem=36000\" -M\"-nodisplay -r run('mg_topo_prep_triangle_input.m')\"")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment