diff --git a/parcels/field.py b/parcels/field.py index ec741ec36..ed907747a 100644 --- a/parcels/field.py +++ b/parcels/field.py @@ -208,6 +208,7 @@ def __init__( else: raise ValueError("Unsupported mesh type. Choose either: 'spherical' or 'flat'") self.timestamps = timestamps + self._loaded_time_indices: Iterable[int] = [] # type: ignore if isinstance(interp_method, dict): if self.name in interp_method: self.interp_method = interp_method[self.name] @@ -265,6 +266,7 @@ def __init__( if not self.grid.defer_load: self.data = self._reshape(self.data, transpose) + self._loaded_time_indices = range(self.grid.tdim) # Hack around the fact that NaN and ridiculously large values # propagate in SciPy's interpolators @@ -288,7 +290,6 @@ def __init__( self._dataFiles = np.append(self._dataFiles, self._dataFiles[0]) self._field_fb_class = kwargs.pop("FieldFileBuffer", None) self._netcdf_engine = kwargs.pop("netcdf_engine", "netcdf4") - self._loaded_time_indices: Iterable[int] = [] # type: ignore self._creation_log = kwargs.pop("creation_log", "") self.chunksize = kwargs.pop("chunksize", None) self.netcdf_chunkdims_name_map = kwargs.pop("chunkdims_name_map", None) diff --git a/parcels/fieldset.py b/parcels/fieldset.py index cbe311670..e62ef45a8 100644 --- a/parcels/fieldset.py +++ b/parcels/fieldset.py @@ -1538,6 +1538,7 @@ def computeTimeChunk(self, time=0.0, dt=1): for f in self.get_fields(): if isinstance(f, (VectorField, NestedField)) or not f.grid.defer_load or f._dataFiles is None: continue + f._loaded_time_indices = [] # reset loaded time indices g = f.grid if g._update_status == "first_updated": # First load of data if f.data is not None and not isinstance(f.data, DeferredArray):