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