Commit a240762f authored by Nick Bearson's avatar Nick Bearson
Browse files

adding op flag & starting to move the logging around

parent bce2bfd7
...@@ -16,12 +16,11 @@ DIR="${BASH_SOURCE%/*}" ...@@ -16,12 +16,11 @@ DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
. "$DIR/consts.sh" . "$DIR/consts.sh"
LOG=${LOGS}/process-LCtgz.log
exec >> $LOG 2>&1
WMSUPLOAD=${DIR}/wmsupload WMSUPLOAD=${DIR}/wmsupload
SCENE=$1 SCENE=$1
OPFLAG=$2
echo "PROCESSING: $1" echo "PROCESSING: $1"
BASE=${SCENE##*/} # filename w/ extension BASE=${SCENE##*/} # filename w/ extension
...@@ -35,8 +34,10 @@ PART=${STRIP:2:7} ...@@ -35,8 +34,10 @@ PART=${STRIP:2:7}
for band in ${BANDS[@]}; do for band in ${BANDS[@]}; do
MTL="${STRIP}_MTL.txt" MTL="${STRIP}_MTL.txt"
BN="${STRIP}_B${band}.TIF" BN="${STRIP}_B${band}.TIF"
echo "extracting band ${band}"
tar xzf $SCENE $BN $MTL tar xzf $SCENE $BN $MTL
echo "calculating TOA radiance"
vmul=$(grep "RADIANCE_MULT_BAND_${band} =" $MTL | cut -d " " -f 7) vmul=$(grep "RADIANCE_MULT_BAND_${band} =" $MTL | cut -d " " -f 7)
vadd=$(grep "RADIANCE_ADD_BAND_${band} =" $MTL | cut -d " " -f 7) vadd=$(grep "RADIANCE_ADD_BAND_${band} =" $MTL | cut -d " " -f 7)
...@@ -45,5 +46,8 @@ for band in ${BANDS[@]}; do ...@@ -45,5 +46,8 @@ for band in ${BANDS[@]}; do
product="nickb-lsat-TOArad-b${band}_${YMD}_120000.part${PART}.tif" product="nickb-lsat-TOArad-b${band}_${YMD}_120000.part${PART}.tif"
gdal_calc.py -A $BN --outfile=${product} --calc="(A*${vmul})+${vadd}" gdal_calc.py -A $BN --outfile=${product} --calc="(A*${vmul})+${vadd}"
$WMSUPLOAD ${product} if [ "${OPFLAG}" == "" ]; then
echo "uploading ${product}"
$WMSUPLOAD ${product}
fi
done done
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