1 |
C $Header: /u/gcmpack/MITgcm/pkg/mdsio/mdsio_write_section.F,v 1.2 2010/03/16 00:16:50 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "MDSIO_OPTIONS.h" |
5 |
|
6 |
C-- File mdsio_read_section.F: Routines to handle mid-level I/O interface. |
7 |
C-- Contents |
8 |
C-- o MDS_WRITE_SEC_XZ |
9 |
C-- o MDS_WRITE_SEC_YZ |
10 |
|
11 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
12 |
|
13 |
CBOP |
14 |
C !ROUTINE: MDS_WRITE_SEC_XZ |
15 |
C !INTERFACE: |
16 |
SUBROUTINE MDS_WRITE_SEC_XZ( |
17 |
I fName, |
18 |
I filePrec, |
19 |
I globalFile, |
20 |
I useCurrentDir, |
21 |
I arrType, |
22 |
I kSize, |
23 |
I fldRL, fldRS, |
24 |
I irecord, |
25 |
I myIter, |
26 |
I myThid ) |
27 |
|
28 |
C !DESCRIPTION |
29 |
C Arguments: |
30 |
C |
31 |
C fName string :: base name for file to read |
32 |
C filePrec integer :: number of bits per word in file (32 or 64) |
33 |
C globalFile logical :: selects between writing a global or tiled file |
34 |
C useCurrentDir logic :: always write to the current directory (even if |
35 |
C "mdsioLocalDir" is set) |
36 |
C arrType char(2) :: which array (fldRL/RS) to write, either "RL" or "RS" |
37 |
C kSize integer :: size of third dimension, normally either 1 or Nr |
38 |
C fldRL RL :: array to write if arrType="RL", fldRL(:,kSize,:,:) |
39 |
C fldRS RS :: array to write if arrType="RS", fldRS(:,kSize,:,:) |
40 |
C irecord integer :: record number to read |
41 |
C myIter integer :: time step number |
42 |
C myThid integer :: thread identifier |
43 |
C |
44 |
C MDS_WRITE_SEC_XZ creates either a file of the form "fName.data" |
45 |
C if the logical flag "globalFile" is set true. Otherwise |
46 |
C it creates MDS tiled files of the form "fName.xxx.yyy.data". |
47 |
C The precision of the file is decsribed by filePrec, set either |
48 |
C to floatPrec32 or floatPrec64. The char*(2) string arrType, either "RL" |
49 |
C or "RS", selects which array is written, either fldRL or fldRS. |
50 |
C This routine writes vertical slices (X-Z) including overlap regions. |
51 |
C irecord is the record number to be read and must be >= 1. |
52 |
C NOTE: It is currently assumed that |
53 |
C the highest record number in the file was the last record written. |
54 |
C |
55 |
C Modified: 06/02/00 spk@ocean.mit.edu |
56 |
CEOP |
57 |
|
58 |
C !USES: |
59 |
IMPLICIT NONE |
60 |
C Global variables / common blocks |
61 |
#include "SIZE.h" |
62 |
#include "EEPARAMS.h" |
63 |
#include "PARAMS.h" |
64 |
#ifdef ALLOW_EXCH2 |
65 |
#include "W2_EXCH2_SIZE.h" |
66 |
#include "W2_EXCH2_TOPOLOGY.h" |
67 |
#include "W2_EXCH2_PARAMS.h" |
68 |
#endif /* ALLOW_EXCH2 */ |
69 |
|
70 |
C !INPUT PARAMETERS: |
71 |
CHARACTER*(*) fName |
72 |
INTEGER filePrec |
73 |
LOGICAL globalFile |
74 |
LOGICAL useCurrentDir |
75 |
CHARACTER*(2) arrType |
76 |
INTEGER kSize |
77 |
_RL fldRL(*) |
78 |
_RS fldRS(*) |
79 |
INTEGER irecord |
80 |
INTEGER myIter |
81 |
INTEGER myThid |
82 |
C !OUTPUT PARAMETERS: |
83 |
|
84 |
C !FUNCTIONS: |
85 |
INTEGER ILNBLNK |
86 |
INTEGER MDS_RECLEN |
87 |
EXTERNAL ILNBLNK, MDS_RECLEN |
88 |
|
89 |
C !LOCAL VARIABLES: |
90 |
CHARACTER*(MAX_LEN_FNAM) dataFName,pfName |
91 |
INTEGER iG,jG,irec,bi,bj,k,dUnit,IL,pIL |
92 |
Real*4 r4seg(sNx) |
93 |
Real*8 r8seg(sNx) |
94 |
INTEGER length_of_rec |
95 |
LOGICAL fileIsOpen |
96 |
CHARACTER*(max_len_mbuf) msgBuf |
97 |
#ifdef ALLOW_EXCH2 |
98 |
INTEGER tGx,tNx,tN |
99 |
#endif /* ALLOW_EXCH2 */ |
100 |
|
101 |
C ------------------------------------------------------------------ |
102 |
|
103 |
C Only do I/O if I am the master thread |
104 |
_BEGIN_MASTER( myThid ) |
105 |
|
106 |
C Record number must be >= 1 |
107 |
IF (irecord .LT. 1) THEN |
108 |
WRITE(msgBuf,'(A,I9.8)') |
109 |
& ' MDS_WRITE_SEC_XZ: argument irecord = ',irecord |
110 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
111 |
& SQUEEZE_RIGHT, myThid ) |
112 |
WRITE(msgBuf,'(A)') |
113 |
& ' MDS_WRITE_SEC_XZ: invalid value for irecord' |
114 |
CALL PRINT_ERROR( msgBuf, myThid ) |
115 |
STOP 'ABNORMAL END: S/R MDS_WRITE_SEC_XZ' |
116 |
ENDIF |
117 |
|
118 |
C Assume nothing |
119 |
fileIsOpen=.FALSE. |
120 |
IL = ILNBLNK( fName ) |
121 |
pIL = ILNBLNK( mdsioLocalDir ) |
122 |
|
123 |
C Assign special directory |
124 |
IF ( useCurrentDir .OR. pIL.EQ.0 ) THEN |
125 |
pfName= fName |
126 |
ELSE |
127 |
WRITE(pfName,'(2A)') mdsioLocalDir(1:pIL), fName(1:IL) |
128 |
ENDIF |
129 |
pIL=ILNBLNK( pfName ) |
130 |
|
131 |
C Assign a free unit number as the I/O channel for this routine |
132 |
CALL MDSFINDUNIT( dUnit, myThid ) |
133 |
|
134 |
C If we are writing to a global file then we open it here |
135 |
IF (globalFile) THEN |
136 |
WRITE(dataFName,'(2A)') fName(1:IL),'.data' |
137 |
IF (irecord .EQ. 1) THEN |
138 |
length_of_rec = MDS_RECLEN( filePrec, sNx, myThid ) |
139 |
OPEN( dUnit, file=dataFName, status=_NEW_STATUS, |
140 |
& access='direct', recl=length_of_rec ) |
141 |
fileIsOpen=.TRUE. |
142 |
ELSE |
143 |
length_of_rec = MDS_RECLEN( filePrec, sNx, myThid ) |
144 |
OPEN( dUnit, file=dataFName, status='old', |
145 |
& access='direct', recl=length_of_rec ) |
146 |
fileIsOpen=.TRUE. |
147 |
ENDIF |
148 |
ENDIF |
149 |
|
150 |
C Loop over all tiles |
151 |
DO bj=1,nSy |
152 |
DO bi=1,nSx |
153 |
C If we are writing to a tiled MDS file then we open each one here |
154 |
IF (.NOT. globalFile) THEN |
155 |
iG=bi+(myXGlobalLo-1)/sNx |
156 |
jG=bj+(myYGlobalLo-1)/sNy |
157 |
WRITE(dataFName,'(2A,I3.3,A,I3.3,A)') |
158 |
& pfName(1:pIL),'.',iG,'.',jG,'.data' |
159 |
IF (irecord .EQ. 1) THEN |
160 |
length_of_rec = MDS_RECLEN( filePrec, sNx, myThid ) |
161 |
OPEN( dUnit, file=dataFName, status=_NEW_STATUS, |
162 |
& access='direct', recl=length_of_rec ) |
163 |
fileIsOpen=.TRUE. |
164 |
ELSE |
165 |
length_of_rec = MDS_RECLEN( filePrec, sNx, myThid ) |
166 |
OPEN( dUnit, file=dataFName, status='old', |
167 |
& access='direct', recl=length_of_rec ) |
168 |
fileIsOpen=.TRUE. |
169 |
ENDIF |
170 |
ENDIF |
171 |
IF (fileIsOpen) THEN |
172 |
#ifdef ALLOW_EXCH2 |
173 |
C layout of global x-z section files is "xStack" |
174 |
tN = W2_myTileList(bi,bj) |
175 |
tGx = exch2_txXStackLo(tN) |
176 |
tNx = exch2_tNx(tN) |
177 |
#endif /* ALLOW_EXCH2 */ |
178 |
DO k=1,kSize |
179 |
IF (globalFile) THEN |
180 |
#ifdef ALLOW_EXCH2 |
181 |
C record length is sNx==tNx |
182 |
irec = 1 + ( tGx-1 |
183 |
& + ( k-1 + (irecord-1)*kSize )*exch2_xStack_Nx |
184 |
& )/tNx |
185 |
#else /* ALLOW_EXCH2 */ |
186 |
iG = myXGlobalLo-1 + (bi-1)*sNx |
187 |
jG = (myYGlobalLo-1)/sNy + (bj-1) |
188 |
irec=1 + INT(iG/sNx) + nSx*nPx*(k-1) |
189 |
& + nSx*nPx*kSize*(irecord-1) |
190 |
#endif /* ALLOW_EXCH2 */ |
191 |
ELSE |
192 |
iG = 0 |
193 |
jG = 0 |
194 |
irec=k + kSize*(irecord-1) |
195 |
ENDIF |
196 |
IF (filePrec .EQ. precFloat32) THEN |
197 |
IF (arrType .EQ. 'RS') THEN |
198 |
CALL MDS_SEG4toRS_2D( sNx,oLx,kSize,bi,bj,k,.FALSE., |
199 |
& r4seg,fldRS ) |
200 |
ELSEIF (arrType .EQ. 'RL') THEN |
201 |
CALL MDS_SEG4toRL_2D( sNx,oLx,kSize,bi,bj,k,.FALSE., |
202 |
& r4seg,fldRL ) |
203 |
ELSE |
204 |
WRITE(msgBuf,'(A)') |
205 |
& ' MDS_WRITE_SEC_XZ: illegal value for arrType' |
206 |
CALL PRINT_ERROR( msgBuf, myThid ) |
207 |
STOP 'ABNORMAL END: S/R MDS_WRITE_SEC_XZ' |
208 |
ENDIF |
209 |
#ifdef _BYTESWAPIO |
210 |
CALL MDS_BYTESWAPR4(sNx,r4seg) |
211 |
#endif |
212 |
WRITE(dUnit,rec=irec) r4seg |
213 |
ELSEIF (filePrec .EQ. precFloat64) THEN |
214 |
IF (arrType .EQ. 'RS') THEN |
215 |
CALL MDS_SEG8toRS_2D( sNx,oLx,kSize,bi,bj,k,.FALSE., |
216 |
& r8seg,fldRS ) |
217 |
ELSEIF (arrType .EQ. 'RL') THEN |
218 |
CALL MDS_SEG8toRL_2D( sNx,oLx,kSize,bi,bj,k,.FALSE., |
219 |
& r8seg,fldRL ) |
220 |
ELSE |
221 |
WRITE(msgBuf,'(A)') |
222 |
& ' MDS_WRITE_SEC_XZ: illegal value for arrType' |
223 |
CALL PRINT_ERROR( msgBuf, myThid ) |
224 |
STOP 'ABNORMAL END: S/R MDS_WRITE_SEC_XZ' |
225 |
ENDIF |
226 |
#ifdef _BYTESWAPIO |
227 |
CALL MDS_BYTESWAPR8( sNx, r8seg ) |
228 |
#endif |
229 |
WRITE(dUnit,rec=irec) r8seg |
230 |
ELSE |
231 |
WRITE(msgBuf,'(A)') |
232 |
& ' MDS_WRITE_SEC_XZ: illegal value for filePrec' |
233 |
CALL PRINT_ERROR( msgBuf, myThid ) |
234 |
STOP 'ABNORMAL END: S/R MDS_WRITE_SEC_XZ' |
235 |
ENDIF |
236 |
C End of k loop |
237 |
ENDDO |
238 |
ELSE |
239 |
WRITE(msgBuf,'(A)') |
240 |
& ' MDS_WRITE_SEC_XZ: I should never get to this point' |
241 |
CALL PRINT_ERROR( msgBuf, myThid ) |
242 |
STOP 'ABNORMAL END: S/R MDS_WRITE_SEC_XZ' |
243 |
ENDIF |
244 |
C If we were writing to a tiled MDS file then we close it here |
245 |
IF (fileIsOpen .AND. (.NOT. globalFile)) THEN |
246 |
CLOSE( dUnit ) |
247 |
fileIsOpen = .FALSE. |
248 |
ENDIF |
249 |
C End of bi,bj loops |
250 |
ENDDO |
251 |
ENDDO |
252 |
|
253 |
C If global file was opened then close it |
254 |
IF (fileIsOpen .AND. globalFile) THEN |
255 |
CLOSE( dUnit ) |
256 |
fileIsOpen = .FALSE. |
257 |
ENDIF |
258 |
|
259 |
_END_MASTER( myThid ) |
260 |
|
261 |
C ------------------------------------------------------------------ |
262 |
RETURN |
263 |
END |
264 |
|
265 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
266 |
|
267 |
CBOP |
268 |
C !ROUTINE: MDS_WRITE_SEC_YZ |
269 |
C !INTERFACE: |
270 |
SUBROUTINE MDS_WRITE_SEC_YZ( |
271 |
I fName, |
272 |
I filePrec, |
273 |
I globalFile, |
274 |
I useCurrentDir, |
275 |
I arrType, |
276 |
I kSize, |
277 |
I fldRL, fldRS, |
278 |
I irecord, |
279 |
I myIter, |
280 |
I myThid ) |
281 |
|
282 |
C !DESCRIPTION |
283 |
C Arguments: |
284 |
C |
285 |
C fName string :: base name for file to read |
286 |
C filePrec integer :: number of bits per word in file (32 or 64) |
287 |
C globalFile logical :: selects between writing a global or tiled file |
288 |
C useCurrentDir logic :: always write to the current directory (even if |
289 |
C "mdsioLocalDir" is set) |
290 |
C arrType char(2) :: which array (fldRL/RS) to write, either "RL" or "RS" |
291 |
C kSize integer :: size of third dimension, normally either 1 or Nr |
292 |
C fldRL RL :: array to write if arrType="RL", fldRL(:,kSize,:,:) |
293 |
C fldRS RS :: array to write if arrType="RS", fldRS(:,kSize,:,:) |
294 |
C irecord integer :: record number to read |
295 |
C myIter integer :: time step number |
296 |
C myThid integer :: thread identifier |
297 |
C |
298 |
C MDS_WRITE_SEC_YZ creates either a file of the form "fName.data" |
299 |
C if the logical flag "globalFile" is set true. Otherwise |
300 |
C it creates MDS tiled files of the form "fName.xxx.yyy.data". |
301 |
C The precision of the file is decsribed by filePrec, set either |
302 |
C to floatPrec32 or floatPrec64. The char*(2) string arrType, either "RL" |
303 |
C or "RS", selects which array is written, either fldRL or fldRS. |
304 |
C This routine writes vertical slices (Y-Z) including overlap regions. |
305 |
C irecord is the record number to be read and must be >= 1. |
306 |
C NOTE: It is currently assumed that |
307 |
C the highest record number in the file was the last record written. |
308 |
C |
309 |
C Modified: 06/02/00 spk@ocean.mit.edu |
310 |
CEOP |
311 |
|
312 |
C !USES: |
313 |
IMPLICIT NONE |
314 |
C Global variables / common blocks |
315 |
#include "SIZE.h" |
316 |
#include "EEPARAMS.h" |
317 |
#include "PARAMS.h" |
318 |
#ifdef ALLOW_EXCH2 |
319 |
#include "W2_EXCH2_SIZE.h" |
320 |
#include "W2_EXCH2_TOPOLOGY.h" |
321 |
#include "W2_EXCH2_PARAMS.h" |
322 |
#endif /* ALLOW_EXCH2 */ |
323 |
|
324 |
C !INPUT PARAMETERS: |
325 |
CHARACTER*(*) fName |
326 |
INTEGER filePrec |
327 |
LOGICAL globalFile |
328 |
LOGICAL useCurrentDir |
329 |
CHARACTER*(2) arrType |
330 |
INTEGER kSize |
331 |
_RL fldRL(*) |
332 |
_RS fldRS(*) |
333 |
INTEGER irecord |
334 |
INTEGER myIter |
335 |
INTEGER myThid |
336 |
C !OUTPUT PARAMETERS: |
337 |
|
338 |
C !FUNCTIONS: |
339 |
INTEGER ILNBLNK |
340 |
INTEGER MDS_RECLEN |
341 |
EXTERNAL ILNBLNK, MDS_RECLEN |
342 |
|
343 |
C !LOCAL VARIABLES: |
344 |
CHARACTER*(MAX_LEN_FNAM) dataFName,pfName |
345 |
INTEGER iG,jG,irec,bi,bj,k,dUnit,IL,pIL |
346 |
Real*4 r4seg(sNy) |
347 |
Real*8 r8seg(sNy) |
348 |
INTEGER length_of_rec |
349 |
LOGICAL fileIsOpen |
350 |
CHARACTER*(max_len_mbuf) msgBuf |
351 |
#ifdef ALLOW_EXCH2 |
352 |
INTEGER tGy,tNy,tN |
353 |
#endif /* ALLOW_EXCH2 */ |
354 |
C ------------------------------------------------------------------ |
355 |
|
356 |
C Only do I/O if I am the master thread |
357 |
_BEGIN_MASTER( myThid ) |
358 |
|
359 |
C Record number must be >= 1 |
360 |
IF (irecord .LT. 1) THEN |
361 |
WRITE(msgBuf,'(A,I9.8)') |
362 |
& ' MDS_WRITE_SEC_YZ: argument irecord = ',irecord |
363 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
364 |
& SQUEEZE_RIGHT , myThid) |
365 |
WRITE(msgBuf,'(A)') |
366 |
& ' MDS_WRITE_SEC_YZ: invalid value for irecord' |
367 |
CALL PRINT_ERROR( msgBuf, myThid ) |
368 |
STOP 'ABNORMAL END: S/R MDS_WRITE_SEC_YZ' |
369 |
ENDIF |
370 |
|
371 |
C Assume nothing |
372 |
fileIsOpen=.FALSE. |
373 |
IL = ILNBLNK( fName ) |
374 |
pIL = ILNBLNK( mdsioLocalDir ) |
375 |
|
376 |
C Assign special directory |
377 |
IF ( useCurrentDir .OR. pIL.EQ.0 ) THEN |
378 |
pfName= fName |
379 |
ELSE |
380 |
WRITE(pfName,'(2a)') mdsioLocalDir(1:pIL), fName(1:IL) |
381 |
ENDIF |
382 |
pIL=ILNBLNK( pfName ) |
383 |
|
384 |
C Assign a free unit number as the I/O channel for this routine |
385 |
CALL MDSFINDUNIT( dUnit, myThid ) |
386 |
|
387 |
C If we are writing to a global file then we open it here |
388 |
IF (globalFile) THEN |
389 |
WRITE(dataFName,'(2A)') fName(1:IL),'.data' |
390 |
IF (irecord .EQ. 1) THEN |
391 |
length_of_rec = MDS_RECLEN( filePrec, sNy, myThid ) |
392 |
OPEN( dUnit, file=dataFName, status=_NEW_STATUS, |
393 |
& access='direct', recl=length_of_rec ) |
394 |
fileIsOpen=.TRUE. |
395 |
ELSE |
396 |
length_of_rec = MDS_RECLEN( filePrec, sNy, myThid ) |
397 |
OPEN( dUnit, file=dataFName, status='old', |
398 |
& access='direct', recl=length_of_rec ) |
399 |
fileIsOpen=.TRUE. |
400 |
ENDIF |
401 |
ENDIF |
402 |
|
403 |
C Loop over all tiles |
404 |
DO bj=1,nSy |
405 |
DO bi=1,nSx |
406 |
C If we are writing to a tiled MDS file then we open each one here |
407 |
IF (.NOT. globalFile) THEN |
408 |
iG=bi+(myXGlobalLo-1)/sNx |
409 |
jG=bj+(myYGlobalLo-1)/sNy |
410 |
WRITE(dataFName,'(2A,I3.3,A,I3.3,A)') |
411 |
& pfName(1:pIL),'.',iG,'.',jG,'.data' |
412 |
IF (irecord .EQ. 1) THEN |
413 |
length_of_rec = MDS_RECLEN( filePrec, sNy, myThid ) |
414 |
OPEN( dUnit, file=dataFName, status=_NEW_STATUS, |
415 |
& access='direct', recl=length_of_rec ) |
416 |
fileIsOpen=.TRUE. |
417 |
ELSE |
418 |
length_of_rec = MDS_RECLEN( filePrec, sNy, myThid ) |
419 |
OPEN( dUnit, file=dataFName, status='old', |
420 |
& access='direct', recl=length_of_rec ) |
421 |
fileIsOpen=.TRUE. |
422 |
ENDIF |
423 |
ENDIF |
424 |
IF (fileIsOpen) THEN |
425 |
#ifdef ALLOW_EXCH2 |
426 |
C layout of global y-z section files is "yStack" |
427 |
tN = W2_myTileList(bi,bj) |
428 |
tGy = exch2_tyYStackLo(tN) |
429 |
tNy = exch2_tNy(tN) |
430 |
#endif /* ALLOW_EXCH2 */ |
431 |
DO k=1,kSize |
432 |
IF (globalFile) THEN |
433 |
#ifdef ALLOW_EXCH2 |
434 |
C record length is sNy==tNy |
435 |
irec = 1 + ( tGy-1 |
436 |
& + ( k-1 + (irecord-1)*kSize )*exch2_yStack_Ny |
437 |
& )/tNy |
438 |
#else /* ALLOW_EXCH2 */ |
439 |
iG = (myXGlobalLo-1)/sNx + (bi-1) |
440 |
jG = myYGlobalLo-1 + (bj-1)*sNy |
441 |
irec=1 + INT(jG/sNy) + nSy*nPy*(k-1) |
442 |
& + nSy*nPy*kSize*(irecord-1) |
443 |
#endif /* ALLOW_EXCH2 */ |
444 |
ELSE |
445 |
iG = 0 |
446 |
jG = 0 |
447 |
irec=k + kSize*(irecord-1) |
448 |
ENDIF |
449 |
IF (filePrec .EQ. precFloat32) THEN |
450 |
IF (arrType .EQ. 'RS') THEN |
451 |
CALL MDS_SEG4toRS_2D( sNy,oLy,kSize,bi,bj,k,.FALSE., |
452 |
& r4seg,fldRS ) |
453 |
ELSEIF (arrType .EQ. 'RL') THEN |
454 |
CALL MDS_SEG4toRL_2D( sNy,oLy,kSize,bi,bj,k,.FALSE., |
455 |
& r4seg,fldRL ) |
456 |
ELSE |
457 |
WRITE(msgBuf,'(A)') |
458 |
& ' MDS_WRITE_SEC_YZ: illegal value for arrType' |
459 |
CALL PRINT_ERROR( msgBuf, myThid ) |
460 |
STOP 'ABNORMAL END: S/R MDS_WRITE_SEC_YZ' |
461 |
ENDIF |
462 |
#ifdef _BYTESWAPIO |
463 |
CALL MDS_BYTESWAPR4(sNy,r4seg) |
464 |
#endif |
465 |
WRITE(dUnit,rec=irec) r4seg |
466 |
ELSEIF (filePrec .EQ. precFloat64) THEN |
467 |
IF (arrType .EQ. 'RS') THEN |
468 |
CALL MDS_SEG8toRS_2D( sNy,oLy,kSize,bi,bj,k,.FALSE., |
469 |
& r8seg,fldRS ) |
470 |
ELSEIF (arrType .EQ. 'RL') THEN |
471 |
CALL MDS_SEG8toRL_2D( sNy,oLy,kSize,bi,bj,k,.FALSE., |
472 |
& r8seg,fldRL ) |
473 |
ELSE |
474 |
WRITE(msgBuf,'(A)') |
475 |
& ' MDS_WRITE_SEC_YZ: illegal value for arrType' |
476 |
CALL PRINT_ERROR( msgBuf, myThid ) |
477 |
STOP 'ABNORMAL END: S/R MDS_WRITE_SEC_YZ' |
478 |
ENDIF |
479 |
#ifdef _BYTESWAPIO |
480 |
CALL MDS_BYTESWAPR8( sNy, r8seg ) |
481 |
#endif |
482 |
WRITE(dUnit,rec=irec) r8seg |
483 |
ELSE |
484 |
WRITE(msgBuf,'(A)') |
485 |
& ' MDS_WRITE_SEC_YZ: illegal value for filePrec' |
486 |
CALL PRINT_ERROR( msgBuf, myThid ) |
487 |
STOP 'ABNORMAL END: S/R MDS_WRITE_SEC_YZ' |
488 |
ENDIF |
489 |
C End of k loop |
490 |
ENDDO |
491 |
ELSE |
492 |
WRITE(msgBuf,'(A)') |
493 |
& ' MDS_WRITE_SEC_YZ: I should never get to this point' |
494 |
CALL PRINT_ERROR( msgBuf, myThid ) |
495 |
STOP 'ABNORMAL END: S/R MDS_WRITE_SEC_YZ' |
496 |
ENDIF |
497 |
C If we were writing to a tiled MDS file then we close it here |
498 |
IF (fileIsOpen .AND. (.NOT. globalFile)) THEN |
499 |
CLOSE( dUnit ) |
500 |
fileIsOpen = .FALSE. |
501 |
ENDIF |
502 |
C End of bi,bj loops |
503 |
ENDDO |
504 |
ENDDO |
505 |
|
506 |
C If global file was opened then close it |
507 |
IF (fileIsOpen .AND. globalFile) THEN |
508 |
CLOSE( dUnit ) |
509 |
fileIsOpen = .FALSE. |
510 |
ENDIF |
511 |
|
512 |
_END_MASTER( myThid ) |
513 |
|
514 |
C ------------------------------------------------------------------ |
515 |
RETURN |
516 |
END |