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
|
! In this program we (1) open the "za.he5" file, (2) attach to
! the "ZA1" za, and (3) read data from the "Spectra" field
! ============================================================
program he5_za_readdataF_64
implicit none
include 'hdfeos5.inc'
integer status
integer he5_zaopen
integer he5_zaattach
integer he5_zaread
integer he5_zardattr
integer he5_zadetach
integer he5_zaclose
integer zafid, zaid
integer i,j,k
integer*4 attr(4)
integer*8 start(3)
integer*8 stride(3)
integer*8 count(3)
real*8 plane(800)
integer FAIL
parameter (FAIL=-1)
! Open HDF-EOS za file, "za.he5"
! ------------------------------
zafid = he5_zaopen("za.he5",HE5F_ACC_RDWR)
write(*,*) 'File ID returned by he5_zaopen(): ',zafid
if (zafid .NE. FAIL) then
zaid = he5_zaattach(zafid, "ZA1")
write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid
if (zaid .NE. FAIL) then
! Read the entire Spectra field
! -----------------------------
start(1) = 0
start(2) = 0
count(1) = 20
count(2) = 40
count(3) = 1
stride(1) = 1
stride(2) = 1
stride(3) = 1
do i=1,15
start(3) = i - 1
do j=1,40
do k=1,20
plane((j-1)*20+k) = (j-1)*100 + i-1
enddo
enddo
status = he5_zaread(zaid,"Spectra",start,
1 stride,count,plane)
enddo
! Read Attribute
! --------------
status = he5_zardattr(zaid, "TestAttr", attr)
do i=1,4
write(*,*) 'Attribute Element', i, ':', attr(i)
enddo
endif
endif
! Detach from the za
! ------------------
status = he5_zadetach(zaid)
write(*,*) 'Status returned from he5_zadetach: ',status
! Close the file
! --------------
status = he5_zaclose(zafid)
write(*,*) 'Status returned from he5_zaclose: ',status
stop
end
|