Skip to content

Commit 485dfd4

Browse files
Merge pull request #1930 from OceanParcels/1844-time-full
Remove Grid.time_full
2 parents c8d8e6d + 6e72b8e commit 485dfd4

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

docs/examples/example_globcurrent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def test_globcurrent_time_extrapolation_error():
208208

209209

210210
@pytest.mark.v4alpha
211-
@pytest.mark.xfail(
211+
@pytest.mark.skip(
212212
reason="This was always broken when using eager loading `deferred_load=False` for the P field. Needs to be fixed."
213213
)
214214
@pytest.mark.parametrize("dt", [-300, 300])

parcels/application_kernels/advection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def AdvectionAnalytical(particle, fieldset, time): # pragma: no cover
176176
I_s = 10 # number of intermediate time steps
177177
direction = 1.0 if particle.dt > 0 else -1.0
178178
withW = True if "W" in [f.name for f in fieldset.get_fields()] else False
179-
withTime = True if len(fieldset.U.grid.time_full) > 1 else False
179+
withTime = True if len(fieldset.U.grid.time) > 1 else False
180180
tau, zeta, eta, xsi, ti, zi, yi, xi = fieldset.U._search_indices(
181181
time, particle.depth, particle.lat, particle.lon, particle=particle
182182
)

parcels/field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ def _check_grid_dimensions(grid1, grid2):
812812
np.allclose(grid1.lon, grid2.lon)
813813
and np.allclose(grid1.lat, grid2.lat)
814814
and np.allclose(grid1.depth, grid2.depth)
815-
and np.allclose(grid1.time_full, grid2.time_full)
815+
and np.allclose(grid1.time, grid2.time)
816816
)
817817

818818
def c_grid_interpolation2D(self, time, z, y, x, particle=None, applyConversion=True):

parcels/grid.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def __init__(
5858
self._lon = lon
5959
self._lat = lat
6060
self.time = time
61-
self.time_full = self.time # needed for deferred_loaded Fields
6261
self._time_origin = TimeConverter() if time_origin is None else time_origin
6362
assert isinstance(self.time_origin, TimeConverter), "time_origin needs to be a TimeConverter object"
6463
assert_valid_mesh(mesh)

parcels/particleset.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def ArrayClass_init(self, *args, **kwargs):
164164
time = np.array([self.time_origin.reltime(t) if _convert_to_reltime(t) else t for t in time])
165165
assert lon.size == time.size, "time and positions (lon, lat, depth) do not have the same lengths."
166166
if isinstance(fieldset.U, Field) and (not fieldset.U.allow_time_extrapolation):
167-
_warn_particle_times_outside_fieldset_time_bounds(time, fieldset.U.grid.time_full)
167+
_warn_particle_times_outside_fieldset_time_bounds(time, fieldset.U.grid.time)
168168

169169
if lonlatdepth_dtype is None:
170170
lonlatdepth_dtype = self.lonlatdepth_dtype_from_field_interp_method(fieldset.U)
@@ -962,7 +962,7 @@ def execute(
962962
if runtime is not None and endtime is not None:
963963
raise RuntimeError("Only one of (endtime, runtime) can be specified")
964964

965-
mintime, maxtime = self.fieldset.gridset.dimrange("time_full")
965+
mintime, maxtime = self.fieldset.gridset.dimrange("time")
966966

967967
default_release_time = mintime if dt >= 0 else maxtime
968968
if np.any(np.isnan(self.particledata.data["time"])):
@@ -980,7 +980,7 @@ def execute(
980980
if runtime is not None:
981981
endtime = starttime + runtime * np.sign(dt)
982982
elif endtime is None:
983-
mintime, maxtime = self.fieldset.gridset.dimrange("time_full")
983+
mintime, maxtime = self.fieldset.gridset.dimrange("time")
984984
endtime = maxtime if dt >= 0 else mintime
985985

986986
if (abs(endtime - starttime) < 1e-5 or runtime == 0) and dt == 0:
@@ -1131,15 +1131,15 @@ def _warn_outputdt_release_desync(outputdt: float, starttime: float, release_tim
11311131
)
11321132

11331133

1134-
def _warn_particle_times_outside_fieldset_time_bounds(release_times: np.ndarray, time_full: np.ndarray):
1134+
def _warn_particle_times_outside_fieldset_time_bounds(release_times: np.ndarray, time: np.ndarray):
11351135
if np.any(release_times):
1136-
if np.any(release_times < time_full[0]):
1136+
if np.any(release_times < time[0]):
11371137
warnings.warn(
11381138
"Some particles are set to be released before the fieldset's first time and allow_time_extrapolation is set to False.",
11391139
ParticleSetWarning,
11401140
stacklevel=2,
11411141
)
1142-
if np.any(release_times > time_full[-1]):
1142+
if np.any(release_times > time[-1]):
11431143
warnings.warn(
11441144
"Some particles are set to be released after the fieldset's last time and allow_time_extrapolation is set to False.",
11451145
ParticleSetWarning,

0 commit comments

Comments
 (0)