; ============================================================================ ; Purpose: Through this script a color image is created from the given 1KM ; CREFL L1B file. The band names that must be used to create the color image ; ; Input parameters: ; crefl_hdf4_1km - The CREFL 1KM HDF4 file from which an image will be created. ; r_band_str - The name of the SDS array in the 1km HDF4 file that must be used ; as the red channel in the output image. ; g_band_str - The name of the SDS array in the 1km HDF4 file that must be used ; as the green channel in the output image. ; b_band_str - The name of the SDS array in the 1km HDF4 file that must be used ; as the blue channel in the output image. ; out_png_path - The filesystem path to the output image. ; ; Output: ; data - The image will be created in a PNG format. ; ; Author: Liam.Gumley@ssec.wisc.edu, Willem.Marais@ssec.wisc.edu ; ============================================================================ FUNCTION CREFL_UNSCALE, DATA ;- Convert corrected reflectance scaled integer data to float and set invalid pixels to -1.0 loc = where(data eq 32767, count) data = data * 0.0001 if (count gt 0) then data[loc] = -1.0 return, data END PRO MAKE_GRANULE_IMAGE_CREFL, CREFL_HDF4_1KM, R_BAND_STR, G_BAND_STR, B_BAND_STR, OUT_PNG_PATH hdfid = hdf_sd_start (crefl_hdf4_1km) ; Load the bands 3, 2 and 1. Make from these bands an image hdf_sd_varread, hdfid, R_BAND_STR, red_data hdf_sd_varread, hdfid, G_BAND_STR, green_data hdf_sd_varread, hdfid, B_BAND_STR, blue_data red_data = crefl_unscale (temporary (red_data)) green_data = crefl_unscale (temporary (green_data)) blue_data = crefl_unscale (temporary (blue_data)) true_clr_data = mersi_false_color (temporary (red_data), $ temporary (green_data), $ temporary (blue_data), /cloud) true_clr_data = reverse (temporary (true_clr_data), 3) write_png, out_png_path, true_clr_data print, out_png_path, format='("(Created PNG image ", a, ")")' hdf_sd_end, hdfid END