Commit 7c117847 authored by Florian de Boissieu's avatar Florian de Boissieu
Browse files

add file filtering for out of ROI and existing files, before running parallel processing

parent 2a5ecb59
...@@ -237,8 +237,8 @@ def checkRoiInS1Acquisition(s1file, roifile): ...@@ -237,8 +237,8 @@ def checkRoiInS1Acquisition(s1file, roifile):
in_geom = getS1ExtentGeometry(s1file) in_geom = getS1ExtentGeometry(s1file)
isIntersecting = in_geom.Intersects(roi_geom) isIntersecting = in_geom.Intersects(roi_geom)
dsv = None dsv = None
print(roi_geom.ExportToWkt()) # print(roi_geom.ExportToWkt())
print(in_geom.ExportToWkt()) # print(in_geom.ExportToWkt())
return isIntersecting return isIntersecting
def preClip(infile, outfile, roi_buffered_vector, overwrite=False, verbose=True, ram=1024): def preClip(infile, outfile, roi_buffered_vector, overwrite=False, verbose=True, ram=1024):
...@@ -904,6 +904,15 @@ def s1process(indir, outdir, epsg=None, ...@@ -904,6 +904,15 @@ def s1process(indir, outdir, epsg=None,
if geoid is None: if geoid is None:
geoid = download_geoid(cache_dir, verbose) 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] 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 mp_args = [(infile, outfile, roi, dem_dir, geoid, lut, orthofit, overwrite, ram) for infile, outfile in
zip(proc_files, outfiles)] zip(proc_files, outfiles)]
......
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