/usr/share/doc/libhdfeos-dev/examples/readfields.f is in libhdfeos-dev 2.19v1.00+dfsg.1-7.
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 | c
c In this example we will (1) open the "SwathFile" HDF file, (2) attach to
c the "Swath1" swath, and (3) read data from the "Longitude" field.
c
program readfields
integer status, swrdfld, swrdattr, swdetach, swclose
integer start(2),stride(2),count(2), attr(4)
integer*4 swfid, swid, swopen, swattach
real*4 lng(10,20)
integer DFACC_READ
parameter (DFACC_READ=1)
c
c Open the HDF swath file, "SwathFile.hdf"
c
swfid = swopen("SwathFile_created_with_hadeos_sample_file_writer
1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)
if (swfid .NE. -1) then
swid = swattach(swfid, "Swath1")
if (swid .NE. -1) then
c Read the entire Longitude field
start(1) = 0
start(2) = 0
stride(1) = 1
stride(2) = 1
count(1) = 10
count(2) = 20
status = swrdfld(swid, "Longitude", start, stride, count,
1 lng)
do i=1,20
do j=1,10
write(*,*)'i j Longitude ',i,j,lng(j,i)
enddo
enddo
c Read Attribute
status = swrdattr(swid, "TestAttr", attr)
do i=1,4
write(*,*) 'Attribute Element', i, ':', attr(i)
enddo
endif
endif
status = swdetach(swid)
status = swclose(swfid)
stop
end
|