1
Fork 0

Subdomain read-only

This commit is contained in:
Edgar P. Burkhart 2022-04-07 15:03:15 +02:00
parent fed9961ef2
commit fd555e413e
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -2,6 +2,7 @@ import argparse
import configparser import configparser
import logging import logging
import pathlib import pathlib
import sys
import numpy as np import numpy as np
@ -36,6 +37,9 @@ out_root = pathlib.Path(config.get("out", "root"))
out_root.mkdir(exist_ok=True) out_root.mkdir(exist_ok=True)
bathy_inp = inp_root.joinpath(config.get("inp", "base")) bathy_inp = inp_root.joinpath(config.get("inp", "base"))
bathy_out = out_root.joinpath(config.get("out", "sub")) 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}'") log.info(f"Reading bathymetry from '{bathy_inp}'")
raw_bathy = np.loadtxt(bathy_inp) raw_bathy = np.loadtxt(bathy_inp)
log.debug(f"Initial size: {raw_bathy.shape}") 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'") log.info(f"Saving subdomain to 'bathy'")
np.save(bathy_out, bathy) np.save(bathy_out, bathy)
bathy_out.chmod(0o444)