#!/bin/bash if [ $# -ne 2 ]; then echo "Usage: " echo " "$(basename $0)" " exit 1 fi bin_path=$1 scratch_dir=$2 script_path_str=$(readlink -f $0) script_dir_str=$(dirname $script_path_str) FY3_1KM_FILE=$script_dir_str"/FY3B_MERSI_GBAL_L1_20110529_0745_1000M_MS.HDF" FY3_QKM_FILE=$script_dir_str"/FY3B_MERSI_GBAL_L1_20110529_0745_0250M_MS.HDF" if [ ! -e $FY3_1KM_FILE ] || [ ! -e $FY3_QKM_FILE ]; then echo "(ERROR) The file "$FY3_1KM_FILE" or "$FY3_QKM_FILE" is missing." exit 1 fi IDL_DIR=$script_dir_str"/../idl:" cd $scratch_dir # ===================================================================== # First create crefl files # ===================================================================== KM_FILE=$(basename $FY3_1KM_FILE) QM_FILE=$(basename $FY3_QKM_FILE) CREFL_KM_FILE=crefl.1km.hdf CREFL_QM_FILE=crefl.qkm.hdf # Make local copies of FY3 L1B files cp $FY3_1KM_FILE $KM_FILE cp $FY3_QKM_FILE $QM_FILE # The update_fy3_l1b_calb.c program add additional attribute values to the solar # reflection data in the L1B HDF5 files. In essence it copies the relevant # calibration coefficient values, from the attribute variable VIR_Cal_Coeff, to # the appropriate reflection data sets. $bin_path/update_fy3_l1b_calb $QM_FILE $KM_FILE # Convert HDF5 files into HDF4 files $bin_path/h5toh4 $QM_FILE MOD02QKM.tmp.hdf $bin_path/h5toh4 $KM_FILE MOD021KM.tmp.hdf ln -s $bin_path/tbase.hdf $bin_path/mersi_crefl.1.4.2 -p -v -f -1km MOD02QKM.tmp.hdf MOD021KM.tmp.hdf -of=$CREFL_KM_FILE -bands=1,2,3,4,5,6,7 $bin_path/mersi_crefl.1.4.2 -p -v -f MOD02QKM.tmp.hdf MOD021KM.tmp.hdf -of=$CREFL_QM_FILE -bands=1,2,3,4,5,6,7 # ===================================================================== # Make granule image # ===================================================================== cat > runidl << EOF !path = strjoin (['$IDL_DIR', !path]) make_granule_image_crefl, '$CREFL_KM_FILE', 'CorrRefl_03', 'CorrRefl_02', 'CorrRefl_01', 'fy3b_gran_img_20110529_0745_1000M.png' EOF idl runidl cd -