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
5797d789
Commit
5797d789
authored
Sep 11, 2018
by
Mario Chirinos Colunga
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
find products
parent
44c79b65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
66 deletions
+68
-66
APISentinel.py
geosentinel/APISentinel.py
+68
-66
No files found.
geosentinel/APISentinel.py
View file @
5797d789
...
@@ -19,77 +19,79 @@ from collections import OrderedDict
...
@@ -19,77 +19,79 @@ from collections import OrderedDict
class
APISentinel
(
object
):
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')
>>> 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"})
>>> 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
"""
"""
def
__init__
(
self
,
usernam
,
passw
):
def
__init__
(
self
,
usernam
,
passw
):
"""The constructor Initialize Sentinel Data.
"""The constructor Initialize Sentinel Data.
Args:
Args:
self: The object pointer.
self: The object pointer.
usernam (str): Username, access credentials to https://scihub.copernicus.eu/dhus/#/home.
usernam (str): Username, access credentials to https://scihub.copernicus.eu/dhus/#/home.
passw (str): Password, access credentials to https://scihub.copernicus.eu/dhus/#/home.
passw (str): Password, access credentials to https://scihub.copernicus.eu/dhus/#/home.
Returns:
Returns:
pointer: The object pointer.
pointer: The object pointer.
"""
"""
self
.
username
=
usernam
self
.
username
=
usernam
self
.
password
=
passw
self
.
password
=
passw
self
.
URL_Sentinel
=
'https://scihub.copernicus.eu/dhus'
self
.
URL_Sentinel
=
'https://scihub.copernicus.eu/dhus'
# self.plot_width = 7
# self.plot_width = 7
# self.plot_height = 7
# self.plot_height = 7
# self.intersection_th = 30
# self.intersection_th = 30
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 Sentinel products list that match the search parameters.
"""Gets Sentinel products list that match the search parameters.
Args:
Args:
self (pointer): The object pointer.
self (pointer): The object pointer.
area (str): area of interest using a Polygon in WKT format.
area (str): area of interest using a Polygon in WKT format.
Example:
Example:
"POLYGON((-89.99 21.27,-89.13 21.29,-89.30 20.68,-90.04 20.71,-89.99 21.27))"
"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, e.g. area_relation=[‘Intersects’, ‘Contains’, ‘IsWithin’]
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-
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-
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
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
accepted by the ``date`` parameter can also be used with any other parameters that expect time intervals
(that is:'beginposition', 'endposition',
(that is:'beginposition', 'endposition',
Returns:
Returns:
OrderedDict: Sentinel Product list found.
OrderedDict: Sentinel Product list found.
"""
"""
products_list
=
self
.
api
.
query
(
area
,
date
,
area_relation
=
'Intersects'
,
**
searchParameters
)
return
products_list
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
downloadProducts
(
self
,
products
,
dir
):
"""
Args:
Download product(s) list Sentinel
self (pointer): The object pointer.
products (OrderedDict): Product(s) to download.
Args:
dir (str): destination directory.
self (pointer): The object pointer.
"""
products (OrderedDict): Product(s) to download.
os
.
chdir
(
dir
)
dir (str): destination directory.
# self.api.download_all(products)
"""
os
.
chdir
(
dir
)
# self.api.download_all(products)
for
p
in
products
:
for
p
in
products
:
self
.
api
.
download
(
p
)
self
.
api
.
download
(
p
)
def
filterProducts
(
self
,
productList
):
def
filterProducts
(
self
,
productList
):
#, user_footprint, threshold):
#, user_footprint, threshold):
products
=
productList
.
copy
()
products
=
productList
.
copy
()
for
p
in
productList
:
for
p
in
productList
:
if
productList
[
p
][
'filename'
]
.
find
(
"OPER_PRD"
)
!=
-
1
:
if
productList
[
p
][
'filename'
]
.
find
(
"OPER_PRD"
)
!=
-
1
:
del
products
[
p
]
del
products
[
p
]
# products_down = products_list.copy()
# products_down = products_list.copy()
# products_df = self.api.to_dataframe(products_list)
# products_df = self.api.to_dataframe(products_list)
...
...
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