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
2cefd271
Commit
2cefd271
authored
Apr 20, 2018
by
Pedro Alfonso Ramirez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unzip
parent
9f209e69
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
16 deletions
+27
-16
ui_utils.py
geosentinel/ui_utils.py
+27
-16
No files found.
geosentinel/ui_utils.py
View file @
2cefd271
...
@@ -35,7 +35,7 @@ Functions:
...
@@ -35,7 +35,7 @@ Functions:
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
import
os
import
os
,
sys
import
zipfile
import
zipfile
from
collections
import
OrderedDict
from
collections
import
OrderedDict
...
@@ -84,13 +84,18 @@ SENTINEL_UNZIP_ARGUMENTS.add_argument("product_type", help="sentinel product typ
...
@@ -84,13 +84,18 @@ SENTINEL_UNZIP_ARGUMENTS.add_argument("product_type", help="sentinel product typ
def
find_files
(
args
):
def
find_files
(
args
):
check_existing_directory
(
args
.
folder
,
2
)
folder
=
args
.
folder
folder
=
args
.
folder
satelite
=
args
.
plattform
satelite
=
args
.
plattform
files
=
os
.
listdir
(
folder
)
files
=
os
.
listdir
(
folder
)
if
(
satelite
==
"Sentinel-1"
):
if
(
satelite
!=
"Sentinel-1"
)
or
(
satelite
!=
"sentinel-1"
)
or
(
satelite
==
"Sentinel-2"
)
or
(
satelite
==
"sentinel-2"
):
print
satelite
+
" not exist"
sys
.
exit
()
else
:
if
(
satelite
==
"Sentinel-1"
)
or
(
satelite
==
"sentinel-1"
):
namfil1
=
'S1A_'
+
args
.
product_type
namfil1
=
'S1A_'
+
args
.
product_type
namfil2
=
'S1B_'
+
args
.
product_type
namfil2
=
'S1B_'
+
args
.
product_type
if
(
satelite
==
"S
entinel-2"
):
if
(
satelite
==
"Sentinel-2"
)
or
(
satelite
==
"s
entinel-2"
):
namfil1
=
'S2A_'
+
args
.
product_type
namfil1
=
'S2A_'
+
args
.
product_type
namfil2
=
'S2B_'
+
args
.
product_type
namfil2
=
'S2B_'
+
args
.
product_type
files
=
[
f
for
f
in
files
if
f
.
startswith
(
namfil1
)
or
f
.
startswith
(
namfil2
)]
files
=
[
f
for
f
in
files
if
f
.
startswith
(
namfil1
)
or
f
.
startswith
(
namfil2
)]
...
@@ -106,13 +111,19 @@ def unzip(list_files,args):
...
@@ -106,13 +111,19 @@ def unzip(list_files,args):
zip_ref
.
extractall
(
args
.
folder
)
# extract file to dir
zip_ref
.
extractall
(
args
.
folder
)
# extract file to dir
zip_ref
.
close
()
# close file
zip_ref
.
close
()
# close file
def
check_existing_directory
(
folder
)
:
def
check_existing_directory
(
folder
,
flag
):
if
(
flag
==
1
):
if
not
os
.
path
.
exists
(
folder
):
if
not
os
.
path
.
exists
(
folder
):
os
.
makedirs
(
folder
)
os
.
makedirs
(
folder
)
print
folder
+
" was created"
print
folder
+
" was created"
else
:
else
:
print
folder
+
" exists "
print
folder
+
" exists "
if
(
flag
==
2
):
if
not
os
.
path
.
exists
(
folder
):
print
folder
+
" not exist"
sys
.
exit
()
def
select_products
(
products_list
,
products_df
,
user_footprint
,
threshold
)
:
def
select_products
(
products_list
,
products_df
,
user_footprint
,
threshold
)
:
...
@@ -144,7 +155,7 @@ def select_products( products_list , products_df, user_footprint, threshold ) :
...
@@ -144,7 +155,7 @@ def select_products( products_list , products_df, user_footprint, threshold ) :
def
download_sentinel_mages
(
args
):
def
download_sentinel_mages
(
args
):
check_existing_directory
(
args
.
output_folder
)
check_existing_directory
(
args
.
output_folder
,
1
)
products
=
SentinelData
()
products
=
SentinelData
()
...
...
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