From 0f9841bff619f5b704ca0afbe4e4494be894c8bb Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Fri, 4 Mar 2022 10:43:45 +0100 Subject: [PATCH] Added support for const --- swash/processing/read_swash.py | 6 +++++- swash/processing/sws_npz.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/swash/processing/read_swash.py b/swash/processing/read_swash.py index aa43c4b..9265db2 100644 --- a/swash/processing/read_swash.py +++ b/swash/processing/read_swash.py @@ -22,7 +22,11 @@ class ReadSwash: self._x = np.unique(self.read_nohead(path)) self._n_x = self._x.size - def read_scalar(self, path): + def read_scalar(self, path, const=False): + if const: + self._data[path.stem] = slef.read_nohead(path).reshape( + (self._n_t, self._n_x) + )[0, :] self._data[path.stem] = self.read_nohead(path).reshape( (self._n_t, self._n_x) ) diff --git a/swash/processing/sws_npz.py b/swash/processing/sws_npz.py index aceb6bd..815d138 100644 --- a/swash/processing/sws_npz.py +++ b/swash/processing/sws_npz.py @@ -30,7 +30,7 @@ rsws.read_x(sws_out.joinpath("xp.dat")) log.info("Reading 'dep'") rsws.read_scalar(sws_out.joinpath("dep.dat")) log.info("Reading 'botl'") -rsws.read_scalar(sws_out.joinpath("botl.dat")) +rsws.read_scalar(sws_out.joinpath("botl.dat"), const=True) log.info("Reading 'watl'") rsws.read_scalar(sws_out.joinpath("watl.dat")) log.info("Reading 'vel'")