#!/bin/ksh # Get the NISE ancillary data file closest to a MODIS granule date and time # Check number of arguments if [ $# != 3 ]; then echo "Usage: get_nise dir date time" echo " dir is the directory containing the NISE files" echo " date is the date (yyyyddd)" echo " time is the time (hhmm)" exit 1 fi # Get arguments dir=$1 date=$2 time=$3 # Find the closest date within a 4 day window for delta in 0 1 2; do list="- +" for sign in $list; do # Compute the Gregorian date (yyyymmdd) of the closest NISE file modis_date=`dateplus -J $date` nise_date=`dateplus $sign$delta $modis_date` # Find the NISE file nise_name="NISE_SSMIF13_"${nise_date}".HDFEOS" nise_file=`find $dir -size +2200000c -name $nise_name` # Check for success if [[ $nise_file != "" ]]; then echo $nise_file exit 0 fi done done # If we get here, no matching NISE file was found exit 1