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

« back to all changes in this revision

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