/* * This example creates region refernces to the selections in the 'SatelliteZenithAngle' * 'SatelliteAzimuthAngle' and 'SatelliteRange' datsets under '/All_Data/VIIRS-MOD-GTM-EDR-GEO_All' * and writes it to the 'Satellite' dataset located in the '/Data_Products' group. * Main illustrative functions: H5LRcreate_region_references */ #include #include "hdf5.h" #include "hdf5_hl.h" #include "H5LTpublic.h" #include "h5hl_region.h" #define filename "GMGTO_npp_d20030125_t0657104_e0659047_b00014_c20090811150425926728_unkn_SCI.h5" int main(void) { hid_t file_id; /* file identifier */ /* hyperslab coordinates, (3,51)-(7,53) in each of the 'SatelliteZenithAngle', 'SatelliteAzimuthAngle', 'SatelliteRange' datsets */ hsize_t block_coord[12] = {3, 51, 7, 53, 3, 51, 7, 53, 3, 51, 7, 53}; hdset_reg_ref_t ref[3]; /* region references to hyperslabs of 'SatelliteZenithAngle', 'SatelliteAzimuthAngle', 'SatelliteRange' */ const char *path[3]; /* full paths to the satellite target datasets for the region references*/ hsize_t dims[1] = {3}; herr_t status; path[0]= "/All_Data/VIIRS-MOD-GTM-EDR-GEO_All/SatelliteZenithAngle"; path[1]= "/All_Data/VIIRS-MOD-GTM-EDR-GEO_All/SatelliteAzimuthAngle"; path[2]= "/All_Data/VIIRS-MOD-GTM-EDR-GEO_All/SatelliteRange"; /* * Open the NPP file. */ file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); /* * Create three region references pointing to hyperslabs with block coordinates (3,51)-(7,53) in * 'SatelliteZenithAngle', 'SatelliteAzimuthAngle' and 'SatelliteRange' datasets. */ status = H5LRcreate_region_references(file_id, 3, path, block_coord, ref); /* * Create a dataset with the region references. */ status = H5LTmake_dataset(file_id, "/Data_Products/Satellite", 1, dims, H5T_STD_REF_DSETREG, ( const hdset_reg_ref_t *)ref); status = H5Fclose(file_id); }