/usr/share/doc/libhdfeos-dev/examples/inquireswath.f is in libhdfeos-dev 2.17v1.00.dfsg.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | c
c In this example we will retrieve (1) information about the
c dimensions, (2) the dimension mappings (geolocation relations),
c and (3) the swath fields.
c
program inquireswath
integer i, swmapinfo, swfldinfo, status
integer swdetach, swclose
integer*4 swinqdims, swinqmaps, swinqdflds, swinqgflds
integer*4 swdiminfo, offset, incr, rk, nt
integer*4 swimapinfo, swinqimaps
integer*4 swfid, swid, ndims, nmaps, nflds
integer*4 swopen, swattach
integer*4 dims(32), off(32), inc(32), rank(32), ntype(32)
integer*4 sizes(8), indx(32), dimsize
character*72 dimname, dimmap, fieldlist, dimlist
integer DFACC_READ
parameter (DFACC_READ=1)
c
c Open the Swath File for read only access
c
swfid = swopen("SwathFile.hdf", DFACC_READ)
if (swfid .NE. -1) then
c Attach the swath
swid = swattach(swfid, "Swath1")
if (swid .NE. -1) then
c Inquire Dimensions
ndims = swinqdims(swid, dimname, dims)
write(*,*) 'Dimension list: ', dimname
do i = 1,ndims
write(*,*) 'dim size: ', dims(i)
enddo
write(*,*)
c Inquire Dimension Mappings
nmaps = swinqmaps(swid, dimmap, off, inc)
write(*,*) 'Dimension map: ', dimmap
do i = 1,nmaps
write(*,*) 'offset increment: ', off(i), inc(i)
enddo
write(*,*)
c Inquire Indexed Dimension Mappings
nmaps = swinqimaps(swid, dimmap, sizes)
write(*,*) 'Index Dimension map: ', dimmap
do i=1,nmaps
write(*,*) 'sizes: ', sizes(i)
enddo
write(*,*)
c Inquire Geolocation Fields
nflds = swinqgflds(swid, fieldlist, rank, ntype)
write(*,*) 'Geolocation fieldlist: ', fieldlist
do i=1,nflds
write(*,*) 'field rank & datatype: ', rank(i), ntype(i)
enddo
write(*,*)
c Inquire Data Fields
nflds = swinqdflds(swid, fieldlist, rank, ntype)
write(*,*) 'Data Fieldlist: ', fieldlist
do i=1,nflds
write(*,*) 'field rank & datatype: ', rank(i), ntype(i)
enddo
write(*,*)
c Get info on "GeoTrack" dim
dimsize = swdiminfo(swid, "GeoTrack")
write(*,*) 'Size of GeoTrack: ', dimsize
write(*,*)
c Get info on "GeoTrack/Res2tr" mapping
status = swmapinfo(swid, "GeoTrack", "Res2tr", offset,
1 incr)
write(*,*) 'Mapping Offset: ', offset
write(*,*) 'Mapping Increment: ', incr
write(*,*)
c Get info on "IndxTrack/Res2tr" indexed mapping
n = swimapinfo(swid, "IndxTrack", "Res2tr", indx)
do i=1,n
write(*,*) 'Index Mapping Entry ', i, indx(i)
enddo
write(*,*)
c Get info on "Longitude" Field
status = swfldinfo(swid, "Longitude", rk, dims, nt, dimlist)
write(*,*) 'Longitude Rank: ', rk
write(*,*) 'Longitude NumberType: ', nt
write(*,*) 'Longitude Dimlist: ', dimlist
do i=1,rk
write(*,*) 'Dimension ',i,dims(i)
enddo
endif
endif
status = swdetach(swid)
status = swclose(swfid)
stop
end
|