Skip to content

Commit

Permalink
reverted to only necessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsail committed Nov 6, 2023
1 parent c92f9f1 commit de6211d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions pyposeidon/schism.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@ def config(self, config_file=None, output=False, **kwargs):
self.parameters.update(dic)

# test rnday
if float(params["CORE"]["rnday"]) * 24 * 3600 > int((self.end_date - self.start_date).total_seconds()):
if float(params["CORE"]["rnday"]) * 24 * 3600 > (self.end_date - self.start_date).total_seconds():
# ---------------------------------------------------------------------
logger.warning("rnday larger than simulation range\n")
logger.warning(
"rnday={} while simulation time is {}\n".format(
params["core"]["rnday"],
int((self.end_date - self.start_date).total_seconds()) / (3600 * 24.0),
(self.end_date - self.start_date).total_seconds() / (3600 * 24.0),
)
)
# ---------------------------------------------------------------------
Expand Down Expand Up @@ -1515,6 +1515,7 @@ def results(self, **kwargs):
date = header2.loc[:, ["start_year", "start_month", "start_day", "start_hour", "utc_start"]]
date = date.astype(int)
date.columns = ["year", "month", "day", "hour", "utc"] # rename the columns
# set the start timestamp
sdate = pd.Timestamp(
year=int(date.year.values[0]),
month=int(date.month.values[0]),
Expand Down
7 changes: 3 additions & 4 deletions pyposeidon/utils/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,9 @@ def run(self, **kwargs):
logger.warning("meteo files present\n")

# modify param file
sdate_seconds = float((self.sdate - self.rdate).total_seconds())
time_frame_seconds = float(pd.to_timedelta(self.time_frame).total_seconds())
rnday_new = sdate_seconds / (3600 * 24.0) + time_frame_seconds / (3600 * 24.0)

rnday_new = (self.sdate - self.rdate).total_seconds() / (3600 * 24.0) + pd.to_timedelta(
self.time_frame
).total_seconds() / (3600 * 24.0)
hotout_write = int(rnday_new * 24 * 3600 / info["params"]["core"]["dt"])
info["parameters"].update(
{
Expand Down
2 changes: 1 addition & 1 deletion pyposeidon/utils/obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_obs_data(stations: str | gp.GeoDataFrame, start_time=None, end_time=None

if not period:
dt = pd.to_datetime(end_time) - pd.to_datetime(start_time)
period = int(dt.total_seconds() / 3600 / 24)
period = dt.total_seconds() / 3600 / 24

data = ioc.get_ioc_data(
ioc_metadata=df,
Expand Down

0 comments on commit de6211d

Please sign in to comment.