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
5c7105be
Commit
5c7105be
authored
May 09, 2018
by
Alfonso Ramire Pedraza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Alfonso
parent
4fbf44c4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
65 deletions
+46
-65
APISentinel.py
geosentinel/APISentinel.py
+46
-65
APISentinel.pyc
geosentinel/APISentinel.pyc
+0
-0
No files found.
geosentinel/APISentinel.py
View file @
5c7105be
# Copyright (C) 2018 Adan Salazar <asalazargaribay@gmail.com>
#
#
# This file is part of GeoSentinel
#
#
# GeoSentinel is free software you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GeoSentinel is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with StereoVision. If not, see <http://www.gnu.org/licenses/>.
#
#
#Variables:
#
# * Constructor __init__
# * Into:
# * Access credentials to https://scihub.copernicus.eu/dhus/#/home
# * Username
# * Password
# * Output:
# * api Sentinel
#
# * "getProducts"
# * Into:
# * Area or Polygon
# * Date
# * searchParameters
#
# Other Parameters
# ----------------
# Additional keywords can be used to specify other query parameters,
# e.g. relativeorbitnumber=70.
# See https://scihub.copernicus.eu/twiki/do/view/SciHubUserGuide/3FullTextSearch
# for a full list.
# Range 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 (that is: 'beginposition', 'endposition',
#
# * Output:
# * Products_list
#
# * "downloadProducts"
# * Into:
# * products list
# * dir
# * Output:
# * Save images into dir
#
#Functions:
#
# * "getProducts" - Find Sentinel files in URL
# * "downloadProducts" - Download list files Sentinel
# -*- coding: utf-8 -*-
# @package Download Image Sentinel
"""
Install:
$ pip install sentinelsat
Example:
$ python -m doctest -v APISentinel-py
"""
import
os
from
sentinelsat.sentinel
import
SentinelAPI
# from geosentinel.ui_utils import check_existing_directory
# from collections import OrderedDict
from
datetime
import
date
class
APISentinel
(
object
):
""" Class for Sentinel satellites configuration
...
...
@@ -77,8 +26,15 @@ class APISentinel(object):
"""
def
__init__
(
self
,
usernam
,
passw
):
"""
Initialize Sentinel Data.
"""The constructor Initialize Sentinel Data.
Args:
param1 (pointer): The object pointer.
param2 (str): Username, access credentials to https://scihub.copernicus.eu/dhus/#/home.
param3 (str): Password, access credentials to https://scihub.copernicus.eu/dhus/#/home.
Returns:
pointer: The object pointer.
"""
self
.
username
=
usernam
self
.
password
=
passw
...
...
@@ -90,10 +46,35 @@ class APISentinel(object):
self
.
api
=
SentinelAPI
(
self
.
username
,
self
.
password
,
self
.
URL_Sentinel
)
def
getProducts
(
self
,
area
,
date
,
searchParameters
):
"""Gets products list Sentinel
Args:
param1 (pointer): The object pointer.
param2 (str): Area to find images.
param3 (str): Init date and end date.
param4 (str): Type platform Sentinel-1 or Sentinel-2
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-
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
(that is:'beginposition', 'endposition',
Returns:
str: Product list Sentinel found.
"""
products_list
=
self
.
api
.
query
(
area
,
date
,
**
searchParameters
)
return
products_list
def
downloadProducts
(
self
,
products
,
dir
):
"""Download product(s) list Sentinel
Args:
param1 (pointer): The object pointer.
param2 (str): Product(s) list Sentinel found.
param3 (str): Local path to save download files.
Returns:
Save Sentinel files.
"""
os
.
chdir
(
dir
)
self
.
api
.
download_all
(
products
)
geosentinel/APISentinel.pyc
View file @
5c7105be
No preview for this file type
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