Skip to content

Commit 1478601

Browse files
committed
[JTH] little edit to homogenize new base_wrappers posprocess_cases function
1 parent 4db82ba commit 1478601

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

bluemath_tk/wrappers/lisflood/__init__.py

Whitespace-only changes.

bluemath_tk/wrappers/lisflood/lisflood_wrapper.py

Whitespace-only changes.

bluemath_tk/wrappers/swash/swash_wrapper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ def postprocess_case(
341341
self,
342342
case_num: int,
343343
case_dir: str,
344+
case_context: dict,
344345
output_vars: List[str] = None,
345346
overwrite_output: bool = True,
346347
overwrite_output_postprocessed: bool = True,
@@ -356,6 +357,8 @@ def postprocess_case(
356357
The case number.
357358
case_dir : str
358359
The case directory.
360+
case_context : dict
361+
The case context.
359362
output_vars : list, optional
360363
The output variables to postprocess. Default is None.
361364
overwrite_output : bool, optional

bluemath_tk/wrappers/xbeach/xbeach_wrapper.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
import numpy as np
66
import pandas as pd
77
import xarray as xr
8-
9-
from wavespectra.construct.frequency import jonswap
108
from wavespectra.construct.direction import cartwright
9+
from wavespectra.construct.frequency import jonswap
1110

1211
from .._base_wrappers import BaseModelWrapper
1312

@@ -67,7 +66,7 @@ def __init__(
6766
self.set_logger_name(
6867
name=self.__class__.__name__, level="DEBUG" if debug else "INFO"
6968
)
70-
69+
7170
def create_vardens(self, ds):
7271
t = ""
7372

@@ -89,9 +88,9 @@ def create_vardens(self, ds):
8988
var = 0.0
9089
t += "{0}\t".format(var)
9190
t += "\n"
92-
91+
9392
return t
94-
93+
9594
def build_case(
9695
self,
9796
case_context: dict,
@@ -131,7 +130,7 @@ def build_case(
131130
dm=case_context["Dir"],
132131
dspr=case_context["SPR"],
133132
)
134-
efth = ef * gth
133+
efth = ef * gth
135134

136135
spectrum = xr.Dataset(
137136
{
@@ -146,12 +145,11 @@ def build_case(
146145
},
147146
).sortby(["freq", "dir"])
148147

149-
spectrum['dir'] = (270 - (spectrum['dir'])) % 360
148+
spectrum["dir"] = (270 - (spectrum["dir"])) % 360
150149
spec = self.create_vardens(spectrum)
151150
with open(f"{case_dir}/vardens.txt", "w") as f:
152151
f.write(spec)
153152

154-
155153
def _get_average_var(self, case_nc: xr.Dataset, var: str) -> np.ndarray:
156154
"""
157155
Get the average value of a variable except for the first hour of the simulation
@@ -241,6 +239,7 @@ def postprocess_case(
241239
self,
242240
case_num: int,
243241
case_dir: str,
242+
case_context: dict,
244243
output_vars: List[str] = None,
245244
overwrite_output: bool = True,
246245
) -> xr.Dataset:
@@ -253,6 +252,8 @@ def postprocess_case(
253252
The case number.
254253
case_dir : str
255254
The case directory.
255+
case_context : dict
256+
The case context.
256257
output_vars : list, optional
257258
The output variables to postprocess. Default is None.
258259
overwrite_output : bool, optional

0 commit comments

Comments
 (0)