Commit 763b7be1 authored by benjaminpillot's avatar benjaminpillot
Browse files

Change Pool.map for Pool.imap (better with use of chunksize)

parent 35606f78
......@@ -55,11 +55,11 @@ def _windowing(raster, out_file, function, band, window_size,
int(len(window_generator) % chunk_size != 0),
desc="Sliding window computation"):
with mp.Pool(processes=nb_processes) as pool:
output = np.asarray(list(pool.map(partial(_set_nan,
function=function,
no_data=raster.no_data),
win_gen,
chunksize=MP_CHUNK_SIZE)))
output = np.asarray(list(pool.imap(partial(_set_nan,
function=function,
no_data=raster.no_data),
win_gen,
chunksize=MP_CHUNK_SIZE)))
output[np.isnan(output)] = no_data
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment