Update

parent dd1c1ac4
# -*- coding: utf-8 -*-
# @package UnZip Sentinel Files
"""
Example:
$ python -m doctest -v UnZip.py
"""
import zipfile
from tools import (tools)
class UnZip(object):
""" Class for Sentinel satellites configuration
Test Case
>>> Files = tools('IW_SLC')
>>> dir='make'
>>> platform='Sentinel-1'
>>> list_files=Files.findFilesSentinel(dir,platform)
>>> print 'There is/are %d ' % len(list_files) + platform + ' file(s)'
>>> unzip=UnZip(dir)
>>> unzip.unzip_files_Sentinel(list_files)
"""
def __init__(self,folder):
"""The constructor Initialize Sentinel Data.
Args:
self: The object pointer.
folder (str): destination directory.
Returns:
pointer: The object pointer.
"""
self.dir=folder
def unzip_files_Sentinel(self,list_files):
#def findFilesSentinel(self,dir,platform):
"""UnZip Files Sentinel
Args:
self (pointer): The object pointer.
OrderedDict: Sentinel Product list found.
"""
for image in list_files:
print"Unzziped... ", image
File = self.dir + "/" + image
zip_ref = zipfile.ZipFile(File) # create zipfile object
zip_ref.extractall(self.dir) # extract file to dir
zip_ref.close() # close file
...@@ -11,9 +11,9 @@ class tools(object): ...@@ -11,9 +11,9 @@ class tools(object):
""" Class for Sentinel satellites configuration """ Class for Sentinel satellites configuration
Test Case Test Case
>>> Files = tools('all') >>> Files = tools('all')
>>> folder='../../../Documentos/Image_Sentinel' >>> dir='make'
>>> platform='Sentinel-2' >>> platform='Sentinel-2'
>>> list_files=Files.findFilesSentinel(folder,platform) >>> list_files=Files.findFilesSentinel(dir,platform)
>>> print 'There is/are %d ' % len(list_files) + platform + ' file(s)' >>> print 'There is/are %d ' % len(list_files) + platform + ' file(s)'
""" """
......
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