Commit e259e87d authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

find products

parent 03cd55d2
......@@ -48,70 +48,70 @@ class APISentinel(object):
# self.intersection_th = 30
self.api = SentinelAPI(self.username, self.password, self.URL_Sentinel)
def getProducts(self, area, date, searchParameters):
"""Gets Sentinel products list that match the search parameters.
Args:
self (pointer): The object pointer.
area (str): area of interest using a Polygon in WKT format.
Example:
"POLYGON((-89.99 21.27,-89.13 21.29,-89.30 20.68,-90.04 20.71,-89.99 21.27))"
date (str): Initial date and end date.
searchParameters (str): Type platform Sentinel-1 or Sentinel-2, e.g. area_relation=[‘Intersects’, ‘Contains’, ‘IsWithin’]
Other Parameters: Additional keywords can be used to specify other query parameters, e.g. relativeorbitnum-
ber=70. See https://scihub.copernicus.eu/twiki/do/view/SciHubUserGuide/3FullTextSearch for a full list. Ran-
ge values can be passed as two-element tuples, e.g. cloudcoverpercentage=(0, 30). The time interval formats
accepted by the ``date`` parameter can also be used with any other parameters that expect time intervals
(that is:'beginposition', 'endposition',
Returns:
OrderedDict: Sentinel Product list found.
"""
products_list = self.api.query(area, date, area_relation='Intersects', **searchParameters)
return products_list
def downloadProducts(self,products,dir):
"""Download product(s) list Sentinel
def getProducts(self, area, date, searchParameters):
"""Gets Sentinel products list that match the search parameters.
Args:
self (pointer): The object pointer.
products (OrderedDict): Product(s) to download.
dir (str): destination directory.
"""
area (str): area of interest using a Polygon in WKT format.
Example:
"POLYGON((-89.99 21.27,-89.13 21.29,-89.30 20.68,-90.04 20.71,-89.99 21.27))"
date (str): Initial date and end date.
searchParameters (str): Type platform Sentinel-1 or Sentinel-2, e.g. area_relation=[‘Intersects’, ‘Contains’, ‘IsWithin’]
Other Parameters: Additional keywords can be used to specify other query parameters, e.g. relativeorbitnum-
ber=70. See https://scihub.copernicus.eu/twiki/do/view/SciHubUserGuide/3FullTextSearch for a full list. Ran-
ge values can be passed as two-element tuples, e.g. cloudcoverpercentage=(0, 30). The time interval formats
accepted by the ``date`` parameter can also be used with any other parameters that expect time intervals
(that is:'beginposition', 'endposition',
Returns:
OrderedDict: Sentinel Product list found.
"""
products_list = self.api.query(area, date, area_relation='Intersects', **searchParameters)
return products_list
def downloadProducts(self,products,dir):
"""Download product(s) list Sentinel
Args:
self (pointer): The object pointer.
products (OrderedDict): Product(s) to download.
dir (str): destination directory.
"""
os.chdir(dir)
# self.api.download_all(products)
for p in products:
self.api.download(p)
os.chdir(dir)
# self.api.download_all(products)
for p in products:
self.api.download(p)
def filterProducts(self, productList):
#, user_footprint, threshold):
def filterProducts(self, productList):
#, user_footprint, threshold):
products = productList.copy()
for p in productList:
if productList[p]['filename'].find("OPER_PRD") != -1:
del products[p]
# products_down = products_list.copy()
# products_df = self.api.to_dataframe(products_list)
products = productList.copy()
for p in productList:
if productList[p]['filename'].find("OPER_PRD") != -1:
del products[p]
# products_down = products_list.copy()
# products_df = self.api.to_dataframe(products_list)
# polyfootprint = ogr.CreateGeometryFromWkt(user_footprint)
# areafootprint = polyfootprint.GetArea()
# polyfootprint = ogr.CreateGeometryFromWkt(user_footprint)
# areafootprint = polyfootprint.GetArea()
# for i in range(len(products_df)):
# for i in range(len(products_df)):
# inputpoly = ogr.CreateGeometryFromWkt(products_df.footprint[i])
# inputpoly = ogr.CreateGeometryFromWkt(products_df.footprint[i])
# intersectionpoly = polyfootprint.Intersection(inputpoly)
# intersectionpoly = polyfootprint.Intersection(inputpoly)
# intersectionpoly_area = intersectionpoly.GetArea()
# intersectionpoly_area = intersectionpoly.GetArea()
# por_intersection = (intersectionpoly_area * 100) / areafootprint
# por_intersection = (intersectionpoly_area * 100) / areafootprint
# if (por_intersection <= threshold):
# # Deleting element
# del products_down[products_df.uuid[i]]
# if (por_intersection <= threshold):
# # Deleting element
# del products_down[products_df.uuid[i]]
return products
return products
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