From fd555e413e16f336138199ffb38c9802fa0a5b9e Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Thu, 7 Apr 2022 15:03:15 +0200 Subject: [PATCH] Subdomain read-only --- data/processing/subdomain.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/processing/subdomain.py b/data/processing/subdomain.py index 6ddcf40..2983bf1 100644 --- a/data/processing/subdomain.py +++ b/data/processing/subdomain.py @@ -2,6 +2,7 @@ import argparse import configparser import logging import pathlib +import sys import numpy as np @@ -36,6 +37,9 @@ out_root = pathlib.Path(config.get("out", "root")) out_root.mkdir(exist_ok=True) bathy_inp = inp_root.joinpath(config.get("inp", "base")) bathy_out = out_root.joinpath(config.get("out", "sub")) +if bathy_out.exists(): + log.error(f"'{bathy_out}' already exists!") + sys.exit(1) log.info(f"Reading bathymetry from '{bathy_inp}'") raw_bathy = np.loadtxt(bathy_inp) log.debug(f"Initial size: {raw_bathy.shape}") @@ -48,3 +52,4 @@ log.debug(f"Final size: {bathy.shape}") log.info(f"Saving subdomain to 'bathy'") np.save(bathy_out, bathy) +bathy_out.chmod(0o444)