Update

parent b7a8c315
...@@ -7,7 +7,7 @@ Install: ...@@ -7,7 +7,7 @@ Install:
Example: Example:
$ python -m doctest -v APISentinel-py $ python -m doctest -v APISentinel.py
""" """
import os import os
...@@ -18,7 +18,7 @@ class APISentinel(object): ...@@ -18,7 +18,7 @@ class APISentinel(object):
Test Case Test Case
>>> sentinel = APISentinel('asalazarg', 'geo135asg') >>> sentinel = APISentinel('asalazarg', 'geo135asg')
>>> dir="make" >>> 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-2"})
>>> print len(products) >>> print len(products)
3 3
>>> sentinel.downloadProducts(products,dir) >>> sentinel.downloadProducts(products,dir)
......
# -*- coding: utf-8 -*-
# @package Tools Sentinel
"""
Example:
$ python -m doctest -v tools.py
"""
import os
class tools(object):
""" Class for Sentinel satellites configuration
Test Case
>>> Files = tools('all')
>>> folder='../../../Documentos/Image_Sentinel'
>>> platform='Sentinel-2'
>>> list_files=Files.findFilesSentinel(folder,platform)
>>> print 'There is/are %d ' % len(list_files) + platform + ' file(s)'
"""
def __init__(self,type):
"""The constructor Initialize Sentinel Data.
Args:
self: The object pointer.
type (str): sentinel product type {all, SM_SLC, SM_GRDF, SM_GRDH, SM_GRDM, IW_SLC, IW_GRDH, IW_GDRM, IW_RAW, EW_SLC, EW_GRDH, EW_GRDM, WV_SLC, WV_GRDM, MSIL1C, OPER_PRD }
Returns:
pointer: The object pointer.
"""
self.product_type=type
self.namfil1 = 'S1A_'
self.namfil2 = 'S1B_'
self.namfil3 = 'S2A_'
self.namfil4 = 'S2B_'
def findFilesSentinel(self,dir,platform):
"""Find Files Sentinel
Args:
self (pointer): The object pointer.
dir (str): destination directory.
platform (str): Type platform Sentinel-1 or Sentinel-2
Returns:
OrderedDict: Sentinel Product list found.
"""
files = os.listdir(dir)
if (self.product_type == "all"):
if platform == 'Sentinel-1' or platform == 'sentinel-1':
self.namfil1
self.namfil2
files = [f for f in files if f.startswith(self.namfil1) or f.startswith(self.namfil2)]
if platform == 'Sentinel-2' or platform == 'sentinel-2':
self.namfil3
self.namfil4
files = [f for f in files if f.startswith(self.namfil3) or f.startswith(self.namfil4)]
if (len(files) == 0):
print"Files not found..."
else:
if platform=="Sentinel-1" or platform=="sentinel-1":
self.namfil1 = 'S1A_'+ self.product_type
self.namfil2 = 'S1B_'+ self.product_type
files = [f for f in files if f.startswith(self.namfil1) or f.startswith(self.namfil2)]
if platform=="Sentinel-2" or platform=="sentinel-2":
self.namfil3 = 'S2A_'+ self.product_type
self.namfil4 = 'S2B_'+ self.product_type
files = [f for f in files if f.startswith(self.namfil3) or f.startswith(self.namfil4)]
if (len(files) == 0):
print"Files not found..."
return files
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