From e0f74121fe2bba900821c87709f33930c36a3506 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Fri, 28 Jan 2022 14:14:01 +0100 Subject: [PATCH] Added force option to overwrite measurements when created from Numpy array --- lasp/lasp_measurement.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lasp/lasp_measurement.py b/lasp/lasp_measurement.py index 2bb1ee4..fb7dd52 100644 --- a/lasp/lasp_measurement.py +++ b/lasp/lasp_measurement.py @@ -737,10 +737,12 @@ class Measurement: delimiter: Column delimiter firstcoltime: If true, the first column is the treated as the sample time. + force: If True, overwrites existing files with specified `mfn` + name. """ if os.path.splitext(mfn)[1] != '.h5': mfn += '.h5' - if os.path.exists(mfn): + if os.path.exists(mfn) and not force: raise ValueError(f'File {mfn} already exist.') if timestamp is None: timestamp = int(time.time())