; ============================================================================ ; Purpose: This script is used to convert a SDS array in a HDF4 file into a ; raster binary file. If geolocation data in a HDF4 file is converted into ; a raster binary file. ; ; Input parameters: ; 1. The L1B HDF4 file name. ; 2. The SDS array name in the L1B HDF4 file that is going to be converted ; into a raster binary file. ; 3. A prefix string that will be added to the output file name. ; Output: ; The output will be a raster binary file. The file name will include ; the specifications of the binary file. There are four fields, delimited ; by the '_' character. The fields are are follows: ; ___.dat ; ; Author: Willem.Marais@ssec.wisc.edu ; Date: 09/17/2012 ; ============================================================================ PRO HDF_TO_BINARY, HDF_FILE_STR, SDS_NAME_STR, OUT_PREFIX_STR ; Convert a SDS in a HDF file to a binary file. The output binary file will start with the ; given prefix string (OUT_PREFIX_STR), the dimensions will be placed in the file name and the ; data type of the SDS array. ; The output file name format will be: ; out_prefix_str___.dat ; Open the HDF file and read in the SDS data hdfid = hdf_sd_start (hdf_file_str) hdf_sd_varread, hdfid, sds_name_str, sds_arr hdf_sd_end, hdfid ; Get the dimensions of the SDS array dimm_arr = size (sds_arr, /dimensions) ; Get the data type data_type_int = size (sds_arr_out, /type) ; Construct the output file name out_file_name_str = out_prefix_str + "_" + $ strtrim (string (dimm_arr [0]), 1) + "_" + $ strtrim (string (dimm_arr [1]), 1) + ".bin" ; Write data to output binary file openw, lun, out_file_name_str, /get_lun writeu, lun, sds_arr free_lun, lun END