diff --git a/pyschism/driver.py b/pyschism/driver.py index 0a2d0d49..ed971a9d 100644 --- a/pyschism/driver.py +++ b/pyschism/driver.py @@ -364,6 +364,7 @@ def __init__( self.config.forcings.nws.windrot = gridgr3.Windrot.default( self.config.hgrid ) + self.param.opt.model_type_pahm = self.config.forcings.nws.model self.param.opt.wtiminc = self.param.core.dt self.param.opt.nws = self.config.forcings.nws.dtype.value diff --git a/pyschism/forcing/nws/best_track.py b/pyschism/forcing/nws/best_track.py index 065bdfc8..29d86397 100644 --- a/pyschism/forcing/nws/best_track.py +++ b/pyschism/forcing/nws/best_track.py @@ -2,8 +2,9 @@ import io import logging import os -from os import PathLike import pathlib +from enum import IntEnum +from os import PathLike from typing import Union from matplotlib import pyplot @@ -24,6 +25,12 @@ from pyschism.mesh import gridgr3 +class HurricaneModel(IntEnum): + SYMMETRIC = 1 + GAHM = 10 + + + class BestTrackForcing(VortexTrack, NWS): def __init__( @@ -32,8 +39,10 @@ def __init__( start_date: datetime = None, end_date: datetime = None, mode: ATCF_Mode = None, + hurricane_model: HurricaneModel = HurricaneModel.GAHM ): + self._model = hurricane_model VortexTrack.__init__( self, @@ -99,6 +108,17 @@ def dtype(self) -> NWSType: """Returns the datatype of the object""" return NWSType(-1) + @property + def model(self) -> HurricaneModel: + """Return hurricane model used for this best track forcing""" + return self._model + + @model.setter + def model(self, value: HurricaneModel): + if value not in list(HurricaneModel): + raise ValueError(f"Invalid hurricane model specified: {value}") + self._model = value + def clip_to_bbox(self, bbox, bbox_crs): msg = f'bbox must be a {Bbox} instance.' assert isinstance(bbox, Bbox), msg diff --git a/pyschism/forcing/source_sink/nwm.py b/pyschism/forcing/source_sink/nwm.py index 05ca8a68..321ef261 100644 --- a/pyschism/forcing/source_sink/nwm.py +++ b/pyschism/forcing/source_sink/nwm.py @@ -334,7 +334,7 @@ def safe_extract(tar, path=".", members=None, *, numeric_owner=False): if not is_within_directory(path, member_path): raise Exception("Attempted Path Traversal in Tar File") - tar.extractall(path, members, numeric_owner) + tar.extractall(path, members, numeric_owner=numeric_owner) safe_extract(src, DATADIR)