Skip to content

Commit f224f07

Browse files
committed
[JTH] add watlev variable to swash postprocess
1 parent ae85397 commit f224f07

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

bluemath_tk/wrappers/swash/swash_wrapper.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class SwashModelWrapper(BaseModelWrapper):
6666
"Msetup": "calculate_setup",
6767
"Hrms": "calculate_statistical_analysis",
6868
"Hfreqs": "calculate_spectral_analysis",
69+
"Watlev": "get_waterlevel",
6970
}
7071

7172
def __init__(
@@ -268,6 +269,30 @@ def find_maximas(self, x: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
268269

269270
return peaks, x[peaks]
270271

272+
def get_waterlevel(
273+
self, case_num: int, case_dir: str, output_nc: xr.Dataset
274+
) -> xr.Dataset:
275+
"""
276+
Get water level from the output netCDF file.
277+
278+
Parameters
279+
----------
280+
case_num : int
281+
The case number.
282+
case_dir : str
283+
The case directory.
284+
output_nc : xr.Dataset
285+
The output netCDF file.
286+
287+
Returns
288+
-------
289+
xr.Dataset
290+
The water level.
291+
"""
292+
293+
# get water level
294+
return output_nc[["Watlev"]].squeeze()
295+
271296
def calculate_runup2(
272297
self, case_num: int, case_dir: str, output_nc: xr.Dataset
273298
) -> xr.Dataset:
@@ -276,6 +301,10 @@ def calculate_runup2(
276301
277302
Parameters
278303
----------
304+
case_num : int
305+
The case number.
306+
case_dir : str
307+
The case directory.
279308
output_nc : xr.Dataset
280309
The output netCDF file.
281310

0 commit comments

Comments
 (0)