Add swash compatible spectrum generation
This commit is contained in:
parent
e5d6f9f711
commit
98426a1ab7
3 changed files with 44 additions and 1 deletions
|
@ -6,6 +6,7 @@ hstru=Hstru.dat
|
||||||
poro=Poro.dat
|
poro=Poro.dat
|
||||||
psize=Psize.dat
|
psize=Psize.dat
|
||||||
raw_ts=cerema/raw/201702281700.raw,cerema/raw/201702281730.raw
|
raw_ts=cerema/raw/201702281700.raw,cerema/raw/201702281730.raw
|
||||||
|
raw_spec=cerema/spt/201702281715.spt
|
||||||
hires_step=0.5
|
hires_step=0.5
|
||||||
|
|
||||||
[out]
|
[out]
|
||||||
|
|
42
data/processing/spec.py
Normal file
42
data/processing/spec.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import argparse
|
||||||
|
import configparser
|
||||||
|
import logging
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description="Pre-process time-series")
|
||||||
|
parser.add_argument("-v", "--verbose", action="count", default=0)
|
||||||
|
parser.add_argument("-c", "--config", default="config.ini")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
logging.basicConfig(level=max((10, 20 - 10 * args.verbose)))
|
||||||
|
log = logging.getLogger("bathy")
|
||||||
|
|
||||||
|
log.info("Starting time-series pre-processing")
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read(args.config)
|
||||||
|
|
||||||
|
inp_root = pathlib.Path(config.get("inp", "root"))
|
||||||
|
out_root = pathlib.Path(config.get("out", "root"))
|
||||||
|
|
||||||
|
inp_spec = inp_root.joinpath(config.get("inp", "raw_spec"))
|
||||||
|
out_spec = out_root.joinpath("spec.dat")
|
||||||
|
|
||||||
|
inp = np.loadtxt(
|
||||||
|
inp_spec,
|
||||||
|
dtype=[("f", float), ("S", float)],
|
||||||
|
delimiter=",",
|
||||||
|
skiprows=12,
|
||||||
|
usecols=(0, 6),
|
||||||
|
max_rows=64,
|
||||||
|
)
|
||||||
|
|
||||||
|
with out_spec.open("w") as out:
|
||||||
|
out.write("SPEC1D\n")
|
||||||
|
np.savetxt(out, inp)
|
||||||
|
|
||||||
|
df = np.diff(inp['f']).min()
|
||||||
|
log.info(f"Minimum frequency delta: {df:.4f}Hz")
|
||||||
|
log.info(f"Maximum modelled time: {1/df:.0f}s")
|
2
tasks.md
2
tasks.md
|
@ -1,7 +1,7 @@
|
||||||
* Vérification méthodes calcul réflection avec données forcées en Python
|
* Vérification méthodes calcul réflection avec données forcées en Python
|
||||||
|
|
||||||
|
|
||||||
Vérification vague incidente possible avec digue et sans digue sur temps long (4h) avec spectre Jonswap
|
Vérification vague incidente possible avec digue et sans digue sur temps long (4h) avec spectre
|
||||||
|
|
||||||
|
|
||||||
* Tracer trajectoires bouées (3d, 2d) autour de vague 15m
|
* Tracer trajectoires bouées (3d, 2d) autour de vague 15m
|
||||||
|
|
Loading…
Reference in a new issue