Dave Lloyd
Development and Maintenance Directorate
Archive Software Department
May 13, 2003
Prepared by: | Dave Lloyd |
---|---|
Software Engineer, | |
SAIC | |
Concurred by: | Deb Labahn |
Software Project Lead, | |
SAIC | |
Approved by: | Mike Benson |
Project Manager, | |
USGS |
Number | Date and Sections | Notes |
1 | May 13, 2003 | Document Created |
2 | ||
3 | ||
4 | ||
5 | ||
6 |
Scientific Basis and Initial Evaluation of the CLAVR-1 Global Clear/Cloud Classification Algorithm for the Advanced Very High Resolution Radiometer, Stowe, Larry L., et al. Journal of Atmospheric and Oceanic Technology, Vol 16, June 99, pp 656-681. Hard copy maintained in ADAPS files.
NOAA KLM User's Guide. http://www2.ncdc.noaa.gov/docs/klm/index.htm
CLAVR-x source code obtained from Andrew Heidinger, NOAA. Source is maintained in clavr/CLAVR/CLAVRX directory.
RGCT 44.0 TGCR1 293.0 C3AR 3.0 C3AR_KLM 5.0 Gamma 50.0 RRCT_min 0.9 RRCT_max 1.1 TGCR2 293.0 C3AT 6.0 TGCT 249.0 LAT_max 60.0 LAT_min -60.0
initialize TAE call getpar - return failure on fatal error call getthresh - return failure on fatal error call openimages - return failure on fatal error call process - return failure on fatal error call closeimages - return failure on fatal error if output file not specified (return failure if any of these fail leaving files and issuing a message about which files were left hanging about) copy input file plus temporary output file to temporary file remove input file rename temporary file to input file remove temporary output file endif return success
get IN parameter from vblock, on failure return failure get input file ddr, on failure return failure get input file addr information if get addr was successful check that minor frame (.mnr) is present, on failure return failure check ddr for 5 bands only, on failure return failure set input scene type flag to SINGLE_SCENE else check ddr for 13 bands, on failure return failure check for valid projection information, on failure return failure set input scene type flag to COMPOSITE endif get the SATNUM parameter, on failure return failure get SCALING parameter, on failure return failure if scaling is US or GLOBAL get scaling factors set scaling flag to TRUE else set scaling flag to FALSE endif get ACQDATE parameter from vblock, on failure return failure set julian date from ACQDATE, on failure return failure get THRESHOLD parameter from vblock, on failure return failure if threshold file name is not NULL check for existence of the file, on failure return failure endif create a default threshold name: $ADAPSTABLES/CLAVR_threshold_MM.dat, where MM is the 2-digit month of acquisition check for existence of default threshold file, on failure return failure get BARREN parameter from vblock, on failure return failure if barren file name is not NULL if input scene type is SINGLE_SCENE then issue a warning set barren flag to FALSE else get barren file ddr, on failure return failure compare input file ddr and barren file ddr if they are not the same size return fatal or do not have same projection return fatal check minimum and maximum values in barren file if they are not in the set (0,1) return fatal set barren flag to TRUE endif else set barren flag to FALSE endif get OUT parameter from vblock, on failure return failure if output file name is not NULL check for its existence, on failure return failure if file already exists return fatal set output flag to TRUE else set output flag to FALSE endif return E_SUCC
/* threshold structure will be defined as an array of integers and array * of floats. The integer array values are flags where 0 indicates the * value in the corresponding float array is not set; 1 indicates the * values was set from default threshold file; and 2 indicates the value * was set from user-supplied threshold file */ define enumerated types for test names: RGCT = 0, TGCR1 = 1, ... LAT_min = 11; see SRS 5.6.1 through 5.6.12 for valid test names. define valid list of test names as an array of strings that match the enumerated type names and sequence: "RGCT", "TGCR1", ... "LAT_min" clear all the structure values loop: once if threshold flag is FALSE, twice if TRUE on first iteration open default threshold file, on failure return failure on second iteration open threshold file, on failure return failure loop until End Of File read one line extract test name and value from line, on failure return failure search valid list for test name if test name found set array index if structure[index].flag equals 2 issue a warning that duplicate entries found in file endif assign value to structure[index].value set structure[index].flag to loop number (1 or 2) else if test name not found return fatal endif endloop endloop check structure flags for zero entry if found return fatal return success
open input file, on failure return failure if barren flag open barren file, on failure return failure endif if output file specified open output file, on failure return failure else get temporary file name, on failure return failure open temporary file, on failure return failure endif allocate memory for I/O on failure return failure group input and output files if single scene flag open minor frame, on failure return failure endif
set return status to success loop for each group file descriptor close file, on error set return status to failure endloop if singel scene flag close minor frame file, on error set return status to failure endif return return status
setup: if single scene initialize avhrr model, on failure return failure else initialize trans routines, on failure return failure endif determine sedsq = sun/earth distance ratio squared call getconstants to initialize all satellite specific constants, on failure return failure read a line of input (c_estep), on failure return failure loop for each line in input image if single scene /* minor frame is a label services file */ read a line of minor frame, on failure return failure endif loop for each pixel in line if scaled unscale channel data, bands 1 through 5 if composite unscale angles, bands 7, 8 and 9 endif endif if single scene calculate lat/lon and angles (c_ls2ll), on failure return failure convert latitude and longitude from radians to degrees else calculate outx and outy (c_trans), on failure return failure convert outx and outy to degrees latitude/longitude endif calculate gamma = acos[cos(solz)cos(satz) + sin(solz)sin(satz)cos(relaz)] convert gamma to degrees if NOT KLM call chan3temp2alb to calculate channel 3 albedo else if channel 3B call klm_chan3Btemp2alb to get channel 3B albedo endif calculate channel 1 albedo (reflectance * cos(solz) / sedsq) calculate channel 2 albedo (reflectance * cos(solz) / sedsq) call clavr and assign return code to output buffer endloop get next line and write output buffer (c_estep), on failure return failure endloop return success
C...FMFT THRESHOLD LOOK UP TABLES (200-320K) FOR LAND AND OCEAN C DATA FMFLND/ 0.00, 201 1 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 211 2 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 221 3 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 231 4 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 241 5 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 251 6 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 261 7 0.01, 0.03, 0.05, 0.08, 0.11, 0.14, 0.18, 0.23, 0.28, 0.34, 271 8 0.41, 0.48, 0.57, 0.66, 0.76, 0.87, 1.00, 1.13, 1.27, 1.42, 281 9 1.59, 1.76, 1.94, 2.14, 2.34, 2.55, 2.77, 3.00, 3.24, 3.48, 291 A 3.73, 3.99, 4.26, 4.52, 4.80, 5.08, 5.35, 5.64, 5.92, 6.20, 301 B 6.48, 6.76, 7.03, 7.30, 7.80, 7.80, 7.80, 7.80, 7.80, 7.80, 311 C 7.80, 7.80, 7.80, 7.80, 7.80, 7.80, 7.80, 7.80, 7.80, 7.80/A pixel is considered desert if it falls within any of the following four bounding boxes:
The clavr routine will return a cloud code based on the tests listed in the algorithm diagram (See the attached Modified CLAVR Algorithm). In the diagram start in the oval with the cloud code set to 1. Proceed through the diagram performing the tests and adding result values to the cloud code until a hexagon is reached. Return the resulting cloud code. Values for each test expression are obtained from the input parameters. The expression left-hand values are R1, R2, R3, T4, T5, Lat, Lon and Gamma. The expression right-hand values are either from the threshold structure or the f(T4) function. For example: test C3AR is (R3 less than C3AR_threshold), R3 is channel 3 albedo, C3AR_threshold is the value of the threshold structure member C3AR. If the result of the expression is TRUE add 69 to code, if it is FALSE add nothing to code. Chose the appropriate channel 3 albedo thresholds based on satellite number.
Compute the channel 3B radiance (See KLM User's Guide):
Where: A and B are satellite specific constants.
Te is channel 3B temperature
Tstare is intermediate temperature
N = (C1 * nuc^3)/(exp((C2 * nuc)/Tstare)
Where: C1, C2 are constants and nuc is a satellite specific constant
N is scene radiance.
Compute channel 3B emission radiance (See CLAVR-x code):
/* compute T0, emission brightness temperature */ if t4 - t5 GT 1.0 then T0 = A0 + B0 * t4 + C0 * (t4 - t5) where: A0, B0 and C0 are satellite specific constants else T0 = t4 endif /* compute rad3b_ems, channel 3B emission radiance and * ems3b, emissivity computed using standard ch3 based method */ if t4 GT 0 then rad3b_ems = C1 * nuc^3 / exp((C2*nuc) / ((T0-C1)/C2)) - 1 ems3b = rad3b / rad3b_ems else rad3b_ems = ems3b = 0 endif /* convert solar flux in channel 3B to mean with units mW/m^2/cm^-1 * the two satellite specific constants solar_3b and ew_3b can be found in * data files clavr/CLAVR/CLAVRX/data/avhrr_SS_instr.dat where SS is the * 2-digit satellite number. */ solar_3b_nu = 1000.0 * solar_3b / ew_3b /* compute albedo */ if solz LT 90 AND rad3b_ems GT 0 AND rad3b GT 0 then alb3b = 100*pi(rad3b - rad3b_ems) / ((solar_3b_nu*cos(solz)) / sedsq) - pi*rad3b_ems) OR ?? /* this is the CLAVR-1 formula according to code */ alb3b = 100*pi(rad3b - rad3b_ems) / ((solar_3b_nu*cos(solz)) / sedsq) endif if ( solz GE 90 AND ems3b GT 0 then alb3b = 100*pi(1 - ems3b) endifreturn alb3b
ADAPS | AVHRR Data Acquisition and Production System |
AVHRR | Advanced Very High Resolution Radiometer |
CLAVR | Clear/Cloud Classification for AVHRR |
KLM | Not an acronym |
LAS | Land Analysis System |
NOAA | National and Oceanic Atmospheric Administration |
TAE | Transportable Applications Environment |
TMS | Triple Minus Split |