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

« back to all changes in this revision

Viewing changes to samples/he5_sw_infoF_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 retrieve (1) information about the
 
2
c         dimensions, (2) the dimension mappings 
 
3
c     (geolocation relations),  and (3) the swath fields 
 
4
 
 
5
      program         he5_sw_infoF_32
 
6
 
 
7
      implicit        none
 
8
 
 
9
      include         'hdfeos5.inc'
 
10
 
 
11
          integer         i
 
12
          integer         status
 
13
          integer         swfid, swid
 
14
          integer         he5_swopen
 
15
          integer         he5_swattach
 
16
          integer         he5_swfldinfo
 
17
          integer         he5_swattrinfo
 
18
          integer         he5_swmapinfo
 
19
          integer         he5_swinqgfldalias
 
20
          integer         he5_swinqdfldalias
 
21
          integer         he5_swchunkinfo
 
22
          integer         he5_swdetach    
 
23
          integer         he5_swclose
 
24
          integer         rank(32)
 
25
          integer         ntype(32)
 
26
          integer         rk
 
27
          integer         nt
 
28
 
 
29
          integer*4       he5_swinqdims
 
30
          integer*4       he5_swinqmaps
 
31
          integer*4       he5_swinqgflds
 
32
          integer*4       he5_swinqdflds
 
33
          integer*4       he5_swdiminfo
 
34
          integer*4       he5_swimapinfo
 
35
          integer*4       he5_swinqimaps
 
36
          integer*4       n
 
37
          integer*4       offset
 
38
          integer*4       incr
 
39
          integer*4       ndims
 
40
          integer*4       nmaps
 
41
          integer*4       nflds
 
42
          integer*4       dims(32)
 
43
          integer*4       off(32)
 
44
          integer*4       inc(32)
 
45
          integer*4       sizes(8)
 
46
          integer*4       indx(32)
 
47
          integer*4       dimsize
 
48
          integer*4       count
 
49
 
 
50
          character*72    dimname
 
51
          character*72    dimmap
 
52
          character*72    dimlist
 
53
          character*72    maxdimlst
 
54
          character*72    fieldlist
 
55
 
 
56
          integer*4       nfldalias
 
57
          integer*4       strbufsize
 
58
 
 
59
          character*72    fldaliases
 
60
 
 
61
          integer         chunkrank
 
62
          integer*4       chunkdims(32)
 
63
 
 
64
 
 
65
          integer         FAIL
 
66
          parameter       (FAIL=-1)
 
67
 
 
68
      
 
69
c     Open the "swath.he5" file for "read only" access
 
70
c     ------------------------------------------------
 
71
          swfid = he5_swopen("swath.he5", HE5F_ACC_RDONLY)
 
72
      write(*,*) 'File ID returned by he5_swopen():  ',swfid
 
73
 
 
74
          if (swfid .NE. FAIL) then
 
75
           
 
76
c     Attach the swath
 
77
c     ----------------
 
78
                 swid = he5_swattach(swfid, "Swath1")
 
79
         write(*,*) 'Swath ID returned by he5_swattach():  ',swid
 
80
 
 
81
                 if (swid .NE. FAIL) then
 
82
                
 
83
c     Inquire Dimensions
 
84
c     ------------------                        
 
85
                        ndims = he5_swinqdims(swid, dimname, dims)
 
86
                        write(*,*) 'Dimension list: ', dimname
 
87
                        do i = 1,ndims
 
88
                           write(*,*) 'dim size: ', dims(i)
 
89
                        enddo
 
90
                        write(*,*)            
 
91
                                                
 
92
c     Inquire Dimension Mappings
 
93
c     --------------------------
 
94
                        nmaps = he5_swinqmaps(swid, dimmap, off, inc)
 
95
                        write(*,*) 'Dimension map: ', dimmap
 
96
                        do i = 1,nmaps
 
97
                           write(*,*) 'offset increment: ', off(i), inc(i)
 
98
                        enddo
 
99
                        write(*,*)
 
100
 
 
101
c     Inquire Indexed Dimension Mappings
 
102
c     ----------------------------------
 
103
                        nmaps = he5_swinqimaps(swid, dimmap, sizes)
 
104
                        write(*,*) 'Index Dimension map: ', dimmap
 
105
                        do i=1,nmaps
 
106
                           write(*,*) 'sizes: ', sizes(i)
 
107
                        enddo
 
108
                        write(*,*)            
 
109
                        
 
110
c     Inquire Geolocation Fields
 
