1 |
jmc |
1.3 |
C $Header: /u/gcmpack/MITgcm/pkg/mdsio/mdsio_rw_field.F,v 1.2 2007/11/13 19:37:44 jmc Exp $ |
2 |
jmc |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "MDSIO_OPTIONS.h" |
5 |
|
|
|
6 |
jmc |
1.2 |
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 |
jmc |
1.1 |
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 |
jmc |
1.2 |
C the vertical dimension (3rd dimension) of the output array and the number |
39 |
jmc |
1.1 |
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 |
jmc |
1.3 |
_RL arr(*) |
54 |
jmc |
1.1 |
INTEGER irecord |
55 |
|
|
INTEGER myThid |
56 |
|
|
C ------------------------------------------------------------------ |
57 |
|
|
CALL MDS_READ_FIELD( |
58 |
jmc |
1.2 |
I fName, filePrec, .FALSE., arrType, nNz, 1, nNz, |
59 |
|
|
O arr, |
60 |
|
|
I irecord, myThid ) |
61 |
jmc |
1.1 |
C ------------------------------------------------------------------ |
62 |
|
|
RETURN |
63 |
|
|
END |
64 |
|
|
|
65 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
66 |
|
|
|
67 |
|
|
SUBROUTINE MDSREADFIELD_LOC( |
68 |
|
|
I fName, |
69 |
|
|
I filePrec, |
70 |
|
|
I arrType, |
71 |
|
|
I nNz, |
72 |
|
|
O arr, |
73 |
|
|
I irecord, |
74 |
|
|
I myThid ) |
75 |
|
|
C |
76 |
|
|
C Arguments: |
77 |
|
|
C |
78 |
|
|
C fName (string) :: base name for file to write |
79 |
|
|
C filePrec (integer) :: number of bits per word in file (32 or 64) |
80 |
|
|
C arrType (char(2)) :: declaration of "arr": either "RS" or "RL" |
81 |
|
|
C nNz (integer) :: size of third dimension: normally either 1 or Nr |
82 |
|
|
C arr ( RS/RL ) :: array to write, arr(:,:,nNz,:,:) |
83 |
|
|
C irecord (integer) :: record number to read |
84 |
|
|
C myThid (integer) :: thread identifier |
85 |
|
|
C |
86 |
|
|
C Routine now calls MDS_READ_FIELD, just a way to add 2 extra arguments |
87 |
|
|
C to the argument list. The 1rst new argument is to make the difference between |
88 |
jmc |
1.2 |
C the vertical dimension (3rd dimension) of the output array and the number |
89 |
jmc |
1.1 |
C of levels to read in. This routine assumes they are the same. |
90 |
|
|
C The 2nd new argument (useCurrentDir=.FALSE.) forces to ignore the |
91 |
|
|
C "mdsioLocalDir" parameter and to always read from the current directory. |
92 |
|
|
|
93 |
|
|
IMPLICIT NONE |
94 |
|
|
C Global variables / COMMON blocks |
95 |
|
|
#include "SIZE.h" |
96 |
|
|
c #include "EEPARAMS.h" |
97 |
|
|
|
98 |
|
|
C Routine arguments |
99 |
|
|
CHARACTER*(*) fName |
100 |
|
|
INTEGER filePrec |
101 |
|
|
CHARACTER*(2) arrType |
102 |
|
|
INTEGER nNz |
103 |
jmc |
1.3 |
_RL arr(*) |
104 |
jmc |
1.1 |
INTEGER irecord |
105 |
|
|
INTEGER myThid |
106 |
|
|
C ------------------------------------------------------------------ |
107 |
|
|
CALL MDS_READ_FIELD( |
108 |
jmc |
1.2 |
I fName, filePrec, .TRUE., arrType, nNz, 1, nNz, |
109 |
|
|
O arr, |
110 |
|
|
I irecord, myThid ) |
111 |
jmc |
1.1 |
C ------------------------------------------------------------------ |
112 |
|
|
RETURN |
113 |
|
|
END |
114 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
115 |
|
|
|
116 |
|
|
SUBROUTINE MDSWRITEFIELD( |
117 |
|
|
I fName, |
118 |
|
|
I filePrec, |
119 |
|
|
I globalFile, |
120 |
|
|
I arrType, |
121 |
|
|
I nNz, |
122 |
|
|
I arr, |
123 |
|
|
I irecord, |
124 |
|
|
I myIter, |
125 |
|
|
I myThid ) |
126 |
|
|
C |
127 |
|
|
C Arguments: |
128 |
|
|
C |
129 |
|
|
C fName (string) :: base name for file to write |
130 |
|
|
C filePrec (integer) :: number of bits per word in file (32 or 64) |
131 |
|
|
C globalFile (logical):: selects between writing a global or tiled file |
132 |
|
|
C arrType (char(2)) :: declaration of "arr": either "RS" or "RL" |
133 |
|
|
C nNz (integer) :: size of third dimension: normally either 1 or Nr |
134 |
|
|
C arr ( RS/RL ) :: array to write, arr(:,:,nNzdim,:,:) |
135 |
|
|
C irecord (integer) :: record number to write |
136 |
|
|
C myIter (integer) :: time step number |
137 |
|
|
C myThid (integer) :: thread identifier |
138 |
|
|
C |
139 |
|
|
C Routine now calls MDS_WRITE_FIELD, just a way to add 2 extra arguments |
140 |
|
|
C to the argument list. The 1rst new argument is to make the difference between |
141 |
|
|
C the vertical dimension (3rd dimension) of an array and the number of levels |
142 |
|
|
C the output routine should process. This routine assumes they are the same. |
143 |
|
|
C The 2nd new argument (useCurrentDir=.FALSE.) allows to write files to |
144 |
|
|
C the "mdsioLocalDir" directory (if it is set). |
145 |
|
|
|
146 |
|
|
IMPLICIT NONE |
147 |
|
|
C Global variables / common blocks |
148 |
|
|
#include "SIZE.h" |
149 |
|
|
c #include "EEPARAMS.h" |
150 |
|
|
|
151 |
|
|
C Routine arguments |
152 |
|
|
CHARACTER*(*) fName |
153 |
|
|
INTEGER filePrec |
154 |
|
|
LOGICAL globalFile |
155 |
|
|
CHARACTER*(2) arrType |
156 |
|
|
INTEGER nNz |
157 |
|
|
_RL arr(1-oLx:sNx+oLx,1-oLy:sNy+oLy,nNz,nSx,nSy) |
158 |
|
|
INTEGER irecord |
159 |
|
|
INTEGER myIter |
160 |
|
|
INTEGER myThid |
161 |
|
|
C ------------------------------------------------------------------ |
162 |
|
|
CALL MDS_WRITE_FIELD( |
163 |
|
|
I fName, filePrec, globalFile, .FALSE., |
164 |
jmc |
1.2 |
I arrType, nNz, 1, nNz, arr, irecord, |
165 |
jmc |
1.1 |
I myIter, myThid ) |
166 |
|
|
C ------------------------------------------------------------------ |
167 |
|
|
RETURN |
168 |
|
|
END |
169 |
|
|
|
170 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
171 |
|
|
|
172 |
|
|
SUBROUTINE MDSWRITEFIELD_LOC( |
173 |
|
|
I fName, |
174 |
|
|
I filePrec, |
175 |
|
|
I globalFile, |
176 |
|
|
I arrType, |
177 |
|
|
I nNz, |
178 |
|
|
I arr, |
179 |
|
|
I irecord, |
180 |
|
|
I myIter, |
181 |
|
|
I myThid ) |
182 |
|
|
C |
183 |
|
|
C Arguments: |
184 |
|
|
C |
185 |
|
|
C fName (string) :: base name for file to write |
186 |
|
|
C filePrec (integer) :: number of bits per word in file (32 or 64) |
187 |
|
|
C globalFile (logical):: selects between writing a global or tiled file |
188 |
|
|
C arrType (char(2)) :: declaration of "arr": either "RS" or "RL" |
189 |
|
|
C nNz (integer) :: size of third dimension: normally either 1 or Nr |
190 |
|
|
C arr ( RS/RL ) :: array to write, arr(:,:,nNzdim,:,:) |
191 |
|
|
C irecord (integer) :: record number to write |
192 |
|
|
C myIter (integer) :: time step number |
193 |
|
|
C myThid (integer) :: thread identifier |
194 |
|
|
C |
195 |
|
|
C Routine now calls mdswritefield_new, just a way to add 2 extra arguments |
196 |
|
|
C to the argument list. The 1rst new argument is to make the difference between |
197 |
|
|
C the vertical dimension (3rd dimension) of an array and the number of levels |
198 |
|
|
C the output routine should process. This routine assumes they are the same. |
199 |
|
|
C The 2nd new argument (useCurrentDir=.TRUE.) forces to ignore the |
200 |
|
|
C "mdsioLocalDir" parameter and to always write to the current directory. |
201 |
|
|
|
202 |
jmc |
1.2 |
IMPLICIT NONE |
203 |
jmc |
1.1 |
C Global variables / common blocks |
204 |
|
|
#include "SIZE.h" |
205 |
|
|
c #include "EEPARAMS.h" |
206 |
|
|
|
207 |
|
|
C Routine arguments |
208 |
|
|
CHARACTER*(*) fName |
209 |
|
|
INTEGER filePrec |
210 |
|
|
LOGICAL globalFile |
211 |
|
|
CHARACTER*(2) arrType |
212 |
|
|
INTEGER nNz |
213 |
|
|
_RL arr(1-oLx:sNx+oLx,1-oLy:sNy+oLy,nNz,nSx,nSy) |
214 |
|
|
INTEGER irecord |
215 |
|
|
INTEGER myIter |
216 |
|
|
INTEGER myThid |
217 |
|
|
C ------------------------------------------------------------------ |
218 |
|
|
CALL MDS_WRITE_FIELD( |
219 |
|
|
I fName, filePrec, globalFile, .TRUE., |
220 |
jmc |
1.2 |
I arrType, nNz, 1, nNz, arr, irecord, |
221 |
jmc |
1.1 |
I myIter, myThid ) |
222 |
|
|
C ------------------------------------------------------------------ |
223 |
|
|
RETURN |
224 |
|
|
END |