Skip to content

Commit 2f7b77a

Browse files
philippemironPhilippe Miron
andauthored
make sure all elements are Iterable (#177)
Co-authored-by: Philippe Miron <[email protected]>
1 parent d7ce728 commit 2f7b77a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clouddrift/analysis.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import numpy as np
2-
from typing import Optional, Tuple, Union
2+
from typing import Optional, Tuple, Union, Iterable
33
import xarray as xr
44
import pandas as pd
55
from concurrent import futures
@@ -90,7 +90,8 @@ def apply_ragged(
9090
with futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
9191
res = executor.map(lambda x: func(*x, **kwargs), iter)
9292
# concatenate the outputs
93-
res = list(res)
93+
res = [item if isinstance(item, Iterable) else [item] for item in res]
94+
9495
if isinstance(res[0], tuple): # more than 1 parameter
9596
outputs = []
9697
for i in range(len(res[0])):

0 commit comments

Comments
 (0)