avcloud - compute cloud mask for AVHRR image

SYNOPSIS

avcloud  [ parameter=value ]  [ inputfile outputfile ]
avcloud  [ parameter=value ]  [ inputfile ... directory ]
avcloudP  [ parameter=value ]  [ input_outputfile ...  ]

Parameters are day_sun_elev, night_sun_elev, min_land_temp, land_temp_std, min_sea_temp, sea_temp_std, max_land_rad, max_sea_rad, sea_rad_std, max_coast_rad, min_land_r2/r1, max_sea_r2/r1, min_sun_reflect, max_ch4_ch3, max_ch3_ch5, ch4_ch5_test, poly_size_km, local_limits, local_area_size, land_temp_range, land_rad_range, sea_temp_range, sea_rad_range, min_area_pts, snow_ice, debug.

DESCRIPTION

avcloud, avcloudP computes a cloud mask for a given AVHRR image. avcloudP writes output data to associated input files. No output filename should be specified when invoking avcloudP.

avcloud is based on the following paper

"An improved method for detecting clear sky and cloudy radiances from AVHRR data", R.W.Saunders and K.T.Kriebel, Int. Journal of Remote Sensing, 1988, Vol. 9, No. 1, pp. 123-150

Input AVHRR datasets have the following requirements:

- Channel 4 is required for any cloud testing.
- Channel 2 is required for day time cloud testing.
- Channel 3 is required for any night time cloud testing.
- Channel 1 is desired for some day time cloud tests.
- Channel 5 is desired for some day and night cloud tests.

Datasets output from avcloud contain a single variable cloud. For any given pixel, cloud is zero if the pixel is clear, and non-zero if the pixel is cloudy.

The non-zero value assigned to cloud is the number of the first test failed in the following cloud detection process:

(0) day is true if sun elevation angle > day_sun_elev

    night is true if sun elevation angle < night_sun_elev

    land is true if the surrounding 3x3 box is
        entirely over land

    sea is true if the surrounding 3x3 box is
        entirely over sea

    coast is true if land and sea are false

(1) temp = ch5 if available, otherwise temp = ch4

    if land or coast,
      if temp < min_land_temp, assume cloudy
    if sea
      if temp < min_sea_temp, assume cloudy

(2) std = ch4 standard deviation in 3x3 box

    if sea
      if std > sea_temp_std, assume cloudy
    if land and night
      if std > land_temp_std, assume cloudy

(3) if day

      if sea or coast
        rad = ch2
      if land
        rad = ch1 if available, otherwise rad = ch2

      rad = rad/cos(sun zenith angle)

      if sea
        if rad > max_sea_rad, assume cloudy
      if land
        if rad > max_land_rad, assume cloudy
      if coast
        if rad > max_coast_rad, assume cloudy

(4) if day and sea

      std = ch2 standard deviation in a 3x3 box

      if std > sea_rad_std, assume cloudy

(5) if day, and if ch1 is available

      if land
        if ch2/ch1 < min_land_r2/r1, assume cloudy
      if sea
        if ch2/ch1 > max_sea_r2/r1, assume cloudy

(6) if night

      (low fog and uniform stratus check)

      if ch4-ch3 > max_ch4_ch3, assume cloudy

(7) if night, and if ch5 is available

      (medium and high cloud check)

      if ch3-ch5 > max_ch3_ch5, assume cloudy

(8) if ch5 is available and ch4_ch5_test=yes

      (thin cirrus cloud check)

      if ch4-ch5 > tdiff(ch4, 1/cos(sat zenith angle)),
        assume cloudy

    tdiff() is described in NOTES below.

All the limits used in the above tests are user parameters, with the exception of the tdiff() test. That test can be turned of using the user parameter ch4_ch5_test. For any other cloud test, the limit can be set so the test is essentially turned off.

The limits min_land_temp, min_sea_temp, max_land_rad, and max_sea_rad can be refined by an optional local area analysis. In this case, different limits are used for different areas of the image.

For each local area, conservative land and sea maximum temperatures and conservative land and sea minimum radiances are computed. (At least 5% of the temperatures in the local area are above the temperature maximum. At least 5% of the radiances are below the radiance minimum.) Then the following local adjustments are made to certain cloud detection limits:

