! ! 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_f ! PROGRAM main USE ISO_C_BINDING USE HDF5 ! module of HDF5 library USE H5LT ! module of H5LT USE H5HL_REGION IMPLICIT NONE CHARACTER(LEN=78), PARAMETER :: filename = & "GMGTO_npp_d20030125_t0657104_e0659047_b00014_c20090811150425926728_unkn_SCI.h5" INTEGER(hid_t) :: file_id ! file identifier ! hyperslab coordinates, (52,4)-(54,8) in each of the 'SatelliteZenithAngle', 'SatelliteAzimuthAngle', 'SatelliteRange' datsets INTEGER(hsize_t), DIMENSION(1:12) :: block_coord = (/52,4,54,8,52,4,54,8,52,4,54,8/) TYPE(hdset_reg_ref_t_f), DIMENSION(1:3) :: ref ! region references to hyperslabs of 'SatelliteZenithAngle', 'SatelliteAzimuthAngle', 'SatelliteRange' CHARACTER(LEN=80), DIMENSION(1:3) :: path ! full paths to the satellite target datasets for the region references! INTEGER(hsize_t), DIMENSION(1:1) :: dims = (/3/) INTEGER(HID_T) :: space_id ! Dataspace identifier INTEGER(HID_T) :: dset_id ! Dataset identifier INTEGER :: status path(1)= "/All_Data/VIIRS-MOD-GTM-EDR-GEO_All/SatelliteZenithAngle" path(2)= "/All_Data/VIIRS-MOD-GTM-EDR-GEO_All/SatelliteAzimuthAngle" path(3)= "/All_Data/VIIRS-MOD-GTM-EDR-GEO_All/SatelliteRange" ! ! Initialize FORTRAN interface. ! CALL H5open_f(status) ! ! Open the NPP file. ! CALL H5Fopen_f(filename, H5F_ACC_RDWR_F, file_id, status) ! ! Create three region references pointing to hyperslabs with block coordinates (52,4)-(54,8) in ! 'SatelliteZenithAngle', 'SatelliteAzimuthAngle' and 'SatelliteRange' datasets. ! CALL H5LRcreate_region_references_f(file_id, 3_size_t, path, block_coord, ref, status) ! ! I. Create a dataset with the region references. ! ! (a) Create dataspace for dataset with references to dataset regions ! CALL H5Screate_simple_f(1, dims, space_id, status) ! ! (b) Create dataset with references ! CALL H5Dcreate_f(file_id, "/Data_Products/Satellite", H5T_STD_REF_DSETREG, space_id, & dset_id, status) ! ! (c) Write dataset with references ! CALL H5Dwrite_f(dset_id, H5T_STD_REF_DSETREG, ref, dims, status) CALL H5Sclose_f(space_id, status) CALL H5Dclose_f(dset_id, status) CALL H5Fclose_f(file_id, status) END PROGRAM main