Commit 18b0eb3d authored by Irving David's avatar Irving David

Añadida la parte de descargar las imagenes que no se hayan descargado y...

Añadida la parte de descargar las imagenes que no se hayan descargado y convertirlas a L2A. findProducts.py
parent 8ae0bb49
......@@ -4,7 +4,7 @@
import sys, os
import json
sys.path.append('/home/mario/git/GeoSentinel')
sys.path.append('/home/david/centroGEO/repsat/GeoSentinel/')
from geosentinel import APISentinel
from geosentinel import polygonToBox
......@@ -17,6 +17,7 @@ from datetime import date
# products = sentinel.getProducts(wkt, (startDate, endDate), {"platformname":platform, "cloudcoverpercentage":"[0 TO "+str(cloud)+"]"})
# return products
productsCodes = {"L1C":"L1C","L2A":"L1C"}
def main(argv):
......@@ -33,7 +34,6 @@ def main(argv):
if len(productList)<=0:
print ("No products found with 'Contains' trying with 'Intersects'")
productList = sentinel.getProducts(wkt, (cfg['startDate'], cfg['endDate']), {"platformname":cfg['platform'], "cloudcoverpercentage":"[0 TO "+str(cfg['clouds'])+"]"})
productsCodes = {"L1C":"L1C","L2A":"L1C"}
fileNames = [productList[k]['filename'].replace("SAFE", "zip").replace(productsCodes[cfg['productLevel']], cfg['productLevel']) for k in productList.keys() ]
inDir = cfg["productsDir"]
outdir = cfg["linksDir"]
......@@ -41,6 +41,16 @@ def main(argv):
matchingProducts = set(fileNames).intersection(set(dirList))
print ( str(len(matchingProducts))+" of " + str(len(fileNames)) +" products found.")
rawDir = inDir.replace(cfg['productLevel'],productsCodes[cfg['productLevel']])
print(rawDir)
text =""
while text != "yes" and text != "no":
text = raw_input("Do you want to download this products to "+rawDir+ " ? (yes, no)")
if text=="yes":
sentinel.downloadProducts(productList,rawDir)
print("L1CProductListToL2A.sh "+rawDir+" "+inDir+" 1")
os.system("L1CProductListToL2A.sh "+rawDir+" "+inDir+" 1")
text =""
while text != "yes" and text != "no":
......
......@@ -5,10 +5,10 @@ filename=$1 #L1C Filename /home/geoint/NAS/meridaL1C_2c/S2B_MSIL1C_20181005T1631
basename=${filename##*/} #S2B_MSIL1C_20181005T163129_N0206_R083_T16QBH_20181005T214055.zip
#echo $filename
#echo $basename
Z1=$(echo $(echo $basename | cut -d "_" -f1) | cut -d "/" -f3)
Z2=$(echo $basename | cut -d "_" -f3,4,5,6,7 | cut -d "." -f1)
Z1=$(echo $(echo $basename | cut -d "_" -f1) | cut -d "/" -f3) #S2B
Z2=$(echo $basename | cut -d "_" -f3,4,5,6,7 | cut -d "." -f1) #20181005T163129_N0206_R083_T16QBH_20181005T214055
L2A=$Z1"_MSIL2A_"$Z2
L2A=$Z1"_MSIL2A_"$Z2 #S2B_MSIL2A_20181005T163129_N0206_R083_T16QBH_20181005T214055
#echo $L2A
if [ ! -e $L2A.zip ]; then
echo "Processing: " $filename " into " $L2A.zip
......
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