File: he5_sw_setupF_32.f

package info (click to toggle)
hdf-eos5 2%3A2.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,692 kB
  • sloc: ansic: 92,051; fortran: 31,463; sh: 11,395; makefile: 492
file content (177 lines) | stat: -rwxr-xr-x 5,294 bytes parent folder | download | duplicates (9)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
c     In this program we (1) open an HDF-EOS file, (2) create the 
c     swath interface, and (3) define the swath field dimensions
c     ===========================================================
      
      program    he5_sw_setupF_32

      implicit   none

      include    'hdfeos5.inc'

      integer    status
      integer    he5_swopen
      integer    he5_swcreate
      integer    he5_swdefdim
      integer    he5_swdefmap
      integer    he5_swdefimap
      integer    he5_swdetach
      integer    he5_swclose
      integer    swfid, swid

      integer*4  dtrack, extdata
      integer*4  offset, incr
      integer*4  indx(12) 

      data indx  /0,1,3,6,7,8,11,12,14,24,32,39/

c     Open the HDF-EOS file, "swath.he5" using "TRUNC" file access code 
c     -----------------------------------------------------------------
      swfid = he5_swopen('swath.he5',HE5F_ACC_TRUNC)
      write(*,*) 'File ID returned by he5_swopen():  ',swfid

c     Create the swath, "Swath1", within the file 
c     -------------------------------------------
      swid = he5_swcreate(swfid, "Swath1")
      write(*,*) 'Swath ID returned by he5_swcreate():  ',swid
    
c     Define Geolocation and Data dimensions
c     --------------------------------------
c     ----------------------------------------------------------------------
c     Typically, many fields within a swath share the same dimension. The
c     swath interface therefore provides a way of defining dimensions that
c     will then be used to define swath fields.  A dimension is defined with
c     a name and a size and is connected to the particular swath through the
c     swath id.  In this example, we define the geo- location track and
c     cross track dimensions with size 20 and 10 respectively and two
c     dimensions corresponding to these but with twice the resolution.
c     Also, we define "Bands" and "unlimited" dimensions.
c     ----------------------------------------------------------------------
      dtrack = 20
      status = he5_swdefdim(swid, "GeoTrack", dtrack)
      write(*,*) 'Status returned by he5_swdefdim():  ',status

      dtrack = 10
      status = he5_swdefdim(swid, "GeoXtrack", dtrack)
      write(*,*) 'Status returned by he5_swdefdim():  ',status

      dtrack = 40
      status = he5_swdefdim(swid, "Res2tr", dtrack)
      write(*,*) 'Status returned by he5_swdefdim():  ',status

      dtrack = 20
      status = he5_swdefdim(swid, "Res2xtr", dtrack)
      write(*,*) 'Status returned by he5_swdefdim():  ',status

      dtrack = 15
      status = he5_swdefdim(swid, "Bands", dtrack)
      write(*,*) 'Status returned by he5_swdefdim():  ',status

      dtrack = 12
      status = he5_swdefdim(swid, "IndxTrack", dtrack)
      write(*,*) 'Status returned by he5_swdefdim():  ',status

      dtrack = 4
      status = he5_swdefdim(swid, "ProfDim", dtrack)
      write(*,*) 'Status returned by he5_swdefdim():  ',status

c     Define "External" dimension
c     ---------------------------
      extdata = 60
      status = he5_swdefdim(swid, "ExtDim", extdata)
      write(*,*) 'Status returned by he5_swdefdim():  ',status

c     Define Unlimited (appendable) dimension
c     ---------------------------------------
      status = he5_swdefdim(swid, "Unlim", HE5S_UNLIMITED_F)
      write(*,*) 'Status returned by he5_swdefdim():  ',status

c     ----------------------------------------------------------------------
c     Once the dimensions are defined, the relationship (mapping)between the
c     geolocation dimensions, such as track and cross track, and the data
c     dimensions, must be established.  This is done through the SWdefdimmap
c     routine.  It takes as input the swath id, the names of the dimensions
c     designating the geolocation and data dimensions, respectively, and the
c     offset and increment defining the relation.
c     
c     In the first example we relate the "GeoTrack" and "Res2tr" dimensions
c     with an offset of 0 and an increment of 2.  Thus the ith element of
c     "Geotrack" corresponds to the 2 * ith element of "Res2tr".
c   
c     In the second example, the ith element of "GeoXtrack" corresponds to 
c     the 2 * ith + 1 element of "Res2xtr".
c     -----------------------------------------------------------------------  
      
c     Define dimension mappings
c     -------------------------
      offset = 0
      incr   = 2
      status = he5_swdefmap(swid, "GeoTrack", 
     1     "Res2tr", offset, incr)
      write(*,*) 'Status returned by he5_swdefmap():  ',status

      offset = 1
      status = he5_swdefmap(swid, "GeoXtrack", 
     1     "Res2xtr", offset, incr)
      write(*,*) 'Status returned by he5_swdefmap():  ',status

c     Define indexed dimension mapping
c     --------------------------------
      status = he5_swdefimap(swid, "IndxTrack", 
     1     "Res2tr", indx)
      write(*,*) 'Status returned by he5_swdefimap():  ',status

c     Detach from the swath
c     ---------------------
      status = he5_swdetach(swid)
      write(*,*) 'Status returned by he5_swdetach():  ',status

c     Close the swath file
c     --------------------
      status = he5_swclose(swfid)
      write(*,*) 'Status returned by he5_swclose():  ',status

      stop
      end