#!/bin/bash # Run SeaDAS 7.0 Level-2 ocean processing on a single VIIRS CSPP SDR granule. # Note: All VIIRS M-band SDR files (SVM01-SVM16) and the corresponding GMTCO file are required as input. # SeaDAS 7.0 can be downloaded from http://seadas.gsfc.nasa.gov/installers/ # Liam.Gumley@ssec.wisc.edu 2013-02-25 # Check arguments if [ $# -ne 1 ]; then echo "Usage: run_viirs_seadas.bash SVM01_FILE" echo "where SVM01_FILE is the full path and name of the VIIRS M-band SVM01 HDF5 file." echo "All VIIRS M-band SDR HDF5 files and the corresponding GMTCO file must be in the same directory." exit 1 fi # Check the input file input_file=$1 if [ ! -r $input_file ]; then echo "Input file not found: "$input_file exit 1 fi # Get the path and name of the SVM01 granule svm_path=$(dirname $input_file) svm_file=$(basename $input_file) date_string=$(echo $svm_file | cut -d_ -f2-5) # Create uncompressed copies of all the SVM files and the GMTCO file. echo echo "(Creating uncompressed copies of SVM and GMTCO)" for file in $svm_path/SVM??_${date_string}_*.h5; do h5repack -f NONE $file $(basename $file | cut -d_ -f1-5)".tmp.h5"; done for file in $svm_path/GMTCO_${date_string}_*.h5; do h5repack -f NONE $file $(basename $file | cut -d_ -f1-5)".tmp.h5"; done # Set up SeaDAS 7.0. export OCSSWROOT=$HOME/seadas-7.0-beta/Processing source $OCSSWROOT/OCSSW_bash.env # Fetch ancillary data. echo echo "(Fetching ancillary data)" echo getanc.py SVM01_$date_string.tmp.h5 getanc.py SVM01_$date_string.tmp.h5 # Running SeaDAS 7.0 Level-2 processing. # Note that the calfile="" gain="1,1,1,1,1,1,1,1,1,1" options are required for CSPP or IDPS SDRs. echo echo "(Running l2gen)" echo l2gen ifile=SVM01_$date_string.tmp.h5 geofile=GMTCO_$date_string.tmp.h5 ofile=SEADAS_$date_string.hdf \ par=SVM01_$date_string.tmp.h5.anc calfile="" gain="1,1,1,1,1,1,1,1,1,1" proc_sst="0" l2gen ifile=SVM01_$date_string.tmp.h5 geofile=GMTCO_$date_string.tmp.h5 ofile=SEADAS_$date_string.hdf \ par=SVM01_$date_string.tmp.h5.anc calfile="" gain="1,1,1,1,1,1,1,1,1,1" proc_sst="0" if [ $? -ne 0 ]; then echo "Error running l2gen" exit 1 fi # Clean up and exit rm -f SVM??_$date_string.tmp.h5 GMTCO_$date_string.tmp.h5 SVM01_$date_string.tmp.h5.anc exit 0