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
13f2a486
Commit
13f2a486
authored
Mar 21, 2019
by
Mario Chirinos Colunga
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10m
parent
4d38c8ac
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
15 deletions
+67
-15
findProducts.py
geosentinel/findProducts.py
+2
-2
imageMissingData.py
geosentinel/imageMissingData.py
+1
-1
ExtractData.sh
tools/ExtractData.sh
+2
-0
L2AProductListToL3A.sh
tools/L2AProductListToL3A.sh
+12
-0
L2ASCL_AreaProcessing.sh
tools/L2ASCL_AreaProcessing.sh
+9
-10
L2AtoL3AbyDateTile.sh
tools/L2AtoL3AbyDateTile.sh
+39
-0
mergeImages.sh
tools/mergeImages.sh
+2
-2
No files found.
geosentinel/findProducts.py
View file @
13f2a486
...
@@ -59,9 +59,9 @@ def main(argv):
...
@@ -59,9 +59,9 @@ def main(argv):
while
text
!=
"yes"
and
text
!=
"no"
:
while
text
!=
"yes"
and
text
!=
"no"
:
text
=
raw_input
(
"Do you want to download this products to "
+
rawDir
+
" ? (yes, no)"
)
text
=
raw_input
(
"Do you want to download this products to "
+
rawDir
+
" ? (yes, no)"
)
if
text
==
"yes"
:
if
text
==
"yes"
:
#
sentinel.downloadProducts(productList,rawDir)
#sentinel.downloadProducts(productList,rawDir)
print
(
"L1CProductListToL2A.sh "
+
rawDir
+
" "
+
inDir
+
" 1"
)
print
(
"L1CProductListToL2A.sh "
+
rawDir
+
" "
+
inDir
+
" 1"
)
#
os.system("L1CProductListToL2A.sh "+rawDir+" "+inDir+" 1")
#os.system("L1CProductListToL2A.sh "+rawDir+" "+inDir+" 1")
text
=
""
text
=
""
while
text
!=
"yes"
and
text
!=
"no"
:
while
text
!=
"yes"
and
text
!=
"no"
:
text
=
raw_input
(
"Do you want to link this products to "
+
outdir
+
" ? (yes, no)"
)
text
=
raw_input
(
"Do you want to link this products to "
+
outdir
+
" ? (yes, no)"
)
...
...
geosentinel/imageMissingData.py
View file @
13f2a486
...
@@ -49,7 +49,7 @@ def main(argv):
...
@@ -49,7 +49,7 @@ def main(argv):
th
=
float
(
argv
[
3
])
/
100.0
th
=
float
(
argv
[
3
])
/
100.0
if
dataArea
<
th
:
if
dataArea
<
th
:
print
(
"Deleting "
+
argv
[
1
]
+
" "
+
str
(
dataArea
)
+
" < "
+
str
(
th
))
print
(
"Deleting "
+
argv
[
1
]
+
" "
+
str
(
dataArea
)
+
" < "
+
str
(
th
))
#
os.system("rm " + argv[1])
os
.
system
(
"rm "
+
argv
[
1
])
else
:
else
:
print
(
"Keeping "
+
argv
[
1
]
+
" "
+
str
(
dataArea
))
print
(
"Keeping "
+
argv
[
1
]
+
" "
+
str
(
dataArea
))
...
...
tools/ExtractData.sh
View file @
13f2a486
...
@@ -29,6 +29,8 @@ fi
...
@@ -29,6 +29,8 @@ 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
$outDir
unzip
-n
-j
$FILE
*
TCI_10m.jp2
*
TCI_60m.jp2
*
SCL_60m.jp2
-d
$outDir
# unzip -n -j $FILE *TCI_10m.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"
...
...
tools/L2AProductListToL3A.sh
0 → 100755
View file @
13f2a486
#!/bin/sh
#Convert L2A Products to L3A using L2AtoL3C Process
DATE
=
$1
TILE
=
$2
INDIR
=
$3
OUTDIR
=
$4
cd
$INDIR
for
f
in
$(
ls
| egrep
$DATE
.
{
21
}
$TILE
)
echo
$f
done
tools/L2ASCL_AreaProcessing.sh
View file @
13f2a486
...
@@ -26,7 +26,7 @@ wktToShape.py "$wkt" "myshape"
...
@@ -26,7 +26,7 @@ wktToShape.py "$wkt" "myshape"
#1.- Link L2A products
#1.- Link L2A products
echo
"Linking Products..."
echo
${
RED
}
"Linking Products..."
${
NC
}
if
[
!
-d
"L2A"
]
;
then
if
[
!
-d
"L2A"
]
;
then
mkdir
L2A
mkdir
L2A
fi
fi
...
@@ -37,7 +37,7 @@ yes yes | findProducts.py $USERDIR"findProducts.json"
...
@@ -37,7 +37,7 @@ yes yes | findProducts.py $USERDIR"findProducts.json"
#2.- Extract Images
#2.- Extract Images
echo
"Extracting JP2 Images..."
echo
${
RED
}
"Extracting JP2 Images..."
${
NC
}
if
[
!
-d
"jp2"
]
;
then
if
[
!
-d
"jp2"
]
;
then
mkdir
jp2
mkdir
jp2
fi
fi
...
@@ -50,9 +50,8 @@ else
...
@@ -50,9 +50,8 @@ else
L2AProductListExtractData.sh
$USERDIR
"L2A/"
$USERDIR
"jp2/"
4 0
L2AProductListExtractData.sh
$USERDIR
"L2A/"
$USERDIR
"jp2/"
4 0
fi
fi
#3.- Merge Images
#3.- Merge Images
echo
"
\n
Merging Images..."
echo
${
RED
}
"
\n
Merging Images..."
${
NC
}
if
[
$BYTILE
-ne
"0"
]
;
then
if
[
$BYTILE
-ne
"0"
]
;
then
echo
"BY TILE"
echo
"BY TILE"
cd
$USERDIR
"jp2/"
cd
$USERDIR
"jp2/"
...
@@ -73,12 +72,12 @@ else
...
@@ -73,12 +72,12 @@ else
if
[
!
-d
"../out"
]
;
then
if
[
!
-d
"../out"
]
;
then
mkdir
"../out"
mkdir
"../out"
fi
fi
mergeImagesByDirectory.sh
$USERDIR
"jp2/"
$USERDIR
/out/
"
$wkt
"
4
mergeImagesByDirectory.sh
$USERDIR
"jp2/"
$USERDIR
"out/"
"
$wkt
"
4
fi
fi
#4.- Mask raster with shape file
#4.- Mask raster with shape file
echo
"
\n
Applying Mask..."
echo
${
RED
}
"
\n
Applying Mask..."
${
NC
}
if
[
$BYTILE
-ne
"0"
]
;
then
if
[
$BYTILE
-ne
"0"
]
;
then
echo
"BY TILE"
echo
"BY TILE"
...
@@ -116,7 +115,7 @@ else
...
@@ -116,7 +115,7 @@ else
fi
fi
#5.- Delete images with few data
#5.- Delete images with few data
echo
"
\n
Deleting Images..."
echo
${
RED
}
"
\n
Deleting Images..."
${
NC
}
if
[
$BYTILE
-ne
"0"
]
;
then
if
[
$BYTILE
-ne
"0"
]
;
then
echo
"BY TILE"
echo
"BY TILE"
...
@@ -136,7 +135,7 @@ if [ $BYTILE -ne "0" ]; then
...
@@ -136,7 +135,7 @@ if [ $BYTILE -ne "0" ]; then
for
scl
in
$(
ls
*
.tif
)
for
scl
in
$(
ls
*
.tif
)
do
do
fileprefix
=
$(
echo
$scl
|
(
cut
-d
"_"
-f1
)
)
fileprefix
=
$(
echo
$scl
|
(
cut
-d
"_"
-f1
)
)
cp
../
$fileprefix
"_TCI_
60m.tif"
../TCI/
$fileprefix
"_TCI_6
0m.tif"
cp
../
$fileprefix
"_TCI_
10m.tif"
../TCI/
$fileprefix
"_TCI_1
0m.tif"
done
done
cd
$USERDIR
"out/"
cd
$USERDIR
"out/"
...
@@ -157,13 +156,13 @@ else
...
@@ -157,13 +156,13 @@ else
for
scl
in
$(
ls
*
.tif
)
for
scl
in
$(
ls
*
.tif
)
do
do
fileprefix
=
$(
echo
$scl
|
(
cut
-d
"_"
-f1
)
)
fileprefix
=
$(
echo
$scl
|
(
cut
-d
"_"
-f1
)
)
cp
../
$fileprefix
"_TCI_
60m.tif"
../TCI/
$fileprefix
"_TCI_6
0m.tif"
cp
../
$fileprefix
"_TCI_
10m.tif"
../TCI/
$fileprefix
"_TCI_1
0m.tif"
cd
../TCI
cd
../TCI
done
done
fi
fi
#6.-Creating Thumbnails
#6.-Creating Thumbnails
echo
"Creating Thumbnails"
echo
${
RED
}
"Creating Thumbnails"
${
NC
}
if
[
$BYTILE
-ne
"0"
]
;
then
if
[
$BYTILE
-ne
"0"
]
;
then
echo
"BY TILE"
echo
"BY TILE"
cd
$USERDIR
"out/"
cd
$USERDIR
"out/"
...
...
tools/L2AtoL3AbyDateTile.sh
0 → 100755
View file @
13f2a486
#!/bin/sh
#Convert L2A Products to L3A using L2AProductListToL3A Process
DATE
=
$1
TILE
=
$2
INDIR
=
$3
OUTDIR
=
$4
cd
$INDIR
for
f
in
$(
ls
| egrep
$DATE
.
{
21
}
$TILE
)
;
do
TMPDIR
=
MSIL3A_
$DATE
"_"
$TILE
"/"
cd
$OUTDIR
if
[
!
-d
$TMPDIR
"L2A/TCI/"
]
;
then
mkdir
-p
$TMPDIR
"L2A/TCI/"
fi
if
[
!
-d
$TMPDIR
"L2A/SCL/"
]
;
then
mkdir
-p
$TMPDIR
"L2A/SCL/"
fi
JP2DIR
=
$TMPDIR
"GRANULE/L3A_"
$TILE
"_"
$DATE
"/IMG_DATA/R60m/"
if
[
!
-d
$JP2DIR
]
;
then
mkdir
-p
$JP2DIR
fi
cd
..
ln
-s
$INDIR$f
$OUTDIR$TMPDIR
"L2A/"
$f
unzip
-n
-j
$OUTDIR$TMPDIR
"L2A/"
$f
*
TCI_60m.jp2
-d
$OUTDIR$TMPDIR
"L2A/TCI/"
unzip
-n
-j
$OUTDIR$TMPDIR
"L2A/"
$f
*
SCL_60m.jp2
-d
$OUTDIR$TMPDIR
"L2A/SCL/"
echo
$f
done
cd
$OUTDIR$TMPDIR
"L2A/"
L2AtoL3A.py
$OUTDIR$TMPDIR
"L2A/"
tools/mergeImages.sh
View file @
13f2a486
...
@@ -22,7 +22,7 @@ echo $DIRNAME
...
@@ -22,7 +22,7 @@ echo $DIRNAME
for
f
in
$(
ls
)
;
do
echo
${
f
}
;
done
;
for
f
in
$(
ls
)
;
do
echo
${
f
}
;
done
;
#exit
#exit
##------------------------------------------------------------------------------
##------------------------------------------------------------------------------
MERGEDIMAGE
=
$DIRNAME
"_TCI_
6
0m_merged.tif"
MERGEDIMAGE
=
$DIRNAME
"_TCI_
1
0m_merged.tif"
if
[
!
-e
$MERGEDIMAGE
]
;
then
if
[
!
-e
$MERGEDIMAGE
]
;
then
echo
"gdal_merge.py -o "
$MERGEDIMAGE
$(
ls
*
TCI_10m.jp2
)
echo
"gdal_merge.py -o "
$MERGEDIMAGE
$(
ls
*
TCI_10m.jp2
)
gdal_merge.py
-o
$MERGEDIMAGE
$(
ls
*
TCI_10m.jp2
)
gdal_merge.py
-o
$MERGEDIMAGE
$(
ls
*
TCI_10m.jp2
)
...
@@ -30,7 +30,7 @@ else
...
@@ -30,7 +30,7 @@ else
echo
PASSING
$MERGEDIMAGE
FOUND
echo
PASSING
$MERGEDIMAGE
FOUND
fi
fi
CROPEDIMAGE
=
$OUTDIR$DIRNAME
"_TCI_
6
0m.tif"
CROPEDIMAGE
=
$OUTDIR$DIRNAME
"_TCI_
1
0m.tif"
if
[
!
-e
$CROPEDIMAGE
]
;
then
if
[
!
-e
$CROPEDIMAGE
]
;
then
gdal_translate
-projwin
$BOX
-projwin_srs
WGS84
-ot
Byte
-of
GTiff
$MERGEDIMAGE
$CROPEDIMAGE
gdal_translate
-projwin
$BOX
-projwin_srs
WGS84
-ot
Byte
-of
GTiff
$MERGEDIMAGE
$CROPEDIMAGE
else
else
...
...
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