-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdimg.html
211 lines (132 loc) · 16 KB
/
dimg.html
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.77 [en] (X11; U; Linux 2.4.3-20mdk i686) [Netscape]">
<meta name="AUTHOR" content="Jean-Marc">
<meta name="CREATED" content="20011123;14065100">
<meta name="CHANGEDBY" content="Jean-Marc">
<meta name="CHANGED" content="20011123;17344700">
</head>
<body>
<h1>
Le format DIMG</h1>
<span STYLE="text-decoration: none"><span STYLE="font-weight: medium">Le
format dimg a été développé pour le projet
CLIPPER afin d'étendre le concept du format <a href="bimg.html">bimg</a>
à des fichiers d'acces direct, seuls utiles pour des simulations
tournant sur ordinateur massivement parrallele en mémoire distribuée.</span></span>
<p STYLE="font-weight: medium; text-decoration: none">Ce format a l'avantage
d'être compact et pratiquement autodescriptif (si on se limite à
des grilles régulières). On retrouve a peu de choses prés
les éléments qui composent un fichier bimg, mais sous une
forme d'acces direct.
<p STYLE="font-weight: medium; text-decoration: none">Chaque fichier bimg
est un fichier de type binaire, 'unformatted', à accès direct.
Le premier record est réservé pour une entête qui contient
l'info concernant le fichier, ( en particulier la longueur en octets des
records) puis à partir du record 2, les données sont stockées,
1 champs 2D/record.
<p STYLE="font-weight: medium; text-decoration: none">Plutot q'un long
discours, je propose de de commenter un programme f77 lisant un fichier
dimg, pour expliquer le format:
<br>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> PROGRAM dimg_demo_lec</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> IMPLICIT NONE</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> INTEGER jpi,jpj,jpk,jpt,jpdim</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> PARAMETER (jpi=100,jpj=100,jpk=20)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> PARAMETER (jpt=100,jpdim=2)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> CHARACTER*80 comment1</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> CHARACTER*4 cVER</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> INTEGER irecl, irec</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> INTEGER ni,nj,nk,nt,ndim ! Real dimension of the fields</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> REAL x1, y1, dx, dy , spval ! x1 = x of point(1,1)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C ! y1 = y of point (1,1)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C ! dx = x-grid spacing</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C ! dy = y-grid spacing</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C ! spval : missing/bad/masked</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C ! values are supposed spval</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> REAL dep(jpk) ! array for vertical dep</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> REAL time(jpt) ! array for times</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> REAL ptab(jpi,jpj,jpk,jpt,jpdim) ! data array</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C ! In application it can be</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C ! only 2D (jpi,jpj)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C various</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> INTEGER numdimg ! logical unit for dimgfile</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> INTEGER ji,jj,jk,jt,jdim ! loop counter</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>CCC</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>CC Open file the first time with dummy record length:</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>CC</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> numdimg=10</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> OPEN(numdimg,FILE='dimgfile',</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> . FORM ='UNFORMATTED',</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> . ACCESS ='DIRECT',</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> . RECL =88)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> READ(numdimg,REC=1) cVER,comment1,irecl</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> CLOSE(numdimg)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> IF ( cVER .NE. '@!01' ) THEN</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> PRINT *,' This file is not DIMG file'</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> STOP</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> END IF</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> OPEN(numdimg,FILE='dimgfile',</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> . FORM ='UNFORMATTED',</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> . ACCESS ='DIRECT',</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> . RECL =irecl)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> READ(numdimg,REC=1) cVER,comment1,irecl,</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> . ni,nj,nk,nt,ndim,</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> . x1,y1,dx,dy,spval,</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> . (dep(jk),jk=1,nk),</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> . (time(jt),jt=1,nt)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C Enter the time loop</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> DO jt = 1, nt</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C enter vertical loop</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> DO jk=1,nk</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C at each level, many 'dimensions' can exists e.g. u,v,w for 3d vector</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> DO jdim = 1,ndim</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C compute record number corresponding to (jt,jk,jdim):</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> irec = 2 + (jt -1)*nk*ndim + (jk -1 )*ndim + (jdim -1)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C Note that the i,j loops are implicit: ! rec hold 1 2D field.</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> READ(numdimg,REC=irec)(( ptab(ji,jj,jk,jt,jdim),ji=1,ni),jj=1,nj)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C IF we use only 2D array, this is the place to work with the current</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C 2D field at ime jt, dep jk and dim jdim ...</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C</font></font></pre>
<pre><font face="Courier, monospace"><font size=+2>C...</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C...</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> END DO</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> END DO</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> END DO</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> CLOSE(numdimg)</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2>C Now enjoy working with ptab ...</font></font></pre>
<pre STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Courier, monospace"><font size=+2> END</font></font></pre>
<p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<p STYLE="margin-bottom: 0cm; font-weight: medium; text-decoration: none"><font face="Times, serif"><font size=-1>Le
format dimg est donc tres simple à lire ou à écrire.
Si l'on travaille avec une grille irrégulière, on définit
cette grille dans un fichier <font color="#FF3333">bimg</font> indépendant
á 1 niveau, 2 dim qui contient comme données, sur la dimension
1, les valeurs x(ji,jj) et sur la dimension 2 les valeurs y(ji,jj).</font></font>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>