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_MOP02 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 real*4 datafield1data(2,154649) 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(154649) integer*4 geofield1start(1) integer*4 geofield1stride(1) integer*4 geofield1edge(1) integer*4 geofield2rank(32) integer*4 geofield2dimsize(32) integer*4 geofield2type(1) character*512 geofield2dimname real*4 geofield2data(154649) integer*4 geofield2start(1) integer*4 geofield2stride(1) integer*4 geofield2edge(1) 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 'MOP02-20000303-L2V5.7.1.val.hdf' using swath API swathfile1 = swopen('MOP02-20000303-L2V5.7.1.val.hdf', DFACC_READ) c Open a swath named 'MOP02' swath1 = swattach(swathfile1, 'MOP02') c Retrieve information about 'CO Total Column' datafield status = swfldinfo(swath1, 'CO Total Column', datafield1rank, $ datafield1dimsize, datafield1type, datafield1dimname) c Select necessary range of elements datafield1start(1) = 0 datafield1stride(1) = 1 datafield1edge(1) = 2 datafield1start(2) = 0 datafield1stride(2) = 1 datafield1edge(2) = 154649 c Read data from 'CO Total Column' status = swrdfld(swath1, 'CO Total Column', datafield1start, $ datafield1stride, datafield1edge, datafield1data) c Dump data from 'CO Total Column' do i = 1, 15 do j = 1, 1 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) = 154649 c Read data from 'Longitude' status = swrdfld(swath1, 'Longitude', geofield1start, $ geofield1stride, geofield1edge, geofield1data) c Dump data from 'Longitude' do i = 1, 15 write(*,*), geofield1data(i) 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) = 154649 c Read data from 'Latitude' status = swrdfld(swath1, 'Latitude', geofield2start, $ geofield2stride, geofield2edge, geofield2data) c Dump data from 'Latitude' do i = 1, 15 write(*,*), geofield2data(i) enddo c Close the swath named 'MOP02' status = swdetach(swath1) c Close 'MOP02-20000303-L2V5.7.1.val.hdf' status = swclose(swathfile1) end