Commit 1b7b4383 authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

links

parent c040b4e2
#!/bin/sh
FILE=$1 #Products Intput directory
FILE=$1
JP2DIR=$2 #JP2 Output Directory
echo $FILE
#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
tile=$(echo $filepattern | cut -d"_" -f1) #T16QBJ
datetime=$(echo $filepattern | cut -d"_" -f2) #20170515T162341
dateText=$(echo $datetime | cut -d"T" -f1) #20170515
outDir=$JP2DIR$dateText"/"
filePrefix=$outDir$FILEilepattern
filePrefix=$outDir$filepattern
echo $FILEilePrefix
echo $filePrefix
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
if [ ! -e $filePrefix"TCI_10m.jp2" -o ! -e $filePrefix"TCI_20m.jp2" -o ! -e $filePrefix"SCL_20m.jp2" ]; then
unzip -n -j $FILE *TCI_10m.jp2 *TCI_20m.jp2 *SCL_20m.jp2 -d $JP2DIR$dateText
TCI10m=$outDir"L2A_"$filepattern"TCI_10m.jp2"
TCI20m=$outDir"L2A_"$filepattern"TCI_20m.jp2"
SCL20m=$outDir"L2A_"$filepattern"SCL_20m.jp2"
if [ -e $TCI10m ]; then
mv $TCI10m $filePrefix"TCI_10m.jp2"
fi
if [ -e $TCI20m ]; then
mv $TCI20m $filePrefix"TCI_20m.jp2"
fi
if [ -e $SCL20m ]; then
mv $SCL20m $filePrefix"SCL_20m.jp2"
fi
else
echo PASS $FILE
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment