Commit 5f67ca1e authored by Florian de Boissieu's avatar Florian de Boissieu
Browse files

add geom to temporary file move, remove file filtering for existing files...

add geom to temporary file move, remove file filtering for existing files before running parallel processing
parent 7c117847
......@@ -225,6 +225,7 @@ def S1CalibOrthoWithROI(infile, outfile, roi, demfld, geoid, lut='sigma', orthof
pipe[-1].ExecuteAndWriteOutput()
tmpfile.move(outfile)
tmpfile.with_suffix('.geom').move(outfile.with_suffix('.geom'))
return outfile
else:
......@@ -904,14 +905,8 @@ def s1process(indir, outdir, epsg=None,
if geoid is None:
geoid = download_geoid(cache_dir, verbose)
print('Number of files to process: '+str(len(proc_files)))
print('Reducing to files inside ROI...')
proc_files = [f for f in proc_files if checkRoiInS1Acquisition(f, roi)]
if not overwrite:
print('Remove already existing files...')
outfiles = [ortho_dir / infile.name.replace('.tiff', '_clipped_cal' + lut + '_ortho.tiff') for infile in
proc_files]
proc_files = [f for f, o in zip(proc_files, outfiles) if not o.exists()]
print('Number of files to process: '+str(len(proc_files)))
outfiles = [ortho_dir / infile.name.replace('.tiff', '_clipped_cal' + lut + '_ortho.tiff') for infile in proc_files]
mp_args = [(infile, outfile, roi, dem_dir, geoid, lut, orthofit, overwrite, ram) for infile, outfile in
......@@ -928,7 +923,7 @@ def s1process(indir, outdir, epsg=None,
print('Clip went wrong, file skipped: {}'.format(f))
"""
with mp.Pool(ncores) as pool:
files = pool.starmap(S1CalibOrthoWithROI, mp_args) # 1h for 8 tiles in parallel (8 threads)
files = pool.starmap(S1CalibOrthoWithROI, mp_args, chunksize=1) # 1h for 8 tiles in parallel (8 threads)
proc_files = [x for x in files if x is not None]
else:
......
Markdown is supported
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