Update

parent dc24cac1
...@@ -17,7 +17,7 @@ class APISentinel(object): ...@@ -17,7 +17,7 @@ class APISentinel(object):
""" Class for Sentinel satellites configuration """ Class for Sentinel satellites configuration
Test Case Test Case
>>> sentinel = APISentinel('asalazarg', 'geo135asg') >>> sentinel = APISentinel('asalazarg', 'geo135asg')
>>> dir="../../../Documentos/Image_Sentinel" >>> dir="make"
>>> products = sentinel.getProducts("POLYGON((-89.99450683593753 21.279137394108716,-89.13757324218751 21.2996106049456,-89.30236816406251 20.68418377935238,-90.0494384765625 20.715015145512098,-89.99450683593753 21.279137394108716))", ('20151219', date(2015,12,29)), {"platformname":"Sentinel-1"}) >>> products = sentinel.getProducts("POLYGON((-89.99450683593753 21.279137394108716,-89.13757324218751 21.2996106049456,-89.30236816406251 20.68418377935238,-90.0494384765625 20.715015145512098,-89.99450683593753 21.279137394108716))", ('20151219', date(2015,12,29)), {"platformname":"Sentinel-1"})
>>> print len(products) >>> print len(products)
3 3
...@@ -46,13 +46,14 @@ class APISentinel(object): ...@@ -46,13 +46,14 @@ class APISentinel(object):
self.api = SentinelAPI(self.username, self.password, self.URL_Sentinel) self.api = SentinelAPI(self.username, self.password, self.URL_Sentinel)
def getProducts(self, area, date, searchParameters): def getProducts(self, area, date, searchParameters):
"""Gets products list Sentinel """Gets Sentinel products list that match the search parameters.
Args: Args:
self (pointer): The object pointer. self (pointer): The object pointer.
area (str): Polygon WKT to find images. area (str): area of interest using a Polygon in WKT format.
Example: Example:
args.footprint = geojson_to_wkt(read_geojson(path_json)) "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. date (str): Initial date and end date.
searchParameters (str): Type platform Sentinel-1 or Sentinel-2 searchParameters (str): Type platform Sentinel-1 or Sentinel-2
Other Parameters: Additional keywords can be used to specify other query parameters, e.g. relativeorbitnum- Other Parameters: Additional keywords can be used to specify other query parameters, e.g. relativeorbitnum-
...@@ -62,7 +63,7 @@ class APISentinel(object): ...@@ -62,7 +63,7 @@ class APISentinel(object):
(that is:'beginposition', 'endposition', (that is:'beginposition', 'endposition',
Returns: Returns:
OrderdDict: Product list Sentinel found. OrderedDict: Sentinel Product list found.
""" """
products_list = self.api.query(area, date, **searchParameters) products_list = self.api.query(area, date, **searchParameters)
return products_list return products_list
...@@ -72,11 +73,8 @@ class APISentinel(object): ...@@ -72,11 +73,8 @@ class APISentinel(object):
Args: Args:
self (pointer): The object pointer. self (pointer): The object pointer.
products (str): Product(s) list Sentinel found. products (OrderedDict): Product(s) to download.
dir (str): Local path to save download files. dir (str): destination directory.
Returns:
Save Sentinel files.
""" """
os.chdir(dir) os.chdir(dir)
self.api.download_all(products) self.api.download_all(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