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
16363b2d
Commit
16363b2d
authored
Oct 04, 2018
by
Mario Chirinos Colunga
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
find products
parent
5bcea57a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
11 deletions
+33
-11
README.md
README.md
+3
-1
extractL2A.json
examples/extractL2A.json
+12
-0
findproducts.json
examples/findproducts.json
+3
-1
extractData.py
geosentinel/extractData.py
+2
-0
findProducts.py
geosentinel/findProducts.py
+8
-6
ExtractData.sh
tools/ExtractData.sh
+5
-3
No files found.
README.md
View file @
16363b2d
...
@@ -96,7 +96,9 @@ The script works as follows:
...
@@ -96,7 +96,9 @@ The script works as follows:
"endDate"
:
"20181101"
,
"endDate"
:
"20181101"
,
"clouds"
:
"40"
,
"clouds"
:
"40"
,
"productsDir"
:
"/home/geoint/NAS/sentinelImages/L2A/"
,
"productsDir"
:
"/home/geoint/NAS/sentinelImages/L2A/"
,
"linksDir"
:
"/home/geoint/NAs/merida/"
"linksDir"
:
"/home/geoint/NAS/merida/"
,
"username"
:
"esausername"
,
"password"
:
"esapasword"
}
}
...
...
examples/extractL2A.json
0 → 100644
View file @
16363b2d
{
"wkt"
:
"POLYGON((-89.62955474853516 21.05230266883862,-89.55093383789061 21.05230266883862,-89.52930450439452 20.965126493194475,-89.6484375 20.873408465645696,-89.72877502441405 20.95294341625548,-89.65805053710938 21.056788298627097,-89.62955474853516 21.05230266883862))"
,
"platform"
:
"Sentinel-2"
,
"productLevel"
:
"L2A"
,
"startDate"
:
"20181001"
,
"endDate"
:
"20181101"
,
"clouds"
:
"40"
,
"productsDir"
:
"/home/geoint/NAS/sentinelImages/L2A/"
,
"linksDir"
:
"/home/geoint/NAS/merida/"
}
examples/findproducts.json
View file @
16363b2d
...
@@ -6,7 +6,9 @@
...
@@ -6,7 +6,9 @@
"endDate"
:
"20181101"
,
"endDate"
:
"20181101"
,
"clouds"
:
"40"
,
"clouds"
:
"40"
,
"productsDir"
:
"/home/geoint/NAS/sentinelImages/L2A/"
,
"productsDir"
:
"/home/geoint/NAS/sentinelImages/L2A/"
,
"linksDir"
:
"/home/geoint/NAS/merida/"
"linksDir"
:
"/home/geoint/NAS/merida/"
,
"username"
:
"mario-chirinos"
,
"password"
:
"r4nc0r4u"
}
}
geosentinel/extractData.py
0 → 100644
View file @
16363b2d
#!/usr/bin/python
# -*- coding: utf-8 -*-
geosentinel/findProducts.py
View file @
16363b2d
...
@@ -11,12 +11,12 @@ from geosentinel import polygonToBox
...
@@ -11,12 +11,12 @@ from geosentinel import polygonToBox
from
datetime
import
date
from
datetime
import
date
def
findSentinelProducts
(
wkt
,
startDate
,
endDate
,
platform
,
cloud
):
#
def findSentinelProducts(wkt, startDate, endDate, platform, cloud):
sentinel
=
APISentinel
.
APISentinel
(
'asalazarg'
,
'geo135asg'
)
#
sentinel = APISentinel.APISentinel('asalazarg', 'geo135asg')
products
=
sentinel
.
getProducts
(
wkt
,
(
startDate
,
endDate
),
{
"platformname"
:
platform
,
"cloudcoverpercentage"
:
"[0 TO "
+
str
(
cloud
)
+
"]"
})
#
products = sentinel.getProducts(wkt, (startDate, endDate), {"platformname":platform, "cloudcoverpercentage":"[0 TO "+str(cloud)+"]"})
return
products
#
return products
def
main
(
argv
):
def
main
(
argv
):
...
@@ -26,9 +26,11 @@ def main(argv):
...
@@ -26,9 +26,11 @@ def main(argv):
jsonFile
=
open
(
argv
[
1
])
.
read
()
jsonFile
=
open
(
argv
[
1
])
.
read
()
cfg
=
json
.
loads
(
jsonFile
)
cfg
=
json
.
loads
(
jsonFile
)
wkt
=
polygonToBox
.
getWKTPolygonBoundingBox
(
cfg
[
'wkt'
],
True
)
sentinel
=
APISentinel
.
APISentinel
(
cfg
[
'username'
],
cfg
[
'password'
])
productList
=
findSentinelProducts
(
wkt
,
cfg
[
'startDate'
],
cfg
[
'endDate'
],
cfg
[
'platform'
],
cfg
[
'clouds'
])
wkt
=
polygonToBox
.
getWKTPolygonBoundingBox
(
cfg
[
'wkt'
],
True
)
# productList = findSentinelProducts(wkt, cfg['startDate'], cfg['endDate'], cfg['platform'], cfg['clouds'])
productList
=
sentinel
.
getProducts
(
wkt
,
(
cfg
[
'startDate'
],
cfg
[
'endDate'
]),
{
"platformname"
:
cfg
[
'platform'
],
"cloudcoverpercentage"
:
"[0 TO "
+
str
(
cfg
[
'clouds'
])
+
"]"
})
productsCodes
=
{
"L1C"
:
"L1C"
,
"L2A"
:
"L1C"
}
productsCodes
=
{
"L1C"
:
"L1C"
,
"L2A"
:
"L1C"
}
fileNames
=
[
productList
[
k
][
'filename'
]
.
replace
(
"SAFE"
,
"zip"
)
.
replace
(
productsCodes
[
cfg
[
'productLevel'
]],
cfg
[
'productLevel'
])
for
k
in
productList
.
keys
()
]
fileNames
=
[
productList
[
k
][
'filename'
]
.
replace
(
"SAFE"
,
"zip"
)
.
replace
(
productsCodes
[
cfg
[
'productLevel'
]],
cfg
[
'productLevel'
])
for
k
in
productList
.
keys
()
]
inDir
=
cfg
[
"productsDir"
]
inDir
=
cfg
[
"productsDir"
]
...
...
tools/ExtractData.sh
View file @
16363b2d
...
@@ -5,9 +5,11 @@ JP2DIR=$2 #JP2 Output Directory
...
@@ -5,9 +5,11 @@ JP2DIR=$2 #JP2 Output Directory
#S2A_MSIL2A_20170515T162341_N0205_R040_T16QBJ_20170515T163103.zip
#S2A_MSIL2A_20170515T162341_N0205_R040_T16QBJ_20170515T163103.zip
filepattern
=
$(
echo
$FILE
|
cut
-d
"_"
-f6
)
"_"
$(
echo
$FILE
|
cut
-d
"_"
-f3
)
"_"
#T16QBJ_20170515T162341_
filepattern
=
$(
echo
$FILE
|
cut
-d
"_"
-f6
)
"_"
$(
echo
$FILE
|
cut
-d
"_"
-f3
)
"_"
#T16QBJ_20170515T162341_
tile
=
$(
echo
$filepattern
|
cut
-d
"_"
-f1
)
#T16QBJ
productType
=
$(
echo
$filepattern
|
cut
-d
"_"
-f2
)
#MSIL2A
datetime
=
$(
echo
$filepattern
|
cut
-d
"_"
-f2
)
#20170515T162341
tile
=
$(
echo
$filepattern
|
cut
-d
"_"
-f1
)
#T16QBJ
dateText
=
$(
echo
$datetime
|
cut
-d
"T"
-f1
)
#20170515
datetime
=
$(
echo
$filepattern
|
cut
-d
"_"
-f2
)
#20170515T162341
dateText
=
$(
echo
$datetime
|
cut
-d
"T"
-f1
)
#20170515
outDir
=
$JP2DIR$dateText
"/"
outDir
=
$JP2DIR$dateText
"/"
filePrefix
=
$outDir$filepattern
filePrefix
=
$outDir$filepattern
...
...
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