Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoSentinel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoSentinel
Commits
dd1c1ac4
Commit
dd1c1ac4
authored
May 09, 2018
by
Alfonso Ramire Pedraza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update
parent
b7a8c315
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
2 deletions
+77
-2
APISentinel.py
geosentinel/APISentinel.py
+2
-2
tools.py
geosentinel/tools.py
+75
-0
No files found.
geosentinel/APISentinel.py
View file @
dd1c1ac4
...
@@ -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)
...
...
geosentinel/tools.py
0 → 100644
View file @
dd1c1ac4
# -*- 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment