From 7541a0729ad2045ff1f3c90c3353ad4d3e5bc7d0 Mon Sep 17 00:00:00 2001 From: Erik van Sebille Date: Mon, 1 Aug 2022 16:26:13 +0200 Subject: [PATCH] Fixing numpy deprecationwarning in timeslices concatenation This commit fixes the `VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated.` warning --- parcels/field.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/parcels/field.py b/parcels/field.py index c53bfb96b..bf26a8f95 100644 --- a/parcels/field.py +++ b/parcels/field.py @@ -245,9 +245,8 @@ def collect_timeslices(timestamps, data_filenames, _grid_fb_class, dimensions, i ftime = filebuffer.time timeslices.append(ftime) dataFiles.append([fname] * len(ftime)) - timeslices = np.array(timeslices) - time = np.concatenate(timeslices) - dataFiles = np.concatenate(np.array(dataFiles)) + time = np.concatenate(timeslices).ravel() + dataFiles = np.concatenate(dataFiles).ravel() if time.size == 1 and time[0] is None: time[0] = 0 time_origin = TimeConverter(time[0])