~ubuntu-branches/ubuntu/lucid/hdf-eos5/lucid

« back to all changes in this revision

Viewing changes to samples/he5_za_rdexternaldataF_32.f

  • Committer: Bazaar Package Importer
  • Author(s): Alastair McKinstry
  • Date: 2009-08-17 23:07:29 UTC
  • Revision ID: james.westby@ubuntu.com-20090817230729-gzbwp1ny01hv2nlk
Tags: upstream-5.1.12.dfsg.1
ImportĀ upstreamĀ versionĀ 5.1.12.dfsg.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
!
 
2
! ----------------------------------------------------------------------------
 
3
! |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
 
4
! ----------------------------------------------------------------------------
 
5
!
 
6
 
 
7
      program            he5_za_rdexternaldataF_32
 
8
 
 
9
      implicit           none
 
10
 
 
11
      include            'hdfeos5.inc'
 
12
 
 
13
      integer            i
 
14
      integer            status
 
15
      integer            he5_zaopen
 
16
      integer            he5_zaattach
 
17
      integer            he5_zaread
 
18
      integer            he5_zagetxdat
 
19
      integer            he5_ehrdwrfile
 
20
      integer            he5_zadetach
 
21
      integer            he5_zaclose
 
22
      integer            zafid, zaid
 
23
      integer            nfiles
 
24
      integer            datain1(100)
 
25
      integer            datain2(100)
 
26
      integer            datain3(100)
 
27
      integer            dataout(60)
 
28
 
 
29
      integer*4          start(2)
 
30
      integer*4          stride(2)
 
31
      integer*4          count(2)
 
32
      integer*4          offset(3)
 
33
      integer*4          size(3)
 
34
      integer*4          nmlgth
 
35
      integer*4          num_elements
 
36
 
 
37
      character          filelist*256
 
38
 
 
39
      integer            FAIL
 
40
      parameter          (FAIL=-1)
 
41
 
 
42
!.....Use this for writing (only) to an existing file
 
43
      integer            WRITE_EXISTING_ONLY
 
44
      parameter          (WRITE_EXISTING_ONLY=0)
 
45
 
 
46
!.....Use this for reading (only) from an existing file
 
47
      integer            READ_ONLY
 
48
      parameter          (READ_ONLY=1)
 
49
 
 
50
!.....Use this for creating and writing to a file
 
51
      integer            WRITE_NEW
 
52
      parameter          (WRITE_NEW=2)
 
53
 
 
54
 
 
55
 
 
56
!     Create the external data sets
 
57
!     -----------------------------
 
58
      do 10 i=1,100
 
59
 
 
60
         datain1(i) = 1000+i
 
61
         datain2(i) = 2000+i
 
62
         datain3(i) = 3000+i        
 
63
         
 
64
 10   continue
 
65
 
 
66
      num_elements = 100
 
67
      
 
68
      status = he5_ehrdwrfile("extf1.dat",WRITE_NEW,
 
69
     1HE5T_NATIVE_INT,num_elements,datain1)
 
70
      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
 
71
 
 
72
      status = he5_ehrdwrfile("extf2.dat",WRITE_NEW,
 
73
     1HE5T_NATIVE_INT,num_elements,datain2)
 
74
      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
 
75
 
 
76
      status = he5_ehrdwrfile("extf3.dat",WRITE_NEW,
 
77
     1HE5T_NATIVE_INT,num_elements,datain3)
 
78
      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
 
79
 
 
80
!     Open HDF-EOS za file, "za.he5"
 
81
!     ------------------------------
 
82
          zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR)
 
83
      write(*,*) 'File ID returned from he5_zaopen():  ',zafid
 
84
 
 
85
          if (zafid .NE. FAIL) then
 
86
                 zaid = he5_zaattach(zafid, "ZA1")
 
87
         write(*,*) 'ZA ID returned from he5_zaattach():  ',zaid
 
88
 
 
89
                 if (zaid .NE. FAIL) then
 
90
                        
 
91
!     Read the external data field 
 
92
!     ----------------------------
 
93
      start(1)  = 0
 
94
      stride(1) = 1
 
95
      count(1)  = 60
 
96
 
 
97
      status = he5_zaread(zaid,"ExtData",
 
98
     1     start,stride,count,dataout)
 
99
      write(*,*) 'Status returned from he5_zaread():  ',status
 
100
 
 
101
 
 
102
!     Display the data
 
103
!     ----------------
 
104
      do i=1,60
 
105
         write(*,*)'External data',dataout(i)
 
106
      enddo
 
107
 
 
108
      nmlgth = 48
 
109
 
 
110
!     Get the number of external files
 
111
!     --------------------------------     
 
112
      nfiles = he5_zagetxdat(zaid,"ExtData",nmlgth,
 
113
     1     filelist,offset,size)
 
114
 
 
115
      write(*,*) 'Number of external files',nfiles
 
116
      write(*,*) 'External files:',filelist
 
117
      do i=1,nfiles
 
118
         write(*,*) 'offsets:',offset(i)
 
119
         write(*,*) 'sizes:',size(i)
 
120
      enddo
 
121
 
 
122
                 endif
 
123
          endif
 
124
        
 
125
!     Detach from za
 
126
!     --------------
 
127
          status = he5_zadetach(zaid)
 
128
      write(*,*) 'Status returned from he5_zadetach():  ',status
 
129
 
 
130
!     Close the file
 
131
!     --------------
 
132
          status = he5_zaclose(zafid)
 
133
      write(*,*) 'Status returned from he5_zaclose():  ',status
 
134
      
 
135
          stop
 
136
          end
 
137
 
 
138
 
 
139
 
 
140
 
 
141
 
 
142
 
 
143
 
 
144
 
 
145
 
 
146
 
 
147
 
 
148