Switched to new storage convention for swash output in sws_ola

This commit is contained in:
Edgar P. Burkhart 2022-03-28 09:44:35 +02:00
parent b557712372
commit 71049d49ea
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
63 changed files with 174 additions and 5717 deletions

View file

@ -1,52 +1,3 @@
import subprocess
import tempfile
import numpy as np
class ReadSwash:
def __init__(self):
self._n_x = None
self._n_t = None
self._t = None
self._x = None
@classmethod
def read_nohead(cls, path):
subprocess.run(("sed", "-i", r"s/ /\n/g", path))
return np.loadtxt(path)
def read_time(self, path):
self._t = np.unique(self.read_nohead(path))
self._n_t = self._t.size
return self.t
def read_x(self, path):
self._x = np.unique(self.read_nohead(path))
self._n_x = self._x.size
return self.x
def read_scalar(self, path, const=False):
if const:
return self.read_nohead(path).reshape((self._n_t, self._n_x))[0, :]
return self.read_nohead(path).reshape((self._n_t, self._n_x))
def read_const(self, path):
return self.read_scalar(path, const=True)
def read_vector(self, path):
return self.read_nohead(path).reshape((self._n_t, 2, self._n_x))
def read_scalar_lay(self, path):
return self.read_nohead(path).reshape((self._n_t, -1, self._n_x))
def read_vector_lay(self, path):
return self.read_nohead(path).reshape((self._n_t, -1, 2, self._n_x))
@property
def t(self):
return self._t
@property
def x(self):
return self._x
version https://git-lfs.github.com/spec/v1
oid sha256:81ddc1baff1a727e68dc2819fe3f39ca657c488ab8cbeb83c2d260ae7c9c13fd
size 1349