|
11 | 11 | from tqdm import tqdm |
12 | 12 |
|
13 | 13 | from parcels._compat import MPI |
| 14 | +from parcels._core.utils.time import TimeInterval |
14 | 15 | from parcels._reprs import particleset_repr |
15 | 16 | from parcels.application_kernels.advection import AdvectionRK4 |
16 | | -from parcels.field import Field |
17 | 17 | from parcels.grid import GridType |
18 | 18 | from parcels.interaction.interactionkernel import InteractionKernel |
19 | 19 | from parcels.interaction.neighborsearch import ( |
@@ -162,8 +162,8 @@ def ArrayClass_init(self, *args, **kwargs): |
162 | 162 | raise NotImplementedError("If fieldset.time_origin is not a date, time of a particle must be a double") |
163 | 163 | time = np.array([self.time_origin.reltime(t) if _convert_to_reltime(t) else t for t in time]) |
164 | 164 | assert lon.size == time.size, "time and positions (lon, lat, depth) do not have the same lengths." |
165 | | - if isinstance(fieldset.U, Field) and (not fieldset.U.allow_time_extrapolation): |
166 | | - _warn_particle_times_outside_fieldset_time_bounds(time, fieldset.U.grid.time) |
| 165 | + if fieldset.time_interval: |
| 166 | + _warn_particle_times_outside_fieldset_time_bounds(time, fieldset.time_interval) |
167 | 167 |
|
168 | 168 | if lonlatdepth_dtype is None: |
169 | 169 | lonlatdepth_dtype = self.lonlatdepth_dtype_from_field_interp_method(fieldset.U) |
@@ -1127,17 +1127,17 @@ def _warn_outputdt_release_desync(outputdt: float, starttime: float, release_tim |
1127 | 1127 | ) |
1128 | 1128 |
|
1129 | 1129 |
|
1130 | | -def _warn_particle_times_outside_fieldset_time_bounds(release_times: np.ndarray, time: np.ndarray): |
| 1130 | +def _warn_particle_times_outside_fieldset_time_bounds(release_times: np.ndarray, time: np.ndarray | TimeInterval): |
1131 | 1131 | if np.any(release_times): |
1132 | 1132 | if np.any(release_times < time[0]): |
1133 | 1133 | warnings.warn( |
1134 | | - "Some particles are set to be released before the fieldset's first time and allow_time_extrapolation is set to False.", |
| 1134 | + "Some particles are set to be released outside the FieldSet's executable time domain.", |
1135 | 1135 | ParticleSetWarning, |
1136 | 1136 | stacklevel=2, |
1137 | 1137 | ) |
1138 | 1138 | if np.any(release_times > time[-1]): |
1139 | 1139 | warnings.warn( |
1140 | | - "Some particles are set to be released after the fieldset's last time and allow_time_extrapolation is set to False.", |
| 1140 | + "Some particles are set to be released after the fieldset's last time and the fields are not constant in time.", |
1141 | 1141 | ParticleSetWarning, |
1142 | 1142 | stacklevel=2, |
1143 | 1143 | ) |
0 commit comments