/[MITgcm]/MITgcm/pkg/mdsio/mdsio_read_section.F
ViewVC logotype

Contents of /MITgcm/pkg/mdsio/mdsio_read_section.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Tue Jun 7 22:30:29 2011 UTC (12 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62z, HEAD
Changes since 1.3: +7 -7 lines
refine debugLevel criteria when printing messages

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

  ViewVC Help
Powered by ViewVC 1.1.22