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
98a3c061
Commit
98a3c061
authored
Oct 03, 2018
by
Mario Chirinos Colunga
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
links
parent
cfc29317
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
38 deletions
+85
-38
ExtractData.sh
tools/ExtractData.sh
+44
-0
L2AProductListExtractData.sh
tools/L2AProductListExtractData.sh
+41
-38
No files found.
tools/ExtractData.sh
0 → 100755
View file @
98a3c061
#!/bin/sh
FILE
=
$1
#Products Intput directory
JP2DIR
=
$2
#JP2 Output Directory
#S2A_MSIL2A_20170515T162341_N0205_R040_T16QBJ_20170515T163103.zip
filepattern
=
$(
echo
$FILE
|
cut
-d
"_"
-f6
)
"_"
$(
echo
$FILE
|
cut
-d
"_"
-f3
)
"_"
#T16QBJ_20170515T162341_
tile
=
$(
echo
$FILEilepattern
|
cut
-d
"_"
-f1
)
#T16QBJ
datetime
=
$(
echo
$FILEilepattern
|
cut
-d
"_"
-f2
)
#20170515T162341
dateText
=
$(
echo
$datetime
|
cut
-d
"T"
-f1
)
#20170515
outDir
=
$JP2DIR$dateText
"/"
filePrefix
=
$outDir$FILEilepattern
echo
$FILEilePrefix
echo
$outDir
if
[
!
-d
$outDir
]
;
then
mkdir
$outDir
fi
if
[
!
-e
$FILEilePrefix
"TCI_10m.jp2"
-o
!
-e
$FILEilePrefix
"TCI_20m.jp2"
-o
!
-e
$FILEilePrefix
"SCL_20m.jp2"
]
;
then
unzip
-n
-j
$FILE
*
TCI_10m.jp2
*
TCI_20m.jp2
*
SCL_20m.jp2
-d
$JP2DIR$dateText
TCI10m
=
$outDir
"L2A_"
$FILEilepattern
"TCI_10m.jp2"
TCI20m
=
$outDir
"L2A_"
$FILEilepattern
"TCI_20m.jp2"
SCL20m
=
$outDir
"L2A_"
$FILEilepattern
"SCL_20m.jp2"
if
[
-e
$TCI10m
]
;
then
mv
$TCI10m
$FILEilePrefix
"TCI_10m.jp2"
fi
if
[
-e
$TCI20m
]
;
then
mv
$TCI20m
$FILEilePrefix
"TCI_20m.jp2"
fi
if
[
-e
$SCL20m
]
;
then
mv
$SCL20m
$FILEilePrefix
"SCL_20m.jp2"
fi
else
echo
PASS
$FILE
fi
tools/L2AProductListExtractData.sh
View file @
98a3c061
...
@@ -4,44 +4,47 @@ JP2DIR=$2 #JP2 Output Directory
...
@@ -4,44 +4,47 @@ JP2DIR=$2 #JP2 Output Directory
cd
$PRODCUTSDIR
cd
$PRODCUTSDIR
for
f
in
$(
ls
*
.zip
)
do
ls
*
.zip | parallel ExtractData.sh
{}
$JP2DIR
#S2A_MSIL2A_20170515T162341_N0205_R040_T16QBJ_20170515T163103.zip
filepattern
=
$(
echo
$f
|
cut
-d
"_"
-f6
)
"_"
$(
echo
$f
|
cut
-d
"_"
-f3
)
"_"
#T16QBJ_20170515T162341_
#for f in $(ls *.zip)
#do
tile
=
$(
echo
$filepattern
|
cut
-d
"_"
-f1
)
#T16QBJ
# #S2A_MSIL2A_20170515T162341_N0205_R040_T16QBJ_20170515T163103.zip
datetime
=
$(
echo
$filepattern
|
cut
-d
"_"
-f2
)
#20170515T162341
# filepattern=$(echo $f | cut -d"_" -f6)"_"$(echo $f | cut -d"_" -f3)"_" #T16QBJ_20170515T162341_
dateText
=
$(
echo
$datetime
|
cut
-d
"T"
-f1
)
#20170515
# tile=$(echo $filepattern | cut -d"_" -f1) #T16QBJ
outDir
=
$JP2DIR$dateText
"/"
# datetime=$(echo $filepattern | cut -d"_" -f2) #20170515T162341
filePrefix
=
$outDir$filepattern
# dateText=$(echo $datetime | cut -d"T" -f1) #20170515
echo
$filePrefix
# outDir=$JP2DIR$dateText"/"
echo
$outDir
# filePrefix=$outDir$filepattern
if
[
!
-d
$outDir
]
;
then
mkdir
$outDir
# echo $filePrefix
fi
# echo $outDir
if
[
!
-e
$filePrefix
"TCI_10m.jp2"
-o
!
-e
$filePrefix
"TCI_20m.jp2"
-o
!
-e
$filePrefix
"SCL_20m.jp2"
]
;
then
# if [ ! -d $outDir ]; then
# mkdir $outDir
unzip
-n
-j
$f
*
TCI_10m.jp2
*
TCI_20m.jp2
*
SCL_20m.jp2
-d
$JP2DIR$dateText
# fi
TCI10m
=
$outDir
"L2A_"
$filepattern
"TCI_10m.jp2"
# if [ ! -e $filePrefix"TCI_10m.jp2" -o ! -e $filePrefix"TCI_20m.jp2" -o ! -e $filePrefix"SCL_20m.jp2" ]; then
TCI20m
=
$outDir
"L2A_"
$filepattern
"TCI_20m.jp2"
SCL20m
=
$outDir
"L2A_"
$filepattern
"SCL_20m.jp2"
# unzip -n -j $f *TCI_10m.jp2 *TCI_20m.jp2 *SCL_20m.jp2 -d $JP2DIR$dateText
# TCI10m=$outDir"L2A_"$filepattern"TCI_10m.jp2"
if
[
-e
$TCI10m
]
;
then
# TCI20m=$outDir"L2A_"$filepattern"TCI_20m.jp2"
mv
$TCI10m
$filePrefix
"TCI_10m.jp2"
# SCL20m=$outDir"L2A_"$filepattern"SCL_20m.jp2"
fi
if
[
-e
$TCI20m
]
;
then
# if [ -e $TCI10m ]; then
mv
$TCI20m
$filePrefix
"TCI_20m.jp2"
# mv $TCI10m $filePrefix"TCI_10m.jp2"
fi
# fi
if
[
-e
$SCL20m
]
;
then
# if [ -e $TCI20m ]; then
mv
$SCL20m
$filePrefix
"SCL_20m.jp2"
# mv $TCI20m $filePrefix"TCI_20m.jp2"
fi
# fi
else
# if [ -e $SCL20m ]; then
echo
PASS
$f
# mv $SCL20m $filePrefix"SCL_20m.jp2"
fi
# fi
# else
done
# echo PASS $f
# fi
#done
...
...
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