Skip to content

Commit a0b0931

Browse files
committed
improve handling of times when cdo fails to grok them
1 parent 313f29a commit a0b0931

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

nctoolkit/add_etc.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,17 @@ def operation(self, method="mul", ff=None, var=None):
145145
else:
146146
ff_times_df = (
147147
pd.DataFrame({"time": ff_times})
148-
.assign(
149-
year=lambda x: x.time.dt.year,
150-
month=lambda x: x.time.dt.month,
151-
day=lambda x: x.time.dt.day,
152-
)
148+
)
149+
ff_times_df["year"] = [x.year for x in ff_times]
150+
ff_times_df["month"] = [x.month for x in ff_times]
151+
ff_times_df["day"] = [x.day for x in ff_times]
152+
# .assign(
153+
# year=lambda x: x.time.dt.year,
154+
# month=lambda x: x.time.dt.month,
155+
# day=lambda x: x.time.dt.day,
156+
# )
157+
ff_times_df = (
158+
ff_times_df
153159
.drop(columns="time")
154160
)
155161

0 commit comments

Comments
 (0)