#!/bin/bash # ================================================================================================== # Purpose: VIIRS SDR data have multiple fill value types. This script replace the variety of fill # values with -999.0. # # Input parameters: # 1. The latitude binary file. The following filename convention is expected of the given file: # latitude__.dat. It is assumed that the binary file values are 32-bit # values. Thus the size of the file is (nr columns) * (nr rows) * 4. # 2. The longitude binary file. The same filename convention is expected for the longitude # binary file as with the latitude binary file. # # Output: # The input files are modified. # # Author: Willem.Marais@ssec.wisc.edu # Date: 09/14/2012 # ================================================================================================== # Check if the IDL interpreter is available if [ -z $IDL_CMD ]; then idl_path_str=$(which idl) if [ $? -ne 0 ]; then echo "(ERROR) Set the environmental variable IDL_CMD equal to the IDL interpreter path." exit 1 fi IDL_CMD=$idl_path_str fi if [ $# -ne 2 ]; then usage_str=$(basename $0)" " echo "(ERROR) Usage: "$usage_str exit 1 fi lat_bin_file=$1 lon_bin_file=$2 nr_cols_int=$(basename $lat_bin_file ".bin" | cut -d"_" -f 2) nr_rows_int=$(basename $lat_bin_file ".bin" | cut -d"_" -f 3) cat > runidl << EOF set_uniform_fillval_viirs, '$lat_bin_file', '$lon_bin_file', $nr_cols_int, $nr_rows_int exit EOF if [ "$SCRIPT_DEBUG" == "YES" ]; then cat runidl $IDL_CMD runidl &> idl_output.txt idl_rtn=$? cat idl_output.txt else $IDL_CMD runidl &> idl_output.txt idl_rtn=$? fi rm -f runidl idl_output.txt flsave.pro