Commit 0d07a9c9 authored by Cresson Remi's avatar Cresson Remi
Browse files

ADD: app to serialize collections of S2 level 2A or 3A

1 merge request!12ENH: S2A and S3A support
Pipeline #33640 passed with stages
in 1 minute and 50 seconds
Showing with 6 additions and 4 deletions
+6 -4
...@@ -3,13 +3,13 @@ from scenes import drs ...@@ -3,13 +3,13 @@ from scenes import drs
# Arguments # Arguments
parser = argparse.ArgumentParser(description="Test",) parser = argparse.ArgumentParser(description="Test",)
parser.add_argument("--root_dir", nargs='+', help="Root directories containing MS and PAN folders", required=True) parser.add_argument("--root_dirs", nargs='+', help="Root directories containing MS and PAN folders", required=True)
parser.add_argument("--out_pickle", help="Output pickle file", required=True) parser.add_argument("--out_pickle", help="Output pickle file", required=True)
params = parser.parse_args() params = parser.parse_args()
# Get all scenes in the root_dir # Get all scenes in the root_dir
scenes = [] scenes = []
for root_dir in params.root_dir: for root_dir in params.root_dirs:
scenes += drs.get_spot67_scenes(root_dir) scenes += drs.get_spot67_scenes(root_dir)
# Save scenes in a pickle file # Save scenes in a pickle file
......
...@@ -3,14 +3,16 @@ from scenes import utils, sentinel, drs ...@@ -3,14 +3,16 @@ from scenes import utils, sentinel, drs
# Arguments # Arguments
parser = argparse.ArgumentParser(description="Test",) parser = argparse.ArgumentParser(description="Test",)
parser.add_argument("--root_dir", nargs='+', help="Root directories containing S2 archives (.zip)", required=True) parser.add_argument("--root_dirs", nargs='+', help="Root directories containing S2 archives (.zip)", required=True)
parser.add_argument("--out_pickle", help="Output pickle file", required=True) parser.add_argument("--out_pickle", help="Output pickle file", required=True)
parser.add_argument('--level', default='2A', const='2A', nargs='?', choices=['2A', '3A'], help='Product level') parser.add_argument('--level', default='2A', const='2A', nargs='?', choices=['2A', '3A'], help='Product level')
params = parser.parse_args() params = parser.parse_args()
# Get all scenes in the root_dir # Get all scenes in the root_dir
product_type = sentinel.Sentinel23AScene if params.level == '2A' else sentinel.Sentinel23AScene product_type = sentinel.Sentinel23AScene if params.level == '2A' else sentinel.Sentinel23AScene
archives = utils.find_files_in_all_subdirs(pth=params.root_dir, pattern="*.zip", case_sensitive=False) archives = []
for root_dir in params.root_dirs:
archives += utils.find_files_in_all_subdirs(pth=root_dir, pattern="*.zip", case_sensitive=False)
scenes = [product_type(archive=archive) for archive in archives] scenes = [product_type(archive=archive) for archive in archives]
# Save scenes in a pickle file # Save scenes in a pickle file
......
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