do_masking

This file takes the master mask generated using make_master_mask, and extracts the AVHRR band 4 and band 5 data. It will be applied to all files in the directory in which it is run that end with a .reg suffix. The input AVHRR data file should be in the standard format (e.g.): n11.92263.0900.reg where
n11=satllite number
92263=year and julian date
0900=start time in GMT
.reg=registered to a map projection.

This script will produce two new files: *.land and *.water where:
*.land=the part of the input file underlain by land.
*.water=the part of th input file underlain by water.

Click here for a case study.

The script is below between the horizontal rules.


echo making land mask
emath expr_vars="lsmask" \
	expression="x1>0" \
	var_name="land" \
	var_units="" \
	var_type="fl" \
	Master land.mask 

echo making water mask
emath expr_vars="lsmask" \
	expression="x1<1" \
	var_name="water" \
	var_units="" \
	var_type="fl" \
	Master water.mask 

echo assembling mask file
assemble include_vars="land water" \
	extend_names="no" \
	instantiate="yes" \
	land.mask water.mask mask.file 

\rm land.mask water.mask

for I in `ls $1*.reg  | cut -c1-14 | sort | uniq`
do
        echo masking $I.reg

emath2 file1_vars="avhrr_ch4" \
	file2_vars="land" \
	expression="x1/x2" \
	var_name="avhrr_ch4" \
	var_type="fl" \
	var_units="" \
	$I.reg mask.file land4 

emath2 file1_vars="avhrr_ch5" \
        file2_vars="land" \
        expression="x1/x2" \
        var_name="avhrr_ch5" \
        var_type="fl" \
        var_units="" \
        $I.reg mask.file land5 

emath2 file1_vars="avhrr_ch4" \
        file2_vars="water" \
        expression="x1/x2" \
        var_name="avhrr_ch4" \
        var_type="fl" \
        var_units="" \
        $I.reg mask.file water4 

emath2 file1_vars="avhrr_ch5" \
        file2_vars="water" \
        expression="x1/x2" \
        var_name="avhrr_ch5" \
        var_type="fl" \
        var_units="" \
        $I.reg mask.file water5 

assemble include_vars="avhrr_ch4 avhrr_ch5" \
        extend_names="no" \
        instantiate="yes" \
        land4 land5 $I.land

assemble include_vars="avhrr_ch4 avhrr_ch5" \
        extend_names="no" \
        instantiate="yes" \
        water4 water5 $I.water

\rm land4 land5 water4 water5
done

This page maintained by Dave Schneider (djschnei@mt u.edu)