local min clear land temp = max( min_land_temp,
           local land max temp - land_temp_range )

local min clear sea temp = max( min_sea_temp,
           local sea max temp - sea_temp_range )

local max clear land radiance = min( max_land_rad,
           local land min rad - land_rad_range )

local max clear sea radiance = min( max_sea_rad,
           local sea min rad - sea_rad_range )

The user parameters land_temp_range, sea_temp_range, land_rad_range, and sea_rad_range refer to the maximum expected range of values within a local area.

A test to distinguish surface snow and ice from clouds is also provided. The snow and ice test is based on the following paper: "An Algorithm for snow and ice detection using AVHRR data An extension to the APOLLO software package", G. Gesell, INT. J. REMOTE SENSING, 1989, vol. 10, nos. 4 & 5, 897-905 . It is optional and can be enabled or disabled with the snow_ice parameter.

Note that because different cloud tests are performed over land and over sea and over coast, it is crucial that the input image be accurately navigated. See navigate.

PARAMETERS

day_sun_elev
Day time cloud tests are used if the sun elevation is greater than day_sun_elev. The valid range is [-90, 90] degrees. The default is 10 degrees.
night_sun_elev
Night time cloud tests are used if the sun elevation is less than night_sun_elev. The valid range is [-90, 90] degrees. The default is -5 degrees.
min_land_temp
The minimum clear land IR brightness temperature for the entire image. Land pixels with temperatures below this value are assumed to be cloudy. The valid range is [-100, 100] degrees Celsius. The default is -10 degrees Celsius.
land_temp_std
The maximum clear night time land IR temperature standard deviation in a 3x3 box. If the night time land temperature standard deviation is above this value, the center pixel is assumed to be cloudy. The valid range is [0, 100] degrees Celsius. The default is 1.5 degrees Celsius.
min_sea_temp
The minimum clear sea IR brightness temperature for the entire image. Sea pixels with temperatures below this value are assumed to be cloudy. The valid range is [-100, 100] degrees Celsius. The default is -10 degrees Celsius.
sea_temp_std
The maximum clear sea IR temperature standard deviation in a 3x3 box. If sea temperature standard deviation is above this value, the center pixel is assumed to be cloudy. The valid range is [0, 100] degrees Celsius. The default is 0.25 degrees Celsius.
max_land_rad
The maximum clear day time land radiance for the entire image. Land pixels with radiance above this value are assumed to be cloudy. The valid range is [0, 100] percent albedo. The default is 40 percent albedo.
max_sea_rad
The maximum clear day time sea radiance for the entire image. Sea pixels with radiance above this value are assumed to be cloudy. The valid range is [0, 100] percent albedo. The default is 10 percent albedo.
sea_rad_std
The maximum clear day time sea radiance standard deviation in a 3x3 box. If day time sea radiance standard deviation is above this value, the center pixel is assumed to be cloudy. The valid range is [0, 100] percent albedo. The default is 0.2 percent albedo.
max_coast_rad
The maximum clear day time coastal radiance for the entire image. Coastal pixels with radiance above this value are assumed to be cloudy. The valid range is [0, 100] percent albedo. The default is 15 percent albedo.
min_land_r2/r1
The minimum clear day time land ch2/ch1 ratio. Land pixels with ch2/ch1 ratios below this value are assumed to be cloudy. The valid range is [0, infinity]. The default is 0, which essentially disables this test.
max_sea_r2/r1
The minimum clear day time sea ch2/ch1 ratio. Sea pixels with ch2/ch1 ratios above this value are assumed to be cloudy. The valid range is [0, infinity]. The default is .75 .
min_sun_reflect
The minimum allowable sun reflection angle for performing the ch2/ch1 ratio test. This angle is between the following two vectors: (1) from pixel to the satellite, and (2) from pixel in the direction of the reflected sun. The valid range is [-90, 90] degrees. The default is 50 degrees.
max_ch4_ch3
Maximum clear night time ch4-ch3 IR temperature difference. Night time pixels with ch4-ch3 difference below this value are assumed to be cloudy. The default is 1 degrees Celsius.
max_ch3_ch5
Minimum clear night time ch3-ch5 IR temperature difference. Night time pixels with ch3-ch5 difference above this value are assumed to be cloudy. The default is 1.5 degrees Celsius.
ch4_ch5_test
Enables the thin cirrus cloud test involving the ch4-ch5 temperature difference. Valid responses are yes and no. The default is yes.
poly_size_km
OPTIONAL. The domain size of the interpolation polynomials used to compute latitude, longitude, and the various pixel/satellite/sun angles. The valid range is [20, 200] kilometers. The default is 100 kilometers.
local_limits
Whether or not to use local area analysis to improve on maximum clear land/sea day time radiance estimates, and minimum clear land/sea IR temperature estimates. Valid responses are yes and no. The default is yes.
local_area_size
Recommended width and height of the areas used for local area analysis, measured in pixels. Used only if local_limits=yes. The valid range is [50, 500] pixels. The default is 100 pixels.
min_area_pts
Minimum number of land/sea pixels in a given local area required to compute statistics. Used only if local_limits=yes. The valid range is [1, area_size**2]. The default is 10*area_size.
land_temp_range
Maximum expected land temperature range over a local area. Used only if local_limits=yes. Valid ranges are greater than zero. The default local land temperature range is 25 degrees Celsius.
sea_temp_range
Maximum expected sea temperature range over a local area. Used only if local_limits=yes. Valid ranges are greater than zero. The default local sea temperature range is 5 degrees Celsius.
land_rad_range
Maximum expected land radiance range over a local area. Used only if local_limits=yes. Valid ranges are greater than zero. The default local land radiance range is 25 percent albedo.
sea_rad_range
Maximum expected sea radiance range over a local area. Used only if local_limits=yes. Valid ranges are greater than zero. The default local sea radiance range is 5 percent albedo.
snow_ice
Flag to enable/disable testing to distinguish surface snow and ice from clouds. snow_ice=yes enables snow & ice tests. The default is snow_ice=no
debug
OPTIONAL. Integer debug flag. As the debug value increases, more printed is generated. The valid range is [0, 2]. The default is 0.