111
c     --------------------------
 
112
                        nflds = he5_swinqgflds(swid, fieldlist, rank, ntype)
 
113
                        write(*,*) 'Geolocation fieldlist: ', fieldlist
 
114
                        do i=1,nflds
 
115
                           write(*,*) 'field rank & datatype: ',rank(i),ntype(i)
 
116
                        enddo
 
117
                        write(*,*) 
 
118
 
 
119
        nfldalias = he5_swinqgfldalias(swid,fldaliases,strbufsize)
 
120
        write(*,*) 'Fields & aliases list: ',fldaliases
 
121
        write(*,*) 'Length of list is ',strbufsize
 
122
              
 
123
c     Inquire Data Fields             
 
124
c     -------------------                       
 
125
                        nflds = he5_swinqdflds(swid, fieldlist, rank, ntype)
 
126
                        write(*,*) 'Data Fieldlist: ', fieldlist
 
127
                        do i=1,nflds
 
128
                           write(*,*) 'field rank & datatype: ',rank(i),ntype(i)
 
129
                        enddo
 
130
                        write(*,*) 
 
131
 
 
132
        nfldalias = he5_swinqdfldalias(swid,fldaliases,strbufsize)
 
133
        write(*,*) 'Fields & aliases list: ',fldaliases
 
134
        write(*,*) 'Length of list is ',strbufsize
 
135
 
 
136
                        
 
137
c     Get info on "GeoTrack" dim
 
138
c     --------------------------                        
 
139
              dimsize = he5_swdiminfo(swid, "GeoTrack")
 
140
              write(*,*) 'Size of GeoTrack: ', dimsize
 
141
              write(*,*)
 
142
              
 
143
 
 
144
c     Get info on "GeoTrack/Res2tr" mapping
 
145
c     -------------------------------------               
 
146
              status = he5_swmapinfo(swid,"GeoTrack","Res2tr",
 
147
     1         offset,incr)           
 
148
              write(*,*) 'Mapping Offset: ', offset
 
149
              write(*,*) 'Mapping Increment: ', incr
 
150
              write(*,*)
 
151
 
 
152
 
 
153
c     Get info on "IndxTrack/Res2tr" indexed mapping
 
154
c     ----------------------------------------------              
 
155
              n = he5_swimapinfo(swid, "IndxTrack", "Res2tr", indx)
 
156
              do i=1,n
 
157
                         write(*,*) 'Index Mapping Entry ', i, indx(i)
 
158
              enddo
 
159
              write(*,*)
 
160
              
 
161
c     Get info on "Longitude" Field
 
162
c     -----------------------------               
 
163
              status = he5_swfldinfo(swid,"Longitude",rk,dims,nt,
 
164
     1         dimlist,maxdimlst)
 
165
              write(*,*) 'Longitude Rank: ', rk
 
166
              write(*,*) 'Longitude NumberType: ', nt
 
167
              write(*,*) 'Longitude Dimlist: ', dimlist
 
168
              write(*,*) 'Longitude Max Dimlist: ', maxdimlst
 
169
              do i=1,rk
 
170
                         write(*,*) 'Dimension ',i,dims(i)
 
171
              enddo
 
172
 
 
173
                status = he5_swattrinfo(swid,"GLOBAL_CHAR_ATTR",nt,count)
 
174
              write(*,*) 'GLOBAL_CHAR_ATTR NumberType: ', nt
 
175
              write(*,*) 'GLOBAL_CHAR_ATTR size: ', count
 
176
 
 
177
              status = he5_swchunkinfo(swid,"Spectra",chunkrank,
 
178
     1         chunkdims)
 
179
              write(*,*) 'Spectra Chunking Rank: ', chunkrank
 
180
              do i=1,chunkrank
 
181
                         write(*,*) 'Chunking Dimension ',i,chunkdims(i)
 
182
              enddo
 
183
 
 
184
 
 
185
           endif
 
186
          endif
 
187
          
 
188
c     Detach from swath
 
189
c     -----------------
 
190
          status = he5_swdetach(swid)
 
191
      write(*,*) 'Status returned by he5_swdetach():  ',status
 
192
 
 
193
c     Close the file
 
194
c     --------------
 
195
          status = he5_swclose(swfid)
 
196
      write(*,*) 'Status returned by he5_swclose():  ',status
 
197
 
 
198
          stop
 
199
          end
 
200
 
 
201
 
 
202
 
 
203
 
 
204
 
 
205
 
 
206
 
 
207