Created
December 10, 2012 10:32
-
-
Save cynici/4249835 to your computer and use it in GitHub Desktop.
NPP: wrapper script to run CSPP software and Pytroll mpop to produce truecolor and natural PNG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
#20120828 clai@csir.co.za | |
# Run CIMSS CSPP software on incoming NPP raw data files from EOS FES. | |
# This script is called when a separate script detects new file | |
# | |
#20120928 clai@csir.co.za | |
# Added CrIS SDR processing | |
# | |
# Abort on unset variable | |
set -u | |
export CSPP_HOME=/home/nppuser/Apps/CSPP | |
# cspp_env.sh sets PATH and may cause problem in non-CSPP programs | |
OLDPATH=$PATH | |
source $CSPP_HOME/cspp_env.sh | |
export RTSTPSHOME=/home/nppuser/Apps/rt-stps-5.1a-patched | |
if [ ! -x "$RTSTPSHOME/bin/batch.sh" ]; then | |
echo "Can't locate RT-STPS software RTSTPSHOME($RTSTPSHOME) directory" >&2 | |
exit 1 | |
fi | |
if [ $# -lt 1 ] || [ ! -f "$1" ]; then | |
echo "usage: $0 NPP_DAT" >&2 | |
exit 1 | |
fi | |
set -e | |
# e.g. NPP.20120827.114454.dat | |
OLDDIR=$(dirname "$1") | |
DAT=$(basename "$1") | |
YYYYMMDD=$(echo $DAT | cut -d. -f2) | |
YYYY=${YYYYMMDD:0:4} | |
HHMMSS=$(echo $DAT | cut -d. -f3) | |
if [ $HHMMSS -lt "050000" ] || [ $HHMMSS -gt 200000 ]; then | |
echo "Skipped night time overpass: $1" | |
exit 0 | |
fi | |
WORKDIR="/data/npp/work/$DAT" | |
RDRLOG="/data/npp/logs/$YYYY/$YYYYMMDD/rtstps-${DAT%.dat}.log" | |
VIIRSDIR="/data/npp/viirs/$YYYY/${YYYYMMDD}.${HHMMSS}" | |
VIIRSLOG="/data/npp/logs/$YYYY/$YYYYMMDD/viirs-${DAT%.dat}.log" | |
set +e | |
set -x | |
mkdir -p $(dirname $RDRLOG) | |
(mkdir -p $WORKDIR/input $WORKDIR/data | |
date +'Start %T' && \ | |
rm -rf $WORKDIR/data/* && \ | |
cp "$1" $WORKDIR/input && \ | |
cd $WORKDIR/input && \ | |
$RTSTPSHOME/bin/batch.sh $RTSTPSHOME/config/npp.xml $DAT | |
date +'End %T') >$RDRLOG 2>&1 | |
# | |
# Run as the main foreground process; ~ 25 minutes | |
# To produce true/false color images using pytroll.org mpop, | |
# viirs_sdr.sh needs -a option to aggregate products | |
# Adding -z options increase runtime to about 40 minutes | |
# | |
# 20121019 - Not making quicklook to save time | |
# | |
mkdir -p $VIIRSDIR | |
(date +'Start %T' && \ | |
cd $VIIRSDIR && \ | |
rm -rf * && \ | |
viirs_sdr.sh -a $WORKDIR/data/RNSCA-RVIRS*.h5 && \ | |
env PATH=$OLDPATH $HOME/Apps/bin/make_truecolor_image.py -l debug ${YYYYMMDD}.${HHMMSS} && \ | |
rm *.h5 [0-9]* | |
date +'End %T') >$VIIRSLOG 2>&1 | |
rm -rf $WORKDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment