drs_search.py 741 bytes
import argparse
import scenes.indexation as indexation
import gdal
import scenes.utils as utils
import scenes.drs as drs

# Arguments
parser = argparse.ArgumentParser(description="Test",)
parser.add_argument("--root_dir", help="Root directory containing MS and PAN folders", required=True)
parser.add_argument("--roi", required=True)
params = parser.parse_args()

# Find pairs of DIMAPS
scenes = drs.get_spot67_scenes(params.root_dir)

# spatial index
print("Indexation...")
idx = indexation.Index(scenes)

# search
print("search roi")
gdal_ds = gdal.Open(params.roi)
bbox = utils.get_bbox_wgs84(gdal_ds)
matches = idx.find(bbox_wgs84=bbox)
print("{} scenes found.".format(len(matches)))
#for scene_match in matches:
#    print(scene_match)