mask_sub

This script generates a land/water mask, extracts AVHRR band 4 and 5 data, and exports a cloud region in ascii format for importing into RADIANNET

Inputs

  1. Master file containing variable lsmask
  2. AVHRR data file
  3. Cloud outline file

Output files

  1. *.land=Terascan data file of the part of the input file underlain by land.
  2. *.water=Terascan data file of the part of th input file underlain by water.
  3. *.land.asc=ascii data file of part of the cloud underlain by land.
  4. *.water.asc=ascii data file of part of the cloud 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 

echo assembling
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

echo cutting out data
sample point_file="outline" \
        points_are="outline" \
        include_vars="avhrr_ch4 avhrr_ch5" \
        output_coords="yes" \
	$I.land temp_land

sample point_file="outline" \
        points_are="outline" \
        include_vars="avhrr_ch4 avhrr_ch5" \
        output_coords="yes" \
	$I.water temp_water

echo writing temp ascii files
expasc include_vars="latitude longitude avhrr_ch4 avhrr_ch5" \
	all_same_dim="" \
	list_dims="no" \
	temp_land temp_land.asc

expasc include_vars="latitude longitude avhrr_ch4 avhrr_ch5" \
        all_same_dim="" \
        list_dims="no" \
        temp_water temp_water.asc

echo removing null data points

sed '/\*/d' temp_water.asc >$I.water.asc
sed '/\*/d' temp_land.asc > $I.land.asc

\rm temp_water temp_water.asc temp_land temp_land.asc

done

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