Skip to content

Commit

Permalink
Fixing numpy deprecationwarning in timeslices concatenation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
erikvansebille committed Aug 1, 2022
1 parent d7b3848 commit 7541a07
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions parcels/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 7541a07

Please sign in to comment.