Skip to content

Commit

Permalink
Removing dependence on adcircpy (#23)
Browse files Browse the repository at this point in the history
* Removing dependence on adcircpy
- [for now] copying over besttrackforcing from adcircpy into tropicalcyclone.atcf module
- removed NWS, BLAdh, geo, and time interval properties as they are related to adcirc inputs
- add test/output folders to .gitignore

* adding some help info for atcf tracks and adding __init__.py to subdirectories to find them
  • Loading branch information
WPringle authored Jun 11, 2021
1 parent 6e06c7d commit bc1c08e
Show file tree
Hide file tree
Showing 6 changed files with 732 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,4 @@ cython_debug/

.idea/
/examples/data/*
/tests/data/output
Empty file.
Empty file.
31 changes: 1 addition & 30 deletions ensembleperturbation/perturbation/make_storm_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from random import gauss, random
from typing import Union

from adcircpy.forcing.winds.best_track import BestTrackForcing
from ensembleperturbation.tropicalcyclone.atcf import BestTrackForcing
from dateutil.parser import parse as parse_date
import numpy
from numpy import floor, interp, sign
Expand Down Expand Up @@ -645,24 +645,18 @@ class BestTrackPerturber:
def __init__(
self,
storm: str,
nws: int = None,
interval: timedelta = None,
start_date: datetime = None,
end_date: datetime = None,
):
"""
build storm perturber
:param storm: NHC storm code, for instance `al062018`
:param nws: wind stress parameter
:param interval: time interval
:param start_date: start time of ensemble
:param end_date: end time of ensemble
"""

self.storm = storm
self.nws = nws
self.interval = interval
self.start_date = start_date
self.end_date = end_date

Expand All @@ -677,24 +671,6 @@ def storm(self) -> str:
def storm(self, storm: str):
self.__storm = storm

@property
def nws(self) -> int:
return self.__nws

@nws.setter
def nws(self, nws: int):
self.__nws = nws

@property
def interval(self) -> timedelta:
return self.__interval

@interval.setter
def interval(self, interval: timedelta):
if interval is not None and not isinstance(interval, timedelta):
self.__interval = timedelta(seconds=interval)
self.__interval = interval

@property
def start_date(self) -> datetime:
return self.__start_date
Expand All @@ -717,14 +693,9 @@ def end_date(self, end_date: datetime):

@property
def forcing(self) -> BestTrackForcing:
interval = self.interval
if interval is not None:
interval = interval / timedelta(seconds=1)

configuration = {
'storm': self.storm,
'nws': self.nws,
'interval_seconds': interval,
'start_date': self.start_date,
'end_date': self.end_date,
}
Expand Down
Empty file.
Loading

0 comments on commit bc1c08e

Please sign in to comment.