From de6211decfbfc8615afafabe64a0031dd77528b9 Mon Sep 17 00:00:00 2001 From: tomsail Date: Mon, 6 Nov 2023 18:44:33 +0100 Subject: [PATCH] reverted to only necessary changes --- pyposeidon/schism.py | 5 +++-- pyposeidon/utils/cast.py | 7 +++---- pyposeidon/utils/obs.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyposeidon/schism.py b/pyposeidon/schism.py index 9569fc13..5dbbc799 100644 --- a/pyposeidon/schism.py +++ b/pyposeidon/schism.py @@ -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), ) ) # --------------------------------------------------------------------- @@ -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]), diff --git a/pyposeidon/utils/cast.py b/pyposeidon/utils/cast.py index 690d72dc..f96350d6 100644 --- a/pyposeidon/utils/cast.py +++ b/pyposeidon/utils/cast.py @@ -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( { diff --git a/pyposeidon/utils/obs.py b/pyposeidon/utils/obs.py index 841b37b4..2f9e27f9 100644 --- a/pyposeidon/utils/obs.py +++ b/pyposeidon/utils/obs.py @@ -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,