Commit 414ebd0c authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

find products

parent a7c1c564
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
sys.path.append('../')
from geosentinel import APISentinel
from datetime import date
def findSentinelProducts():
def main(argv):
if len(sys.argv) == 2:
print (getWKTPolygonBoundingBox(argv[1]))
if len(sys.argv) == 3:
print (getWKTPolygonBoundingBox(argv[1], argv[2]))
if __name__ == "__main__":
main(sys.argv)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os
from contextlib import contextmanager
sys.path.append('../')
from geosentinel import APISentinel
from datetime import date
@contextmanager
def suppress_stdout():
with open(os.devnull, "w") as devnull:
old_stdout = sys.stdout
sys.stdout = devnull
try:
yield
finally:
sys.stdout = old_stdout
def findSentinelProducts(wkt, startDate, endDate, platform, cloud):
sentinel = APISentinel.APISentinel('asalazarg', 'geo135asg')
products = sentinel.getProducts(wkt, (startDate, endDate), {"platformname":platform, "cloudcoverpercentage":"[0 TO "+str(cloud)+"]"})
list = [k for k in products.keys()]
return list
def main(argv):
if len(sys.argv) != 6:
print("Usage")
else:
with suppress_stdout():
list = findSentinelProducts(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
for l in list:
print l
if __name__ == "__main__":
main(sys.argv)
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