1 |
C $Header: /u/gcmpack/MITgcm/pkg/mdsio/mdsio_rw_field.F,v 1.3 2009/08/05 23:17:54 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "MDSIO_OPTIONS.h" |
5 |
|
6 |
C-- File mdsio_rw_field.F: old version of MDSIO READ/WRITE FIELD S/R with |
7 |
C fewer arguments (kept for backward compatibility): call new MDSIO S/R |
8 |
C with fixed additional arguments |
9 |
C-- Contents |
10 |
C-- o MDSREADFIELD |
11 |
C-- o MDSREADFIELD_LOC |
12 |
C-- o MDSWRITEFIELD |
13 |
C-- o MDSWRITEFIELD_LOC |
14 |
|
15 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
16 |
|
17 |
SUBROUTINE MDSREADFIELD( |
18 |
I fName, |
19 |
I filePrec, |
20 |
I arrType, |
21 |
I nNz, |
22 |
O arr, |
23 |
I irecord, |
24 |
I myThid ) |
25 |
C |
26 |
C Arguments: |
27 |
C |
28 |
C fName (string) :: base name for file to written |
29 |
C filePrec (integer) :: number of bits per word in file (32 or 64) |
30 |
C arrType (char(2)) :: declaration of "arr": either "RS" or "RL" |
31 |
C nNz (integer) :: size of third dimension: normally either 1 or Nr |
32 |
C arr ( RS/RL ) :: array to write, arr(:,:,nNz,:,:) |
33 |
C irecord (integer) :: record number to read |
34 |
C myThid (integer) :: thread identifier |
35 |
C |
36 |
C Routine now calls MDS_READ_FIELD, just a way to add 2 extra arguments |
37 |
C to the argument list. The 1rst new argument is to make the difference between |
38 |
C the vertical dimension (3rd dimension) of the output array and the number |
39 |
C of levels to read in. This routine assumes they are the same. |
40 |
C The 2nd new argument (useCurrentDir=.FALSE.) allows to read files from |
41 |
C the "mdsioLocalDir" directory (if it is set). |
42 |
|
43 |
IMPLICIT NONE |
44 |
C Global variables / COMMON blocks |
45 |
#include "SIZE.h" |
46 |
c #include "EEPARAMS.h" |
47 |
|
48 |
C Routine arguments |
49 |
CHARACTER*(*) fName |
50 |
INTEGER filePrec |
51 |
CHARACTER*(2) arrType |
52 |
INTEGER nNz |
53 |
_RL arr(*) |
54 |
INTEGER irecord |
55 |
INTEGER myThid |
56 |
|
57 |
#ifdef ALLOW_AUTODIFF |
58 |
C Local variables |
59 |
_RL dummyRL(1) |
60 |
_RS dummyRS(1) |
61 |
|
62 |
IF ( arrType.EQ.'RL' ) THEN |
63 |
CALL MDS_READ_FIELD( |
64 |
I fName, filePrec, .FALSE., arrType, nNz, 1, nNz, |
65 |
O arr, dummyRS, |
66 |
I irecord, myThid ) |
67 |
ELSE |
68 |
CALL MDS_READ_FIELD( |
69 |
I fName, filePrec, .FALSE., arrType, nNz, 1, nNz, |
70 |
O dummyRL, arr, |
71 |
I irecord, myThid ) |
72 |
ENDIF |
73 |
|
74 |
#else /* ALLOW_AUTODIFF */ |
75 |
STOP 'ABNORMAL END: S/R MDSREADFIELD is retired' |
76 |
#endif /* ALLOW_AUTODIFF */ |
77 |
|
78 |
RETURN |
79 |
END |
80 |
|
81 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
82 |
|
83 |
SUBROUTINE MDSREADFIELD_LOC( |
84 |
I fName, |
85 |
I filePrec, |
86 |
I arrType, |
87 |
I nNz, |
88 |
O arr, |
89 |
I irecord, |
90 |
I myThid ) |
91 |
C |
92 |
C Arguments: |
93 |
C |
94 |
C fName (string) :: base name for file to write |
95 |
C filePrec (integer) :: number of bits per word in file (32 or 64) |
96 |
C arrType (char(2)) :: declaration of "arr": either "RS" or "RL" |
97 |
C nNz (integer) :: size of third dimension: normally either 1 or Nr |
98 |
C arr ( RS/RL ) :: array to write, arr(:,:,nNz,:,:) |
99 |
C irecord (integer) :: record number to read |
100 |
C myThid (integer) :: thread identifier |
101 |
C |
102 |
C Routine now calls MDS_READ_FIELD, just a way to add 2 extra arguments |
103 |
C to the argument list. The 1rst new argument is to make the difference between |
104 |
C the vertical dimension (3rd dimension) of the output array and the number |
105 |
C of levels to read in. This routine assumes they are the same. |
106 |
C The 2nd new argument (useCurrentDir=.FALSE.) forces to ignore the |
107 |
C "mdsioLocalDir" parameter and to always read from the current directory. |
108 |
|
109 |
IMPLICIT NONE |
110 |
C Global variables / COMMON blocks |
111 |
#include "SIZE.h" |
112 |
c #include "EEPARAMS.h" |
113 |
|
114 |
C Routine arguments |
115 |
CHARACTER*(*) fName |
116 |
INTEGER filePrec |
117 |
CHARACTER*(2) arrType |
118 |
INTEGER nNz |
119 |
_RL arr(*) |
120 |
INTEGER irecord |
121 |
INTEGER myThid |
122 |
|
123 |
#ifdef ALLOW_AUTODIFF |
124 |
C Local variables |
125 |
_RL dummyRL(1) |
126 |
_RS dummyRS(1) |
127 |
|
128 |
IF ( arrType.EQ.'RL' ) THEN |
129 |
CALL MDS_READ_FIELD( |
130 |
I fName, filePrec, .TRUE., arrType, nNz, 1, nNz, |
131 |
O arr, dummyRS, |
132 |
I irecord, myThid ) |
133 |
ELSE |
134 |
CALL MDS_READ_FIELD( |
135 |
I fName, filePrec, .TRUE., arrType, nNz, 1, nNz, |
136 |
O dummyRL, arr, |
137 |
I irecord, myThid ) |
138 |
ENDIF |
139 |
|
140 |
#else /* ALLOW_AUTODIFF */ |
141 |
STOP 'ABNORMAL END: S/R MDSREADFIELD_LOC is empty' |
142 |
#endif /* ALLOW_AUTODIFF */ |
143 |
|
144 |
RETURN |
145 |
END |
146 |
|
147 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
148 |
|
149 |
SUBROUTINE MDSWRITEFIELD( |
150 |
I fName, |
151 |
I filePrec, |
152 |
I globalFile, |
153 |
I arrType, |
154 |
I nNz, |
155 |
I arr, |
156 |
I irecord, |
157 |
I myIter, |
158 |
I myThid ) |
159 |
C |
160 |
C Arguments: |
161 |
C |
162 |
C fName (string) :: base name for file to write |
163 |
C filePrec (integer) :: number of bits per word in file (32 or 64) |
164 |
C globalFile (logical):: selects between writing a global or tiled file |
165 |
C arrType (char(2)) :: declaration of "arr": either "RS" or "RL" |
166 |
C nNz (integer) :: size of third dimension: normally either 1 or Nr |
167 |
C arr ( RS/RL ) :: array to write, arr(:,:,nNzdim,:,:) |
168 |
C irecord (integer) :: record number to write |
169 |
C myIter (integer) :: time step number |
170 |
C myThid (integer) :: thread identifier |
171 |
C |
172 |
C Routine now calls MDS_WRITE_FIELD, just a way to add 2 extra arguments |
173 |
C to the argument list. The 1rst new argument is to make the difference between |
174 |
C the vertical dimension (3rd dimension) of an array and the number of levels |
175 |
C the output routine should process. This routine assumes they are the same. |
176 |
C The 2nd new argument (useCurrentDir=.FALSE.) allows to write files to |
177 |
C the "mdsioLocalDir" directory (if it is set). |
178 |
|
179 |
IMPLICIT NONE |
180 |
C Global variables / common blocks |
181 |
#include "SIZE.h" |
182 |
c #include "EEPARAMS.h" |
183 |
|
184 |
C Routine arguments |
185 |
CHARACTER*(*) fName |
186 |
INTEGER filePrec |
187 |
LOGICAL globalFile |
188 |
CHARACTER*(2) arrType |
189 |
INTEGER nNz |
190 |
_RL arr(1-oLx:sNx+oLx,1-oLy:sNy+oLy,nNz,nSx,nSy) |
191 |
INTEGER irecord |
192 |
INTEGER myIter |
193 |
INTEGER myThid |
194 |
|
195 |
#ifdef ALLOW_AUTODIFF |
196 |
C Local variables |
197 |
_RL dummyRL(1) |
198 |
_RS dummyRS(1) |
199 |
|
200 |
IF ( arrType.EQ.'RL' ) THEN |
201 |
CALL MDS_WRITE_FIELD( |
202 |
I fName, filePrec, globalFile, .FALSE., |
203 |
I arrType, nNz, 1, nNz, arr, dummyRS, |
204 |
I irecord, myIter, myThid ) |
205 |
ELSE |
206 |
CALL MDS_WRITE_FIELD( |
207 |
I fName, filePrec, globalFile, .FALSE., |
208 |
I arrType, nNz, 1, nNz, dummyRL, arr, |
209 |
I irecord, myIter, myThid ) |
210 |
ENDIF |
211 |
|
212 |
#else /* ALLOW_AUTODIFF */ |
213 |
STOP 'ABNORMAL END: S/R MDSWRITEFIELD is retired' |
214 |
#endif /* ALLOW_AUTODIFF */ |
215 |
|
216 |
RETURN |
217 |
END |
218 |
|
219 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
220 |
|
221 |
SUBROUTINE MDSWRITEFIELD_LOC( |
222 |
I fName, |
223 |
I filePrec, |
224 |
I globalFile, |
225 |
I arrType, |
226 |
I nNz, |
227 |
I arr, |
228 |
I irecord, |
229 |
I myIter, |
230 |
I myThid ) |
231 |
C |
232 |
C Arguments: |
233 |
C |
234 |
C fName (string) :: base name for file to write |
235 |
C filePrec (integer) :: number of bits per word in file (32 or 64) |
236 |
C globalFile (logical):: selects between writing a global or tiled file |
237 |
C arrType (char(2)) :: declaration of "arr": either "RS" or "RL" |
238 |
C nNz (integer) :: size of third dimension: normally either 1 or Nr |
239 |
C arr ( RS/RL ) :: array to write, arr(:,:,nNzdim,:,:) |
240 |
C irecord (integer) :: record number to write |
241 |
C myIter (integer) :: time step number |
242 |
C myThid (integer) :: thread identifier |
243 |
C |
244 |
C Routine now calls mdswritefield_new, just a way to add 2 extra arguments |
245 |
C to the argument list. The 1rst new argument is to make the difference between |
246 |
C the vertical dimension (3rd dimension) of an array and the number of levels |
247 |
C the output routine should process. This routine assumes they are the same. |
248 |
C The 2nd new argument (useCurrentDir=.TRUE.) forces to ignore the |
249 |
C "mdsioLocalDir" parameter and to always write to the current directory. |
250 |
|
251 |
IMPLICIT NONE |
252 |
C Global variables / common blocks |
253 |
#include "SIZE.h" |
254 |
c #include "EEPARAMS.h" |
255 |
|
256 |
C Routine arguments |
257 |
CHARACTER*(*) fName |
258 |
INTEGER filePrec |
259 |
LOGICAL globalFile |
260 |
CHARACTER*(2) arrType |
261 |
INTEGER nNz |
262 |
_RL arr(1-oLx:sNx+oLx,1-oLy:sNy+oLy,nNz,nSx,nSy) |
263 |
INTEGER irecord |
264 |
INTEGER myIter |
265 |
INTEGER myThid |
266 |
|
267 |
#ifdef ALLOW_AUTODIFF |
268 |
C Local variables |
269 |
_RL dummyRL(1) |
270 |
_RS dummyRS(1) |
271 |
|
272 |
IF ( arrType.EQ.'RL' ) THEN |
273 |
CALL MDS_WRITE_FIELD( |
274 |
I fName, filePrec, globalFile, .TRUE., |
275 |
I arrType, nNz, 1, nNz, arr, dummyRS, |
276 |
I irecord, myIter, myThid ) |
277 |
ELSE |
278 |
CALL MDS_WRITE_FIELD( |
279 |
I fName, filePrec, globalFile, .TRUE., |
280 |
I arrType, nNz, 1, nNz, dummyRL, arr, |
281 |
I irecord, myIter, myThid ) |
282 |
ENDIF |
283 |
|
284 |
#else /* ALLOW_AUTODIFF */ |
285 |
STOP 'ABNORMAL END: S/R MDSWRITEFIELD_LOC is empty' |
286 |
#endif /* ALLOW_AUTODIFF */ |
287 |
|
288 |
RETURN |
289 |
END |