SCALEMODIS
MODIS corrected reflectance images often appear drab when initially processed and displayed on a computer using BYTSCL. In fact, the resulting true-color images look nothing like the images you can find on the MODIS Rapid Response web page (http://rapidfire.sci.gsfc.nasa.gov/gallery/). After poking around on the Internet for awhile, I discovered that the Rapid Response Team doesn't use BYTSCL to prepare the images. Rather, they selectively scale portions of the reflectance image, using a piecewise scaling with different slopes. This program implements this Rapid Response Team algorithm.
FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Graphics
scaledBand = ScaleModis(red, green, blue)
red: A two-dimensional array representing the corrected reflectance values of a MODIS image. This is a required parameter. If the green and blue parameters are also used, this parameter will represent the red band of a RGB 24-bit scaled image that is returned. green: If the three parameters--red, green, and blue--are present, the returned array is a 24-bit true-color image, scaled appropriately. This parameter is used as the green band in such an image. The parameter is a two-dimensional array of corrected reflectance values. blue: If the three parameters--red, green, and blue--are present, the returned array is a 24-bit true-color image, scaled appropriately. This parameter is used as the blue band in such an image. The parameter is a two-dimensional array of corrected reflectance values.
RANGE: A two-dimensional array that the input bands are first scaled into, prior to the differential scaling using the MODIS Rapid Response algorithm. The default input range is [-0.01, 1.10]. These values will be used to set the MIN and MAX keywords for the BYTSCL command in the initial scaling of the input bands. CLOUD: The MODIS Rapid Response team uses a slightly different scaling algorithm when the idea is to emphasize clouds in a MODIS scene. Set this keyword to use the alternate cloud scaling algorithm.
scaledBand: If a single 2D array is passed as the argument, then scaledBand is the scaled 2D output array. If all three arguments are passed to the program, then scaledBand is a scaled 24-bit image that represents a true-color or false color representation of the three input bands.
Written by: David W. Fanning, July 2009, using the IDL programs MODIS_FALSE_COLOR and and SCALE_IMAGE for inspiration. I found these programs on the Internet when poking around MODIS web pages. I suspect, but I am not sure, these programs were originally written by Liam Gumley. Minor changes to the ScaleIt function to be sure partitioning is done correctly. 5 Aug 2009. DWF.