Skip to content

Commit 579707c

Browse files
committed
Remove msg from TimeExtrapolation constructor
Not needed anymore since show_time isn't in the codebase anymore #1816 (comment)
1 parent 2b46ba9 commit 579707c

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

parcels/field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ def temporal_interpolate_fullfield(self, ti, time):
10481048
if time == t0:
10491049
return self.data[ti, :]
10501050
elif ti + 1 >= len(self.grid.time):
1051-
raise TimeExtrapolationError(time, field=self, msg="show_time")
1051+
raise TimeExtrapolationError(time, field=self)
10521052
else:
10531053
t1 = self.grid.time[ti + 1]
10541054
f0 = self.data[ti, :]

parcels/fieldset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,7 @@ def computeTimeChunk(self, time=0.0, dt=1):
15521552
if f.grid._update_status == "not_updated":
15531553
nextTime_loc = f.grid._computeTimeChunk(f, time, signdt)
15541554
if time == nextTime_loc and signdt != 0:
1555-
raise TimeExtrapolationError(time, field=f, msg="In fset.computeTimeChunk")
1555+
raise TimeExtrapolationError(time, field=f)
15561556
nextTime = min(nextTime, nextTime_loc) if signdt >= 0 else max(nextTime, nextTime_loc)
15571557

15581558
for f in self.get_fields():

parcels/tools/statuscodes.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,13 @@ def _raise_field_out_of_bound_surface_error(z, y, x):
6868
class TimeExtrapolationError(RuntimeError):
6969
"""Utility error class to propagate erroneous time extrapolation sampling."""
7070

71-
def __init__(self, time, field=None, msg=""):
71+
def __init__(self, time, field=None):
7272
if field is not None and field.grid.time_origin and time is not None:
7373
time = field.grid.time_origin.fulltime(time)
74-
message = f"{field.name if field else 'Field'} sampled outside time domain at time {time}."
75-
if msg == "show_time":
76-
message += " Try explicitly providing a 'show_time'."
77-
else:
78-
message += msg + " Try setting allow_time_extrapolation to True."
74+
message = (
75+
f"{field.name if field else 'Field'} sampled outside time domain at time {time}."
76+
" Try setting allow_time_extrapolation to True."
77+
)
7978
super().__init__(message)
8079

8180

0 commit comments

Comments
 (0)