Commit 5b3f258f authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

date directory

parent 95422c1c
...@@ -9,14 +9,21 @@ break ...@@ -9,14 +9,21 @@ break
cd $PRODCUTSDIR cd $PRODCUTSDIR
for f in $(find . -type f -name '*.zip') for f in $(find . -type f -name '*.zip')
do do
#S2A_MSIL2A_20170515T162341_N0205_R040_T16QBJ_20170515T163103.zip
filepattern=$(echo $f | cut -d"_" -f6)"_"$(echo $f | cut -d"_" -f3)"_" filepattern=$(echo $f | cut -d"_" -f6)"_"$(echo $f | cut -d"_" -f3)"_" #T16QBJ_20170515T162341_
filename=$JP2DIR$filepattern filename=$JP2DIR$filepattern
fileout1=$(echo $filepattern | cut -d"_" -f1) #T16QBJ
fileout2=$(echo $filepattern | cut -d"_" -f2) #20170515T162341
dateText=$(echo $filepattern | cut -d"T" -f1) #20170515
echo $filename echo $filename
if [ ! -d $JP2DIR$dateText ]; then
mkdir $JP2DIR$dateText
fi
if [ ! -e $filename"TCI_10m.jp2" ]; then if [ ! -e $filename"TCI_10m.jp2" ]; then
unzip -n -j $f *TCI_10m.jp2 -d $JP2DIR unzip -n -j $f *TCI_10m.jp2 -d $JP2DIR$dateText/
L2ANAME=$JP2DIR"L2A_"$filepattern"TCI_10m.jp2" L2ANAME=$JP2DIR$dateText"/L2A_"$filepattern"TCI_10m.jp2"
if [ -e $L2ANAME ]; then if [ -e $L2ANAME ]; then
mv $L2ANAME $filename"TCI_10m.jp2" mv $L2ANAME $filename"TCI_10m.jp2"
fi fi
...@@ -24,37 +31,45 @@ do ...@@ -24,37 +31,45 @@ do
echo PASS $f echo PASS $f
fi fi
RGBCROPED=$JP2DIR"rgbCroped/" # RGBCROPED=$JP2DIR"rgbCroped/"
if [ ! -d $RGBCROPED ]; then # if [ ! -d $RGBCROPED ]; then
mkdir $RGBCROPED # mkdir $RGBCROPED
fi # fi
fileout1=$(echo $filepattern | cut -d"_" -f1)
fileout2=$(echo $filepattern | cut -d"_" -f2)
if [ ! -d $RGBCROPED$fileout1 ]; then #
mkdir $RGBCROPED$fileout1
fi # if [ ! -d $dateText$fileout1 ]; then
echo $BOX # mkdir $dateText$fileout1
OUTIMG=$JP2DIR"rgbCroped/"$fileout1/$fileout2"_"$fileout1"_10m.tiff"
OUTIMG_P=$JP2DIR"rgbCroped/"$fileout1/$fileout2"_"$fileout1"_10m_p.tiff"
# if [ ! -e $OUTIMG ]; then
gdal_translate -projwin $BOX -projwin_srs WGS84 -ot Byte -of JPEG $filename"TCI_10m.jp2" $OUTIMG
rasterWkt.py "$POLYGON" $OUTIMG $OUTIMG_P
rm polygonTmp.tiff
# wktToShape.py "$POLYGON" myShape.shp
# gdal_rasterize -b 1 -b 2 -b 3 -burn 10 -burn 200 -burn 10 -l wtk myShape.shp $OUTIMG
# rm myShape.*
## convert rgb/$fileout1/$fileout2"_"$fileout1"_t.jpg" -resize 640x480\! rgb/$fileout1/$fileout2"_"$fileout1".jpg"
## rm rgb/$fileout1/$fileout2"_"$fileout1"_t.jpg"
# fi # fi
# echo $BOX
# OUTIMG=$JP2DIR"rgbCroped/"$dateText/$fileout2"_"$fileout1"_10m.tiff"
# OUTIMG_P=$JP2DIR"rgbCroped/"$dateText/$fileout2"_"$fileout1"_10m_p.tiff"
## if [ ! -e $OUTIMG ]; then
# cd $PRODCUTSDIR # #Converts raster data between different formats.
break # gdal_translate -projwin $BOX -projwin_srs WGS84 -ot Byte -of JPEG $filename"TCI_10m.jp2" $OUTIMG
# rasterWkt.py "$POLYGON" $OUTIMG $OUTIMG_P
# rm polygonTmp.tiff
## wktToShape.py "$POLYGON" myShape.shp
## gdal_rasterize -b 1 -b 2 -b 3 -burn 10 -burn 200 -burn 10 -l wtk myShape.shp $OUTIMG
## rm myShape.*
### convert rgb/$fileout1/$fileout2"_"$fileout1"_t.jpg" -resize 640x480\! rgb/$fileout1/$fileout2"_"$fileout1".jpg"
### rm rgb/$fileout1/$fileout2"_"$fileout1"_t.jpg"
## fi
## cd $PRODCUTSDIR
# break
done done
#cd $PRODCUTSDIR
#for f in $(find . -type f -name '*.zip')
#do
#done
cd $JP2DIR cd $JP2DIR
find . -name *.xml -type f -delete find . -name *.xml -type f -delete
#find . -name myShape.* -type f -delete #find . -name myShape.* -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