c This example shows how to read a data field in HDF-EOS2 grid data. program read_datafield_grid_MCD43C4 implicit none integer*4 gridfile1 integer*4 grid1 integer status integer*4 datafield1rank(32) integer*4 datafield1dimsize(32) integer*4 datafield1type(1) character*512 datafield1dimname integer*2 datafield1data(7200,3600) integer*4 datafield1start(2) integer*4 datafield1stride(2) integer*4 datafield1edge(2) integer*4 i, j integer gdrdfld, gdfldinfo, gddetach, gdclose external gdrdfld, gdfldinfo, gddetach, gdclose integer*4 gdopen, gdattach external gdopen, gdattach integer*4 DFACC_READ parameter (DFACC_READ=1) c Open 'MCD43C4.A2000049.005.2006271205532.hdf' using grid API gridfile1 = gdopen('MCD43C4.A2000049.005.2006271205532.hdf', $ DFACC_READ) c Open a grid named 'MCD_CMG_BRDF_0.05Deg' grid1 = gdattach(gridfile1, 'MCD_CMG_BRDF_0.05Deg') c Retrieve information about 'Nadir_Reflectance_Band1' datafield status = gdfldinfo(grid1, 'Nadir_Reflectance_Band1', $ datafield1rank, datafield1dimsize, datafield1type, $ datafield1dimname) c Select necessary range of elements datafield1start(1) = 0 datafield1stride(1) = 1 datafield1edge(1) = 7200 datafield1start(2) = 0 datafield1stride(2) = 1 datafield1edge(2) = 3600 c Read data from 'Nadir_Reflectance_Band1' status = gdrdfld(grid1, 'Nadir_Reflectance_Band1', $ datafield1start, datafield1stride, datafield1edge, $ datafield1data) c Dump data from 'Nadir_Reflectance_Band1' do i = 1, 36 do j = 1, 72 write(*,*), datafield1data(j,i) enddo write(*,*) enddo c Close the grid named 'MCD_CMG_BRDF_0.05Deg' status = gddetach(grid1) c Close 'MCD43C4.A2000049.005.2006271205532.hdf' status = gdclose(gridfile1) end