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
4fbf44c4
Commit
4fbf44c4
authored
May 09, 2018
by
Alfonso Ramire Pedraza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Alfonso
parent
595b6e78
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
3 deletions
+108
-3
APISentinel.py
geosentinel/APISentinel.py
+99
-0
APISentinel.pyc
geosentinel/APISentinel.pyc
+0
-0
arguments.py
geosentinel/arguments.py
+6
-0
ui_utils.py
geosentinel/ui_utils.py
+3
-3
No files found.
geosentinel/APISentinel.py
0 → 100644
View file @
4fbf44c4
# 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
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
Test Case
>>> sentinel = APISentinel('asalazarg', 'geo135asg')
>>> dir="../../../Documentos/Image_Sentinel"
>>> 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"})
>>> print len(products)
3
>>> sentinel.downloadProducts(products,dir)
"""
def
__init__
(
self
,
usernam
,
passw
):
"""
Initialize Sentinel Data.
"""
self
.
username
=
usernam
self
.
password
=
passw
self
.
URL_Sentinel
=
'https://scihub.copernicus.eu/dhus'
# self.plot_width = 7
# self.plot_height = 7
# self.intersection_th = 30
self
.
api
=
SentinelAPI
(
self
.
username
,
self
.
password
,
self
.
URL_Sentinel
)
def
getProducts
(
self
,
area
,
date
,
searchParameters
):
products_list
=
self
.
api
.
query
(
area
,
date
,
**
searchParameters
)
return
products_list
def
downloadProducts
(
self
,
products
,
dir
):
os
.
chdir
(
dir
)
self
.
api
.
download_all
(
products
)
geosentinel/APISentinel.pyc
0 → 100644
View file @
4fbf44c4
File added
geosentinel/arguments.py
View file @
4fbf44c4
...
...
@@ -40,6 +40,12 @@ SENTINEL_ARGUMENTS.add_argument("overlap", type=int, help="Percentage of overlap
SENTINEL_ARGUMENTS
.
add_argument
(
"output_folder"
,
help
=
"Folder to download Sentinel files "
)
SENTINEL_ARGUMENTS
.
add_argument
(
"username"
,
help
=
"User name platform to download Sentinel files"
)
SENTINEL_ARGUMENTS
.
add_argument
(
"password"
,
help
=
"Password platform to download Sentinel files"
)
SENTINEL_ARGUMENTS
.
add_argument
(
"input_file"
,
help
=
"file geojson local path"
)
SENTINEL_FIND_ARGUMENTS
=
ArgumentParser
(
add_help
=
False
)
...
...
geosentinel/ui_utils.py
View file @
4fbf44c4
...
...
@@ -44,11 +44,11 @@ import zipfile
from
collections
import
OrderedDict
from
osgeo
import
ogr
#
from osgeo import ogr
from
osgeo
import
gdal
#
from osgeo import gdal
from
osgeo.gdalconst
import
*
#
from osgeo.gdalconst import *
from
sentinelsat.sentinel
import
SentinelAPI
#read_geojson, geojson_to_wkt
...
...
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