1
Fork 0
internship/olaflow/processing/bathy.py

40 lines
1.0 KiB
Python
Raw Normal View History

import argparse
import configparser
import logging
import pathlib
import numpy as np
2022-03-04 13:11:31 +01:00
from .stl import stl_from_1d
parser = argparse.ArgumentParser(
description="Convert swash output to olaFlow input"
)
parser.add_argument("-v", "--verbose", action="count", default=0)
args = parser.parse_args()
logging.basicConfig(level=max((10, 20 - 10 * args.verbose)))
log = logging.getLogger("sws_ola")
log.info("Starting sws -> olaFlow converter")
config = configparser.ConfigParser()
config.read("config.ini")
bathy = np.loadtxt(config.get("bathy", "bathy"))
2022-03-04 13:11:31 +01:00
poro = bathy + np.loadtxt(config.get("bathy", "hstru"))
out = pathlib.Path(config.get("bathy", "out"))
out.mkdir(exist_ok=True)
stl_from_1d(
bathy,
out.joinpath("bathy.stl"),
2022-03-04 13:43:59 +01:00
config.get("bathy", "scale", fallback=[1, 1, 1]),
config.get("bathy", "translate", fallback=[0, 0, 0]),
2022-03-04 13:11:31 +01:00
)
stl_from_1d(
poro,
out.joinpath("poro.stl"),
2022-03-04 13:43:59 +01:00
config.get("bathy", "scale", fallback=[1, 1, 1]),
config.get("bathy", "translate", fallback=[0, 0, 0]),
2022-03-04 13:11:31 +01:00
)