c This example shows how to read a data field in HDF-EOS2 grid data. program read_datafield_grid_MI3DAEF 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 real*4 datafield1data(4,720,360) integer*4 datafield1start(3) integer*4 datafield1stride(3) integer*4 datafield1edge(3) integer*4 i, j, k 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 'MISR_AM1_CGAS_FIRSTLOOK_AUG_30_2007_F11_0027.hdf' using grid API gridfile1 = gdopen $ ('MISR_AM1_CGAS_FIRSTLOOK_AUG_30_2007_F11_0027.hdf', DFACC_READ) c Open a grid named 'AerosolParameterAverage' grid1 = gdattach(gridfile1, 'AerosolParameterAverage') c Retrieve information about 'Optical depth average' datafield status = gdfldinfo(grid1, 'Optical depth average', datafield1rank $ , datafield1dimsize, datafield1type, datafield1dimname) c Select necessary range of elements datafield1start(1) = 0 datafield1stride(1) = 1 datafield1edge(1) = 4 datafield1start(2) = 0 datafield1stride(2) = 1 datafield1edge(2) = 720 datafield1start(3) = 0 datafield1stride(3) = 1 datafield1edge(3) = 360 c Read data from 'Optical depth average' status = gdrdfld(grid1, 'Optical depth average', datafield1start, $ datafield1stride, datafield1edge, datafield1data) c Dump data from 'Optical depth average' do i = 1, 36 do j = 1, 72 do k = 1, 1 write(*,*), datafield1data(k,j,i) enddo write(*,*) enddo write(*,*) enddo c Close the grid named 'AerosolParameterAverage' status = gddetach(grid1) c Close 'MISR_AM1_CGAS_FIRSTLOOK_AUG_30_2007_F11_0027.hdf' status = gdclose(gridfile1) end