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

« back to all changes in this revision

Viewing changes to samples/he5_pt_updatelevelsF_32_a.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
 
 
4
 
 
5
      program       he5_pt_updatelevelsF_32
 
6
 
 
7
      integer       status
 
8
      integer       ptfid 
 
9
      integer       ptid
 
10
      integer       level
 
11
      integer       rank, datatype
 
12
 
 
13
      integer*4     recs(32)
 
14
      integer*4     nrec
 
15
 
 
16
      integer*4     dimens(2)
 
17
      integer*4     num_elements
 
18
 
 
19
      real*4        concentration_tt(4)
 
20
      real*4        conc(15,4)
 
21
      real*4        conc_tt(4)
 
22
      real*4        outconc(4,15)
 
23
      real*8        time(15)
 
24
      real*8        time_tt
 
25
 
 
26
      character*8   spc(15)
 
27
      character*8   spc_tt
 
28
 
 
29
      character*80  fieldname
 
30
 
 
31
      integer       datasize_time
 
32
      integer       datasize_conc
 
33
      integer       datasize_spc
 
34
      integer       dtype(3)
 
35
 
 
36
      integer       he5_ptopen
 
37
      integer       he5_ptattach
 
38
      integer       he5_ptupdatelevel 
 
39
      integer       he5_ptdetach 
 
40
      integer       he5_ptclose
 
41
 
 
42
 
 
43
c     Open the HDF-EOS point file, "point.he5"
 
44
c     ----------------------------------------
 
45
      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR)
 
46
      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
 
47
 
 
48
c     Read Simple Point 
 
49
c     ----------------- 
 
50
      ptid = HE5_PTattach(ptfid, "Simple Point")
 
51
      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
 
52
 
 
53
 
 
54
      open(unit=1, file='simple_a.txt', status='OLD')
 
55
 
 
56
      n = 0
 
57
      do 10 i=1,1000
 
58
         read(1, *, end=100) time_tt, concentration_tt(1), 
 
59
     1                                concentration_tt(2), 
 
60
     2                                concentration_tt(3),
 
61
     3                                concentration_tt(4), 
 
62
     4                                spc_tt
 
63
         time(i)     = time_tt
 
64
         conc(i,1)   = concentration_tt(1)
 
65
         conc(i,2)   = concentration_tt(2)
 
66
         conc(i,3)   = concentration_tt(3)
 
67
         conc(i,4)   = concentration_tt(4)
 
68
         spc(i)      = spc_tt
 
69
 
 
70
         n = n + 1
 
71
   10 continue
 
72
 
 
73
  100 close(unit=1)
 
74
 
 
75
 
 
76
      print *,'n = ',n
 
77
      do i = 1,n
 
78
        print *,time(i)
 
79
        print *,conc(i,1),conc(i,2),conc(i,3),conc(i,4)
 
80
        print *,spc(i)
 
81
      end do
 
82
 
 
83
c.....specify the storage size of each atomic field
 
84
      datasize_time  = 8
 
85
      datasize_conc  = 4*4
 
86
      datasize_spc   = 8*1
 
87
 
 
88
      dtype(1)     =  HE5T_NATIVE_DOUBLE
 
89
      dtype(2)     =  HE5T_NATIVE_FLOAT
 
90
      dtype(3)     =  HE5T_NATIVE_CHAR
 
91
 
 
92
 
 
93
cc... One way that works
 
94
      nrec      = 0
 
95
      recs(1)   = 0
 
96
 
 
97
cc... Another way that works 
 
98
cc      nrec      = n
 
99
cc      do i = 1,n
 
100
cc         recs(i)   = i-1
 
101
cc      end do
 
102
 
 
103
      level     = 0
 
104
 
 
105
      fieldname = 'Concentration'
 
106
 
 
107
cc      conc_tt(1)   = 1.11
 
108
cc      conc_tt(2)   = 2.22
 
109
cc      conc_tt(3)   = 3.33
 
110
cc      conc_tt(4)   = 4.44
 
111
 
 
112
 
 
113
c.....Convert array to 'C' order
 
114
      dimens(1) = 15
 
115
      dimens(2) = 4
 
116
      rank      = 2
 
117
      datatype  = HE5T_NATIVE_FLOAT
 
118
 
 
119
      num_elements   = he5_ptfort2c(dimens, rank, datatype, conc, 
 
120
     1outconc)
 
121
      write(*,*) 'num_elements returned by he5_ptfort2c():  ',num_elements
 
122
 
 
123
c      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
 
124
c     1recs, datasize_conc, dtype(2), conc)
 
125
      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
 
126
     1recs, datasize_conc, dtype(2), outconc)
 
127
      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
 
128
 
 
129
cc      print *,nrec
 
130
cc      print *,recs
 
131
 
 
132
      fieldname = 'Time'
 
133
 
 
134
cc      time_tt   = 13131313.0
 
135
 
 
136
      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
 
137
     1recs, datasize_time, dtype(1), time)
 
138
      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
 
139
 
 
140
cc      print *,nrec
 
141
cc      print *,recs
 
142
 
 
143
      fieldname = 'Species'
 
144
 
 
145
cc      spc_tt    = 'AM'
 
146
 
 
147
      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
 
148
     1recs, datasize_spc, dtype(3), spc)
 
149
      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
 
150
 
 
151
cc      print *,nrec
 
152
cc      print *,recs
 
153
 
 
154
 
 
155
 
 
156
c.....Close out the point interface
 
157
      status = he5_ptdetach(ptid)
 
158
      write(*,*) 'Status returned by he5_ptdetach():  ',status
 
159
 
 
160
 
 
161
      status = he5_ptclose(ptfid)
 
162
      write(*,*) 'Status returned by he5_ptclose():  ',status
 
163
 
 
164
 
 
165
      stop
 
166
      end
 
167
 
 
168
 
 
169
 
 
170
 
 
171
 
 
172
 
 
173
 
 
174
 
 
175
 
 
176
 
 
177
 
 
178
 
 
179
 
 
180