Skip to content

Commit 6fb46de

Browse files
committed
modify point handling whencores =1
1 parent 709eaae commit 6fb46de

1 file changed

Lines changed: 26 additions & 12 deletions

File tree

oceanval/matchall.py

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,11 +1508,31 @@ def read_csv_simyears(ff, layer = None):
15081508
pbar = tqdm(total=len(paths), position=0, leave=True)
15091509
results = dict()
15101510

1511-
for ff in paths:
1511+
if cores > 1:
1512+
for ff in paths:
1513+
1514+
temp = pool.apply_async(
1515+
mm_match,
1516+
[
1517+
ff,
1518+
model_variable,
1519+
df,
1520+
df_times_new,
1521+
ds_depths,
1522+
point_variable,
1523+
df_all,
1524+
layer,
1525+
],
1526+
)
15121527

1513-
temp = pool.apply_async(
1514-
mm_match,
1515-
[
1528+
results[ff] = temp
1529+
1530+
for k, v in results.items():
1531+
value = v.get()
1532+
pbar.update(1)
1533+
else:
1534+
for ff in paths:
1535+
value = mm_match(
15161536
ff,
15171537
model_variable,
15181538
df,
@@ -1521,14 +1541,8 @@ def read_csv_simyears(ff, layer = None):
15211541
point_variable,
15221542
df_all,
15231543
layer,
1524-
],
1525-
)
1526-
1527-
results[ff] = temp
1528-
1529-
for k, v in results.items():
1530-
value = v.get()
1531-
pbar.update(1)
1544+
)
1545+
pbar.update(1)
15321546

15331547
df_all = list(df_all)
15341548
df_all = [x for x in df_all if x is not None]

0 commit comments

Comments
 (0)