FUNCTION H5_DATA_READ, FILE_ID, DATA_NAME data_id = h5d_open(file_id, data_name) data = h5d_read(data_id) h5d_close, data_id return, data END FUNCTION H5_ATT_READ, FILE_ID, DATA_NAME, ATT_NAME data_id = h5d_open(file_id, data_name) att_id = h5a_open_name(data_id, att_name) att_data = h5a_read(att_id) h5a_close, att_id h5d_close, data_id return, att_data END FUNCTION MERSI_LEVEL1B_READ, FILE, BAND ;- Read reflectance for one band from a MERSI L1B 1000M HDF5 file (bands 1-4, 6-20) ;- Open the MERSI HDF5 file file_id = h5f_open(file) ;- Read the solar zenith angle solzen = h5_data_read(file_id, 'SolarZenith') solzen = solzen * 0.01 ;- Get number of day mode scans att_id = h5a_open_name(file_id, 'Number Of Day mode scans') nscans = h5a_read(att_id) h5a_close, att_id ;- Read the calibration coefficients (19 RSB bands, 3 values per band) att_id = h5a_open_name(file_id, 'VIR_Cal_Coeff') coeff = h5a_read(att_id) h5a_close, att_id ;- Read image, slope, and intercept data data_name = (band lt 5) ? 'EV_250_Aggr.1KM_RefSB' : 'EV_1KM_RefSB' image = h5_data_read(file_id, data_name) slope = h5_att_read(file_id, data_name, 'Slope') intercept = h5_att_read(file_id, data_name, 'Intercept') ;- Close the MERSI HDF5 file h5f_close, file_id ;- Compute index into image, slope, and intercept data index = (band lt 5) ? band - 1 : band - 6 ;- Extract the required MERSI band data = reform(image[*, *, index]) ;- Convert scaled integers (DN*) to DN** as defined by NSMC dnss = slope[index] * (data - intercept[index]) ;- Compute index into calibration coefficients index = (band lt 5) ? 3 * (band - 1) : 3 * (band - 2) ;- Convert DN** to reflectance (percent) as defined by NSMC k = coeff[index : index + 2] ref = k[0] + k[1] * dnss + k[2] * dnss * dnss ;- Convert reflectance (percent) to 0-1 range ref = 0.01 * ref ;- Divide by cosine of solar zenith angle ref = ref / cos(!dtor * solzen) ;- Return result return, ref END