c This example shows how to read a data field and two geo-location c fields in HDF-EOS2 swath data. program read_fields_swath_AE_L2A implicit none integer*4 swathfile1 integer*4 swath1 integer status integer*4 datafield1rank(32) integer*4 datafield1dimsize(32) integer*4 datafield1type(1) character*512 datafield1dimname integer*2 datafield1data(243,1997) integer*4 datafield1start(2) integer*4 datafield1stride(2) integer*4 datafield1edge(2) integer*4 geofield1rank(32) integer*4 geofield1dimsize(32) integer*4 geofield1type(1) character*512 geofield1dimname real*4 geofield1data(243,1997) integer*4 geofield1start(2) integer*4 geofield1stride(2) integer*4 geofield1edge(2) integer*4 geofield2rank(32) integer*4 geofield2dimsize(32) integer*4 geofield2type(1) character*512 geofield2dimname real*4 geofield2data(243,1997) integer*4 geofield2start(2) integer*4 geofield2stride(2) integer*4 geofield2edge(2) integer*4 i, j integer swrdfld, swfldinfo, swdetach, swclose external swrdfld, swfldinfo, swdetach, swclose integer*4 swopen, swattach external swopen, swattach integer*4 DFACC_READ parameter (DFACC_READ=1) c Open 'AMSR_E_L2A_BrightnessTemperatures_V09_200206190029_D.hdf' using c swath API swathfile1 = swopen $ ('AMSR_E_L2A_BrightnessTemperatures_V09_200206190029_D.hdf', $ DFACC_READ) c Open a swath named 'Low_Res_Swath' swath1 = swattach(swathfile1, 'Low_Res_Swath') c Retrieve information about '23.8H_Approx._Res.3_TB_(not-resampled)' c datafield status = swfldinfo(swath1, $ '23.8H_Approx._Res.3_TB_(not-resampled)', datafield1rank, $ datafield1dimsize, datafield1type, datafield1dimname) c Select necessary range of elements datafield1start(1) = 0 datafield1stride(1) = 1 datafield1edge(1) = 243 datafield1start(2) = 0 datafield1stride(2) = 1 datafield1edge(2) = 1997 c Read data from '23.8H_Approx._Res.3_TB_(not-resampled)' status = swrdfld(swath1, '23.8H_Approx._Res.3_TB_(not-resampled)' $ , datafield1start, datafield1stride, datafield1edge, $ datafield1data) c Dump data from '23.8H_Approx._Res.3_TB_(not-resampled)' do i = 1, 10 do j = 1, 2 write(*,*), datafield1data(j,i) enddo write(*,*) enddo c Retrieve information about 'Longitude' geolocation field status = swfldinfo(swath1, 'Longitude', geofield1rank, $ geofield1dimsize, geofield1type, geofield1dimname) c Select necessary range of elements geofield1start(1) = 0 geofield1stride(1) = 1 geofield1edge(1) = 243 geofield1start(2) = 0 geofield1stride(2) = 1 geofield1edge(2) = 1997 c Read data from 'Longitude' status = swrdfld(swath1, 'Longitude', geofield1start, $ geofield1stride, geofield1edge, geofield1data) c Dump data from 'Longitude' do i = 1, 10 do j = 1, 2 write(*,*), geofield1data(j,i) enddo write(*,*) enddo c Retrieve information about 'Latitude' geolocation field status = swfldinfo(swath1, 'Latitude', geofield2rank, $ geofield2dimsize, geofield2type, geofield2dimname) c Select necessary range of elements geofield2start(1) = 0 geofield2stride(1) = 1 geofield2edge(1) = 243 geofield2start(2) = 0 geofield2stride(2) = 1 geofield2edge(2) = 1997 c Read data from 'Latitude' status = swrdfld(swath1, 'Latitude', geofield2start, $ geofield2stride, geofield2edge, geofield2data) c Dump data from 'Latitude' do i = 1, 10 do j = 1, 2 write(*,*), geofield2data(j,i) enddo write(*,*) enddo c Close the swath named 'Low_Res_Swath' status = swdetach(swath1) c Close 'AMSR_E_L2A_BrightnessTemperatures_V09_200206190029_D.hdf' status = swclose(swathfile1) end