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
3fa28e6d
Commit
3fa28e6d
authored
Oct 22, 2018
by
Mario Chirinos Colunga
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update after crash
parent
61b71a60
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
47 deletions
+117
-47
.rasterWkt.py.swp
geosentinel/.rasterWkt.py.swp
+0
-0
APISentinel.pyc
geosentinel/APISentinel.pyc
+0
-0
findProducts.py
geosentinel/findProducts.py
+1
-1
rasterWkt.py
geosentinel/rasterWkt.py
+15
-12
ExtractData.sh
tools/ExtractData.sh
+15
-8
L2AProductListExtractData.sh
tools/L2AProductListExtractData.sh
+1
-1
L2ASCL_AreaProcessing.sh
tools/L2ASCL_AreaProcessing.sh
+85
-25
No files found.
geosentinel/.rasterWkt.py.swp
0 → 100644
View file @
3fa28e6d
File added
geosentinel/APISentinel.pyc
View file @
3fa28e6d
No preview for this file type
geosentinel/findProducts.py
View file @
3fa28e6d
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
import
sys
,
os
import
sys
,
os
import
json
import
json
sys
.
path
.
append
(
'/home/
geoin
t/GeoSentinel'
)
sys
.
path
.
append
(
'/home/
mario/gi
t/GeoSentinel'
)
from
geosentinel
import
APISentinel
from
geosentinel
import
APISentinel
from
geosentinel
import
polygonToBox
from
geosentinel
import
polygonToBox
...
...
geosentinel/rasterWkt.py
View file @
3fa28e6d
...
@@ -32,28 +32,30 @@ def getPolygonArray(image, wkt_geom):
...
@@ -32,28 +32,30 @@ def getPolygonArray(image, wkt_geom):
# sr.ImportFromWkt(image.GetProjection())
# sr.ImportFromWkt(image.GetProjection())
# shapefile
# shapefile
driverShp
=
ogr
.
GetDriverByName
(
"ESRI Shapefile"
)
#
driverShp = ogr.GetDriverByName("ESRI Shapefile")
data_source
=
driverShp
.
CreateDataSource
(
"myShape.shp"
)
#
data_source = driverShp.CreateDataSource("myShape.shp")
# srs = osr.SpatialReference()
# srs = osr.SpatialReference()
# srs.ImportFromEPSG(4326)
# srs.ImportFromEPSG(4326)
layer
=
data_source
.
CreateLayer
(
"wkt"
,
sr
,
ogr
.
wkbPolygon
)
#
layer = data_source.CreateLayer("wkt", sr, ogr.wkbPolygon)
geometry
=
ogr
.
CreateGeometryFromWkt
(
wkt_geom
)
#
geometry = ogr.CreateGeometryFromWkt(wkt_geom)
feature
=
ogr
.
Feature
(
layer
.
GetLayerDefn
())
#
feature = ogr.Feature(layer.GetLayerDefn())
# feature.SetStyleString("PEN(c:#FF0000,w:5px);")
# feature.SetStyleString("PEN(c:#FF0000,w:5px);")
feature
.
SetGeometry
(
geometry
)
#
feature.SetGeometry(geometry)
layer
.
CreateFeature
(
feature
)
#
layer.CreateFeature(feature)
data_source
=
None
#
data_source = None
rast_ogr_ds
=
ogr
.
GetDriverByName
(
'Memory'
)
.
CreateDataSource
(
'wrk'
)
rast_ogr_ds
=
ogr
.
GetDriverByName
(
'Memory'
)
.
CreateDataSource
(
'out'
)
rast_mem_lyr
=
rast_ogr_ds
.
CreateLayer
(
'poly'
,
srs
=
sr
)
rast_mem_lyr
=
rast_ogr_ds
.
CreateLayer
(
"wkt"
,
sr
,
ogr
.
wkbPolygon
)
# rast_mem_lyr = rast_ogr_ds.CreateLayer( 'poly', srs=sr )
feat
=
ogr
.
Feature
(
rast_mem_lyr
.
GetLayerDefn
()
)
feat
=
ogr
.
Feature
(
rast_mem_lyr
.
GetLayerDefn
()
)
feat
.
SetGeometryDirectly
(
ogr
.
Geometry
(
wkt
=
wkt_geom
)
)
feat
.
SetGeometry
(
ogr
.
CreateGeometryFromWkt
(
wkt_geom
))
# feat.SetGeometryDirectly( ogr.Geometry(wkt = wkt_geom) )
rast_mem_lyr
.
CreateFeature
(
feat
)
rast_mem_lyr
.
CreateFeature
(
feat
)
...
@@ -92,6 +94,7 @@ def rasterWkt(wkt, inputfile, outputfile):
...
@@ -92,6 +94,7 @@ def rasterWkt(wkt, inputfile, outputfile):
Draw WKT Polygon into a Image
Draw WKT Polygon into a Image
'''
'''
print
(
wkt
)
print
(
wkt
)
# return
print
(
inputfile
)
print
(
inputfile
)
print
(
outputfile
)
print
(
outputfile
)
inputImage
=
gdal
.
Open
(
inputfile
)
inputImage
=
gdal
.
Open
(
inputfile
)
...
@@ -145,7 +148,7 @@ def rasterWkt(wkt, inputfile, outputfile):
...
@@ -145,7 +148,7 @@ def rasterWkt(wkt, inputfile, outputfile):
for
b
in
range
(
1
,
output
.
RasterCount
+
1
):
for
b
in
range
(
1
,
output
.
RasterCount
+
1
):
np_input
=
inputImage
.
GetRasterBand
(
b
)
.
ReadAsArray
(
0
,
0
,
cols
,
rows
)
np_input
=
inputImage
.
GetRasterBand
(
b
)
.
ReadAsArray
(
0
,
0
,
cols
,
rows
)
output
.
GetRasterBand
(
b
)
.
SetNoDataValue
(
-
99
)
output
.
GetRasterBand
(
b
)
.
SetNoDataValue
(
-
99
)
output
.
GetRasterBand
(
b
)
.
WriteArray
(
np_
input
)
output
.
GetRasterBand
(
b
)
.
WriteArray
(
np_
polygon
)
output
.
GetRasterBand
(
b
)
.
FlushCache
()
output
.
GetRasterBand
(
b
)
.
FlushCache
()
# output.SetGeoTransform(geotransform)
# output.SetGeoTransform(geotransform)
...
...
tools/ExtractData.sh
View file @
3fa28e6d
#!/bin/sh
#!/bin/sh
FILE
=
$1
FILE
=
$1
JP2DIR
=
$2
#JP2 Output Directory
JP2DIR
=
$2
#JP2 Output Directory
BYTILE
=
${
3
:-
0
}
#S2A_MSIL2A_60170515T162341_N0605_R040_T16QBJ_60170515T163103.zip
#S2A_MSIL2A_60170515T162341_N0605_R040_T16QBJ_60170515T163103.zip
filepattern
=
$(
echo
$FILE
|
cut
-d
"_"
-f6
)
"_"
$(
echo
$FILE
|
cut
-d
"_"
-f3
)
"_"
#T16QBJ_60170515T162341_
filepattern
=
$(
echo
$FILE
|
cut
-d
"_"
-f6
)
"_"
$(
echo
$FILE
|
cut
-d
"_"
-f3
)
"_"
#T16QBJ_60170515T162341_
...
@@ -10,21 +10,28 @@ tile=$(echo $filepattern | cut -d"_" -f1) #T16QBJ
...
@@ -10,21 +10,28 @@ tile=$(echo $filepattern | cut -d"_" -f1) #T16QBJ
datetime
=
$(
echo
$filepattern
|
cut
-d
"_"
-f2
)
#60170515T162341
datetime
=
$(
echo
$filepattern
|
cut
-d
"_"
-f2
)
#60170515T162341
dateText
=
$(
echo
$datetime
|
cut
-d
"T"
-f1
)
#60170515
dateText
=
$(
echo
$datetime
|
cut
-d
"T"
-f1
)
#60170515
if
[
$BYTILE
-ne
"0"
]
;
then
outDir
=
$JP2DIR$tile
"/"
$dateText
if
[
!
-d
$JP2DIR$tile
"/"
]
;
then
mkdir
$JP2DIR$tile
"/"
fi
else
outDir
=
$JP2DIR$dateText
fi
outDir
=
$JP2DIR$dateText
"/"
filePrefix
=
$outDir
"/"
$filepattern
filePrefix
=
$outDir$filepattern
echo
$filePrefix
echo
$filePrefix
echo
$outDir
echo
$outDir
if
[
!
-d
$outDir
]
;
then
if
[
!
-d
$outDir
]
;
then
mkdir
$outDir
mkdir
$outDir
fi
fi
if
[
!
-e
$filePrefix
"TCI_10m.jp2"
-o
!
-e
$filePrefix
"TCI_60m.jp2"
-o
!
-e
$filePrefix
"SCL_60m.jp2"
]
;
then
if
[
!
-e
$filePrefix
"TCI_10m.jp2"
-o
!
-e
$filePrefix
"TCI_60m.jp2"
-o
!
-e
$filePrefix
"SCL_60m.jp2"
]
;
then
unzip
-n
-j
$FILE
*
TCI_10m.jp2
*
TCI_60m.jp2
*
SCL_60m.jp2
-d
$
JP2DIR$dateText
unzip
-n
-j
$FILE
*
TCI_10m.jp2
*
TCI_60m.jp2
*
SCL_60m.jp2
-d
$
outDir
TCI10m
=
$outDir
"L2A_"
$filepattern
"TCI_10m.jp2"
TCI10m
=
$outDir
"
/
L2A_"
$filepattern
"TCI_10m.jp2"
TCI60m
=
$outDir
"L2A_"
$filepattern
"TCI_60m.jp2"
TCI60m
=
$outDir
"
/
L2A_"
$filepattern
"TCI_60m.jp2"
SCL60m
=
$outDir
"L2A_"
$filepattern
"SCL_60m.jp2"
SCL60m
=
$outDir
"
/
L2A_"
$filepattern
"SCL_60m.jp2"
if
[
-e
$TCI10m
]
;
then
if
[
-e
$TCI10m
]
;
then
mv
$TCI10m
$filePrefix
"TCI_10m.jp2"
mv
$TCI10m
$filePrefix
"TCI_10m.jp2"
...
...
tools/L2AProductListExtractData.sh
View file @
3fa28e6d
...
@@ -5,7 +5,7 @@ JOBS=${3:-1}
...
@@ -5,7 +5,7 @@ JOBS=${3:-1}
cd
$PRODCUTSDIR
cd
$PRODCUTSDIR
ls
*
.zip | parallel
--jobs
$JOBS
ExtractData.sh
{}
$JP2DIR
ls
*
.zip | parallel
--jobs
$JOBS
ExtractData.sh
{}
$JP2DIR
1
...
...
tools/L2ASCL_AreaProcessing.sh
View file @
3fa28e6d
This diff is collapsed.
Click to expand it.
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