Commit b57bfeab authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

merge-crop

parent f832816e
...@@ -7,45 +7,6 @@ cd $PRODCUTSDIR ...@@ -7,45 +7,6 @@ cd $PRODCUTSDIR
ls *.zip | parallel --jobs $JOBS ExtractData.sh {} $JP2DIR ls *.zip | parallel --jobs $JOBS ExtractData.sh {} $JP2DIR
#for f in $(ls *.zip)
#do
# #S2A_MSIL2A_20170515T162341_N0205_R040_T16QBJ_20170515T163103.zip
# filepattern=$(echo $f | cut -d"_" -f6)"_"$(echo $f | cut -d"_" -f3)"_" #T16QBJ_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$filepattern
# echo $filePrefix
# echo $outDir
# if [ ! -d $outDir ]; then
# mkdir $outDir
# fi
# if [ ! -e $filePrefix"TCI_10m.jp2" -o ! -e $filePrefix"TCI_20m.jp2" -o ! -e $filePrefix"SCL_20m.jp2" ]; then
# unzip -n -j $f *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 $f
# fi
#done
...@@ -4,26 +4,11 @@ POLYGON=$2 #Crop Window ...@@ -4,26 +4,11 @@ POLYGON=$2 #Crop Window
BOX=$(polygonToBox.py "$POLYGON") BOX=$(polygonToBox.py "$POLYGON")
#cd $DIR
#ls *.jp2 | parallel --jobs 4 gdal_translate -projwin $BOX -projwin_srs WGS84 -ot Byte -of JPEG {} {}_
#DIRNAME=$(echo $DIR | cut -d"/" -f1)
#echo $DIRNAME
#if [ ! -e ../$DIRNAME"TCI_10m_cropedmerged.tif" ]; then
# echo "gdal_merge.py -o ../cropmerge/"$DIRNAME"TCI_10m_cropedmerged.tif" $(ls *TCI_10m.jp2_)
# gdal_merge.py -o ../cropmerge/$DIRNAME"TCI_10m_cropedmerged.tif" $(ls *TCI_10m.jp2_)
#else
# echo PASSING ../cropmerge/$DIRNAME"TCI_10m_cropedmerged.tif" FOUND
#fi
#cd ..
##------------------------------------------------------------------------------ ##------------------------------------------------------------------------------
cd $DIR cd $DIR
DIRNAME=$(echo $DIR | cut -d"/" -f1) DIRNAME=$(echo $DIR | cut -d"/" -f1)
echo $DIRNAME echo $DIRNAME
##------------------------------------------------------------------------------
MERGEDIMAGE=$DIRNAME"TCI_10m_merged.tif" MERGEDIMAGE=$DIRNAME"TCI_10m_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)
...@@ -38,17 +23,23 @@ if [ ! -e $CROPEDIMAGE ]; then ...@@ -38,17 +23,23 @@ if [ ! -e $CROPEDIMAGE ]; then
else else
echo PASSING $CROPEDIMAGE FOUND echo PASSING $CROPEDIMAGE FOUND
fi fi
cd .. ##------------------------------------------------------------------------------
# gdal_merge.py -o ../$DIRNAME".tif" $(ls *TCI_10m.jp2) MERGEDIMAGE=$DIRNAME"SCL_20m_merged.tif"
if [ ! -e $MERGEDIMAGE ]; then
#if [ ! -e $dir".jp2" ]; then echo "gdal_merge.py -o "$MERGEDIMAGE $(ls *TCI_10m.jp2)
# gdal_translate -projwin $BOX -projwin_srs WGS84 -ot Byte -of JPEG $dir".tif" $dir".jp2" gdal_merge.py -o $MERGEDIMAGE $(ls *TCI_10m.jp2)
#fi else
echo PASSING $MERGEDIMAGE FOUND
fi
#rasterWkt.py "$POLYGON" $dir.jp2 $dir"_p.tif" CROPEDIMAGE=../mergecrop/$DIRNAME"SCL_20m_merged.tif"
if [ ! -e $CROPEDIMAGE ]; then
gdal_translate -projwin $BOX -projwin_srs WGS84 -ot Byte -of JPEG $MERGEDIMAGE $CROPEDIMAGE
else
echo PASSING $CROPEDIMAGE FOUND
fi
cd ..
#cd $DIR
find . -name *.xml -type f -delete
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