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

« back to all changes in this revision

Viewing changes to samples/he5_sw_readdataF_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
c     In this program we (1) open the "swath.he5" file, (2) attach to
 
2
c     the "Swath1" swath, and (3) read data from the "Longitude" field
 
3
c     ================================================================
 
4
 
 
5
      program            he5_sw_readdataF_32
 
6
 
 
7
      implicit           none
 
8
 
 
9
      include            'hdfeos5.inc'
 
10
 
 
11
      integer            status
 
12
      integer            he5_swopen
 
13
      integer            he5_swattach
 
14
      integer            he5_swrdfld
 
15
      integer            he5_swrdattr
 
16
      integer            he5_prread
 
17
      integer            he5_swdetach
 
18
      integer            he5_swclose
 
19
      integer            swfid, swid
 
20
      integer            buffer_out(250)
 
21
      integer            i,j,j1
 
22
      integer            element1(25)
 
23
      integer            element2(50)
 
24
      integer            element3(75)
 
25
      integer            element4(100)
 
26
 
 
27
      real*4             lng(10,20)
 
28
      real*4             temp(10,20)
 
29
 
 
30
      integer*4          attr(4)
 
31
 
 
32
      integer*4          start(2)
 
33
      integer*4          stride(2)
 
34
      integer*4          count(2)
 
35
      integer*4          len(4)
 
36
      
 
37
      integer            FAIL
 
38
      parameter          (FAIL=-1)
 
39
      
 
40
c     Open HDF-EOS swath file, "swath.he5"
 
41
c     -----------------------------------
 
42
          swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY)
 
43
      write(*,*) 'File ID returned by he5_swopen():  ',swfid
 
44
 
 
45
          if (swfid .NE. FAIL) then
 
46
                 swid = he5_swattach(swfid, "Swath1")
 
47
         write(*,*) 'Swath ID returned by he5_swattach():  ',swid
 
48
 
 
49
                 if (swid .NE. FAIL) then
 
50
                        
 
51
              
 
52
c     Read the entire Longitude field
 
53
c     -------------------------------
 
54
                        start(1)  = 0
 
55
                        start(2)  = 0
 
56
                        stride(1) = 1
 
57
                        stride(2) = 1
 
58
                        count(1)  = 10
 
59
                        count(2)  = 20
 
60
            
 
61
                        status = he5_swrdfld(swid,"Longitude",
 
62
     1           start,stride,count,lng)
 
63
            
 
64
                        do i=1,20
 
65
                           do j=1,10
 
66
                                  write(*,*)'i j Longitude ',i,j,lng(j,i)
 
67
                           enddo
 
68
                        enddo
 
69
 
 
70
                        start(1)  = 0
 
71
                        start(2)  = 0
 
72
                        stride(1) = 1
 
73
                        stride(2) = 1
 
74
                        count(1)  = 10
 
75
                        count(2)  = 20
 
76
 
 
77
                        status = he5_swrdfld(swid,"L2gpValue",
 
78
     1           start,stride,count,temp)
 
79
 
 
80
                        do i=1,20
 
81
                           do j=1,10
 
82
                               write(*,*)'i j L2gpValue ',i,j,temp(j,i)
 
83
                           enddo
 
84
                        enddo
 
85
 
 
86
 
 
87
c     Read data from the Profile
 
88
c     --------------------------
 
89
                        start(1)  = 0
 
90
                        stride(1) = 1
 
91
                        count(1)  = 4
 
92
 
 
93
      status = he5_prread(swid,"Profile-2000",start,stride,count,
 
94
     1len,buffer_out)
 
95
      write(*,*) '   '
 
96
      write(*,*) 'Status returned from he5_prread:  ',status
 
97
 
 
98
c     Display the Profile data
 
99
c     ------------------------
 
100
      do i=1,4
 
101
         write(*,*) 'len(',i,'):  ',len(i)
 
102
      enddo
 
103
 
 
104
      write(*,*) '   '
 
105
      write(*,*) 'buffer_out:  '
 
106
      write(*,*)  buffer_out
 
107
      write(*,*) '   '
 
108
 
 
109
      j = 0
 
110
      do i=1,25
 
111
        element1(i) = buffer_out(i)      
 
112
        j = j + 1
 
113
      enddo  
 
114
      write(*,*) '1st element: '
 
115
      write(*,*) element1
 
116
      write(*,*) '   '
 
117
 
 
118
      j1 = j
 
119
      do i=1,50
 
120
        element2(i) = buffer_out(j1 + i)      
 
121
        j = j + 1
 
122
      enddo  
 
123
      write(*,*) '2nd element: '
 
124
      write(*,*) element2
 
125
      write(*,*) '   '
 
126
 
 
127
      j1 = j
 
128
      do i=1,75
 
129
        element3(i) = buffer_out(j1 + i)      
 
130
        j = j + 1
 
131
      enddo  
 
132
      write(*,*) '3rd element: '
 
133
      write(*,*) element3
 
134
      write(*,*) '   '
 
135
 
 
136
      j1 = j
 
137
      do i=1,100
 
138
        element4(i) = buffer_out(j1 + i)      
 
139
        j = j + 1
 
140
      enddo  
 
141
      write(*,*) '4th element: '
 
142
      write(*,*) element4
 
143
      write(*,*) '   '
 
144
         
 
145
c     Read Attribute
 
146
c     --------------          
 
147
                        status = he5_swrdattr(swid, "TestAttr", attr)
 
148
                        do i=1,4
 
149
                           write(*,*) 'Attribute Element', i, ':', attr(i)
 
150
                        enddo         
 
151
                        
 
152
                 endif
 
153
          endif
 
154
      
 
155
c     Detach from swath
 
156
c     -----------------
 
157
          status = he5_swdetach(swid)
 
158
      write(*,*) 'Status returned from he5_swdetach:  ',status
 
159
 
 
160
c     Close the file
 
161
c     --------------
 
162
          status = he5_swclose(swfid)
 
163
      write(*,*) 'Status returned from he5_swclose:  ',status
 
164
 
 
165
          stop
 
166
          end
 
167
 
 
168
 
 
169
 
 
170
 
 
171
 
 
172
 
 
173
 
 
174
 
 
175
 
 
176
 
 
177
 
 
178
 
 
179
 
 
180
 
 
181
 
 
182
 
 
183