EXAMPLES

n% avcloud n14.96093.0934 mask
day_sun_elev   : real      ? [10]
night_sun_elev : real      ? [-5]
min_land_temp  : real      ? [-10]
land_temp_std  : real      ? [1.5]
min_sea_temp   : real      ? [0]
sea_temp_std   : real      ? [0.25]
max_land_rad   : real      ? [40]
max_sea_rad    : real      ? [10]
sea_rad_std    : real      ? [0.2]
max_coast_rad  : real      ? [15]
min_land_r2/r1 : real      ? [0]
max_sea_r2/r1  : real      ? [0.75]
min_sun_reflect: real      ? [50]
max_ch4_ch3    : real      ? [1]
max_ch3_ch5    : real      ? [1.5]
local_limits   : char(  3) ? [yes]
local_area_size: int       ? [100]
min_area_pts   : int       ? [1000]
land_temp_range: real      ? [25]
sea_temp_range : real      ? [5]
land_rad_range : real      ? [25]
sea_rad_range  : real      ? [5]
snow_ice       : char(  3) ? [no]

n14.96093.0934: Local area study phase
n14.96093.0934: Cloud screening phase
mask: Completed

SEE ALSO

satvis, nitpix, navigate

NOTES

tdiff() used in the last cloud test is a function of the AVHRR channel 4 brightness temperature and the secant of the satellite zenith angle. It is interpolated from the following table:

static double TDIFF[6][5] = {           /* thin cirrus test limits */
  0.55,  0.60,  0.65,  0.90,  1.10,     /* function of temp, secant */
  0.58,  0.63,  0.81,  1.03,  1.13,
  1.30,  1.61,  1.88,  2.14,  2.30,
  3.06,  3.72,  3.95,  4.27,  4.73,
  5.77,  6.92,  7.00,  7.42,  8.43,
  9.41, 10.74, 11.03, 11.60, 13.39
};

#define NUM_TDIFF_ROWS  6
#define NUM_TDIFF_COLS  5

static double TDIFF_ROW_TEMP[] = {      /* temperature in degrees K */
  260., 270., 280., 290., 300., 310.
};

static double TDIFF_COL_SECANT[] = {    /* 1./cos(sat zenith) */
  1., 1.25, 1.50, 1.75, 2.0
};