Commit 6bac800d authored by Pedro Alfonso Ramirez's avatar Pedro Alfonso Ramirez

Add unzip

parent 05009680
...@@ -51,8 +51,8 @@ from geosentinel.products import SentinelData ...@@ -51,8 +51,8 @@ from geosentinel.products import SentinelData
def check_existing_productType(product,flag): def check_existing_productType(product,flag):
if(flag==1): if(flag==1):
plattform=['Sentinel-1', 'sentinel-1', 'Sentinel-2', 'sentinel-2'] product_type=['Sentinel-1', 'sentinel-1', 'Sentinel-2', 'sentinel-2']
findProduct = product in plattform findProduct = product in product_type
if not findProduct: if not findProduct:
print product + " not exist" print product + " not exist"
sys.exit() sys.exit()
...@@ -64,24 +64,23 @@ def check_existing_productType(product,flag): ...@@ -64,24 +64,23 @@ def check_existing_productType(product,flag):
sys.exit() sys.exit()
def find_files_Sentinel(args): def find_files_Sentinel(args):
folder = args.folder check_existing_directory(args.folder, 2)
satellite = args.plattform check_existing_productType(args.satellite, 1)
product_typ = args.product_type check_existing_productType(args.product_typ, 2)
check_existing_directory(folder, 2)
check_existing_productType(satellite, 1)
check_existing_productType(product_typ, 2)
files = os.listdir(folder) files = os.listdir(folder)
if (args.product_type == "all"): if (args.product_type == "all"):
namfil1 = 'S1A_' if args.satellite == 'Sentinel-1' or args.satellite == 'sentinel-1':
namfil2 = 'S1B_' namfil1 = 'S1A_'
namfil3 = 'S2A_' namfil2 = 'S1B_'
namfil4 = 'S2B_' if args.satellite == 'Sentinel-2' or args.satellite == 'sentinel-2':
namfil3 = 'S2A_'
namfil4 = 'S2B_'
files = [f for f in files if f.startswith(namfil1) or f.startswith(namfil2) or f.startswith(namfil3) or f.startswith(namfil4)] files = [f for f in files if f.startswith(namfil1) or f.startswith(namfil2) or f.startswith(namfil3) or f.startswith(namfil4)]
else: else:
if(satellite=="Sentinel-1")or(satellite=="sentinel-1"): if args.satellite=="Sentinel-1" or args.satellite=="sentinel-1":
namfil1 = 'S1A_'+ args.product_type namfil1 = 'S1A_'+ args.product_type
namfil2 = 'S1B_'+ args.product_type namfil2 = 'S1B_'+ args.product_type
if(satellite=="Sentinel-2")or(satellite=="sentinel-2"): if args.satellite=="Sentinel-2" or args.satellite=="sentinel-2":
namfil1 = 'S2A_'+ args.product_type namfil1 = 'S2A_'+ args.product_type
namfil2 = 'S2B_'+ args.product_type namfil2 = 'S2B_'+ args.product_type
files = [f for f in files if f.startswith(namfil1) or f.startswith(namfil2)] files = [f for f in files if f.startswith(namfil1) or f.startswith(namfil2)]
......
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