Now that FieldSet input is handled via xarray, we don't have to handle time periodicity anymore and that can be deferred to xarray. We can update our notebooks to mention this using ds.wrap({"time": (0, ...), mode="wrap") - along the lines of
from parcels._datasets.structured.generic import datasets
import xarray as xr
import numpy as np
ds = datasets["ds_2d_left"][["data_g"]].isel(time=slice(0, 3))
start_date = ds.time[0].values
current_end_date = ds.time[-1].values
wanted_end_date = np.datetime64("2001-01-01")
full_time_intervals_needed = int(np.ceil((wanted_end_date - current_end_date) / (current_end_date - start_date)))
n_pad = full_time_intervals_needed * ds.time.size
original_time_dim = ds.time.values
# Make sure the new time dimension is correct for your dataset! (calendar and frequency)
new_time_dim = xr.date_range(start="2000-01-01", periods=ds.time.size + n_pad, freq="1M")
ds = ds.pad({"time": (0, n_pad)}, mode="wrap")
ds["time"] = new_time_dim
(to be done later in v4 development)
xref #1976
Now that FieldSet input is handled via xarray, we don't have to handle time periodicity anymore and that can be deferred to xarray. We can update our notebooks to mention this using
ds.wrap({"time": (0, ...), mode="wrap")- along the lines of(to be done later in v4 development)
xref #1976