Added velocity to sws_ola

This commit is contained in:
Edgar P. Burkhart 2022-03-28 10:59:35 +02:00
parent a335f2f5ce
commit 285b9476bc
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 42 additions and 3 deletions

View file

@ -25,6 +25,21 @@ class OFModel:
)
)
def write_vector_field(self, field, values):
with open(self._root.joinpath("0", field), "r") as aw_file:
aw_raw = aw_file.read()
with open(self._root.joinpath("0", field), "w") as aw_file:
aw_file.write(
re.sub(
r"(?<=\(\n).*?(?=\n\))",
"\n".join(map(lambda x: f"({' '.join(x.astype('str'))})", values)),
aw_raw,
count=1,
flags=re.S,
)
)
@property
def x(self):
return self._x