PRO READ_MODIS_RADIANCE, HDFID, BAND, DATA_TYPE, NCOL, NROW, DATA, RAW=RAW ;- Read a single band of MODIS L1B radiance data COMPILE_OPT IDL2 ;- Check arguments if (n_elements(hdfid) eq 0) then message, 'Argument HDFID is undefined' if (n_elements(band) eq 0) then message, 'Argument BAND is undefined' if (n_elements(data_type) eq 0) then message, 'Argument DATA_TYPE is undefined' if (n_elements(ncol) eq 0) then message, 'Argument NCOL is undefined' if (n_elements(nrow) eq 0) then message, 'Argument NROW is undefined' ;- Select the SDS sds_name = get_sds_name(band, data_type) varid = hdf_sd_select(hdfid, hdf_sd_nametoindex(hdfid, sds_name)) ;- Get the band index band_index = get_band_index(hdfid, sds_name, band) ;- Get the start and count vectors start = [0, 0, band_index] count = [ncol, nrow, 1] ;- Read the scaled integers hdf_sd_getdata, varid, data, start=start, count=count ;- Get the valid range, scales, and offsets hdf_sd_attrinfo, varid, hdf_sd_attrfind(varid, 'valid_range'), data=range hdf_sd_attrinfo, varid, hdf_sd_attrfind(varid, 'radiance_scales'), data=scale hdf_sd_attrinfo, varid, hdf_sd_attrfind(varid, 'radiance_offsets'), data=offset ;- Deselect the SDS hdf_sd_endaccess, varid ;- Convert scaled integers to radiance if (keyword_set(raw) eq 0) then data = scale[band_index] * (data - offset[band_index]) END