diff --git a/pyschism/forcing/nws/best_track.py b/pyschism/forcing/nws/best_track.py index 581b9f5c..466dab19 100644 --- a/pyschism/forcing/nws/best_track.py +++ b/pyschism/forcing/nws/best_track.py @@ -36,7 +36,9 @@ def __init__( storm: Union[str, PathLike, DataFrame, io.BytesIO], start_date: datetime = None, end_date: datetime = None, - hurricane_model: Union[str, HurricaneModel] = 'gahm' + hurricane_model: Union[str, HurricaneModel] = 'gahm', + *args, + **kwargs ): self.model = hurricane_model diff --git a/tests/test_paramwind.py b/tests/test_paramwind.py index 08019ca5..462e1269 100644 --- a/tests/test_paramwind.py +++ b/tests/test_paramwind.py @@ -1,12 +1,15 @@ +import tempfile from datetime import timedelta, datetime from pathlib import Path +from stormevents.nhc import VortexTrack + from pyschism.mesh import Hgrid from pyschism.driver import ModelConfig from pyschism.forcing.nws import BestTrackForcing -def test_paramwind(): +def test_paramwind_from_stormname(): hgrid = Hgrid.open( 'https://raw.githubusercontent.com/geomesh/test-data/main/NWM/hgrid.ll' @@ -30,7 +33,41 @@ def test_paramwind(): nspool=24, ) - driver.write(Path(__file__).parent / 'paramwind', overwrite=True) + with tempfile.TemporaryDirectory() as dn: + tmpdir = Path(dn) + driver.write(tmpdir / 'paramwind', overwrite=True) + +def test_paramwind_from_file(): + hgrid = Hgrid.open( + 'https://raw.githubusercontent.com/geomesh/test-data/main/NWM/hgrid.ll' + ) + + track = VortexTrack.from_storm_name('Florence', 2018) + + + with tempfile.TemporaryDirectory() as dn: + tmpdir = Path(dn) + track.to_file(tmpdir / 'track.dat') + + meteo = BestTrackForcing.from_nhc_bdeck(nhc_bdeck=tmpdir / 'track.dat') + config = ModelConfig( + hgrid=hgrid, + vgrid=None, + fgrid=None, + iettype=None, + ifltype=None, + nws=meteo, + ) + + driver = config.coldstart( + start_date=datetime(2018, 9, 8), + end_date=datetime(2018, 9, 18), + timestep=timedelta(seconds=150), + nspool=24, + ) + + driver.write(tmpdir / 'paramwind', overwrite=True) + if __name__ == '__main__': test_paramwind()