23 |
C !DESCRIPTION: |
C !DESCRIPTION: |
24 |
C |
C |
25 |
C MDS_WR_METAFILES creates either a file of the form "fName.meta" IF the |
C MDS_WR_METAFILES creates either a file of the form "fName.meta" IF the |
26 |
C LOGICAL flag "globalFile" or "useSingleCPUIO" are set true. Otherwise |
C logical flag "globalFile" or "useSingleCPUIO" are set true. Otherwise |
27 |
C it creates MDS tiled files of the form "fName.xxx.yyy.meta". |
C it creates MDS tiled files of the form "fName.xxx.yyy.meta". |
28 |
C Currently, the meta-files are not read because it is difficult |
C Currently, the meta-files are not read because it is difficult |
29 |
C to parse files in fortran. We should read meta information before |
C to parse files in fortran. We should read meta information before |
35 |
C NOTE: It is currently assumed that |
C NOTE: It is currently assumed that |
36 |
C the highest record number in the file was the last record written. |
C the highest record number in the file was the last record written. |
37 |
C Nor is there a consistency check between the routine arguments and file. |
C Nor is there a consistency check between the routine arguments and file. |
38 |
C ie. IF your WRITE record 2 after record 4 the meta information |
C ie. if you write record 2 after record 4 the meta information |
39 |
C will record the number of records to be 2. This, again, is because |
C will record the number of records to be 2. This, again, is because |
40 |
C we have read the meta information. To be fixed. |
C we have read the meta information. To be fixed. |
41 |
|
|
91 |
C Local variables |
C Local variables |
92 |
CHARACTER*(MAX_LEN_FNAM) dataFName, metaFName, pfName |
CHARACTER*(MAX_LEN_FNAM) dataFName, metaFName, pfName |
93 |
INTEGER iG,jG, bi,bj, IL,pIL |
INTEGER iG,jG, bi,bj, IL,pIL |
94 |
INTEGER dimList(3,3), nDims |
INTEGER dimList(3,3), nDims, map2gl(2) |
95 |
INTEGER xSize, ySize |
INTEGER xSize, ySize |
96 |
#if defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO) |
#if defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO) |
97 |
INTEGER tn |
INTEGER tN |
98 |
#endif |
#endif |
99 |
|
|
100 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
127 |
dimList(3,3) = nNz |
dimList(3,3) = nNz |
128 |
nDims=3 |
nDims=3 |
129 |
IF (nNz.EQ.1) nDims=2 |
IF (nNz.EQ.1) nDims=2 |
130 |
c CALL MDSWRITEMETA( metaFName, dataFName, filePrec, |
map2gl(1) = 0 |
131 |
c & nDims, dimList, irecord, myIter, myThid ) |
map2gl(2) = 1 |
132 |
CALL MDS_WRITE_META( |
CALL MDS_WRITE_META( |
133 |
I metaFName, dataFName, the_run_name, titleLine, |
I metaFName, dataFName, the_run_name, titleLine, |
134 |
I filePrec, nDims, dimList, nFlds, fldList, |
I filePrec, nDims,dimList,map2gl, nFlds, fldList, |
135 |
I nTimRec, timList, irecord, myIter, myThid ) |
I nTimRec, timList, irecord, myIter, myThid ) |
136 |
|
|
137 |
ELSE |
ELSE |
157 |
C Create meta-file for each tile IF we are tiling |
C Create meta-file for each tile IF we are tiling |
158 |
WRITE(metaFname,'(2a,i3.3,a,i3.3,a)') |
WRITE(metaFname,'(2a,i3.3,a,i3.3,a)') |
159 |
& pfName(1:pIL),'.',iG,'.',jG,'.meta' |
& pfName(1:pIL),'.',iG,'.',jG,'.meta' |
160 |
|
map2gl(1) = 0 |
161 |
|
map2gl(2) = 1 |
162 |
#if defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO) |
#if defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO) |
163 |
tn = W2_myTileList(bi) |
tN = W2_myTileList(bi) |
164 |
dimList(1,1) = xSize |
dimList(1,1) = xSize |
165 |
dimList(2,1) = exch2_txGlobalo(tn) |
dimList(2,1) = exch2_txGlobalo(tN) |
166 |
dimList(3,1) = exch2_txGlobalo(tn)+sNx-1 |
dimList(3,1) = exch2_txGlobalo(tN)+sNx-1 |
167 |
dimList(1,2) = ySize |
dimList(1,2) = ySize |
168 |
dimList(2,2) = exch2_tyGlobalo(tn) |
dimList(2,2) = exch2_tyGlobalo(tN) |
169 |
dimList(3,2) = exch2_tyGlobalo(tn)+sNy-1 |
dimList(3,2) = exch2_tyGlobalo(tN)+sNy-1 |
170 |
|
IF (nNx.EQ.0 .AND. nNy.EQ.0) THEN |
171 |
|
IF ( exch2_mydNx(tN) .GT. xsize ) THEN |
172 |
|
C- face x-size larger than glob-size : fold it |
173 |
|
map2gl(1) = 0 |
174 |
|
map2gl(2) = exch2_mydNx(tN) / xsize |
175 |
|
ELSEIF ( exch2_tNy(tN) .GT. ysize ) THEN |
176 |
|
C- tile y-size larger than glob-size : make a long line |
177 |
|
map2gl(1) = exch2_mydNx(tN) |
178 |
|
map2gl(2) = 0 |
179 |
|
ELSE |
180 |
|
C- default (face fit into global-IO-array) |
181 |
|
map2gl(1) = 0 |
182 |
|
map2gl(2) = 1 |
183 |
|
ENDIF |
184 |
|
ENDIF |
185 |
#else /* defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO) */ |
#else /* defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO) */ |
186 |
C- jmc: IF MISSING_TILE_IO, keep meta files unchanged |
C- jmc: IF MISSING_TILE_IO, keep meta files unchanged |
187 |
C to stay consistent with global file structure |
C to stay consistent with global file structure |
201 |
IF (nNx.EQ.1) dimList(3,1) = 1 |
IF (nNx.EQ.1) dimList(3,1) = 1 |
202 |
IF (nNy.EQ.1) dimList(2,2) = 1 |
IF (nNy.EQ.1) dimList(2,2) = 1 |
203 |
IF (nNy.EQ.1) dimList(3,2) = 1 |
IF (nNy.EQ.1) dimList(3,2) = 1 |
|
c CALL MDSWRITEMETA( metaFName, dataFName, |
|
|
c & filePrec, nDims, dimList, irecord, myIter, myThid ) |
|
204 |
CALL MDS_WRITE_META( |
CALL MDS_WRITE_META( |
205 |
I metaFName, dataFName, the_run_name, titleLine, |
I metaFName, dataFName, the_run_name, titleLine, |
206 |
I filePrec, nDims, dimList, nFlds, fldList, |
I filePrec, nDims,dimList,map2gl, nFlds, fldList, |
207 |
I nTimRec, timList, irecord, myIter, myThid ) |
I nTimRec, timList, irecord, myIter, myThid ) |
208 |
C End of bi,bj loops |
C End of bi,bj loops |
209 |
ENDDO |
ENDDO |