1 |
gforget |
1.17 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/ecco_check.F,v 1.16 2014/04/07 18:10:21 atn Exp $ |
2 |
jmc |
1.4 |
C $Name: $ |
3 |
heimbach |
1.2 |
|
4 |
jmc |
1.9 |
#include "ECCO_OPTIONS.h" |
5 |
heimbach |
1.2 |
|
6 |
|
|
SUBROUTINE ECCO_CHECK( myThid ) |
7 |
|
|
C /==========================================================\ |
8 |
|
|
C | SUBROUTINE ECCO_CHECK | |
9 |
|
|
C | o Check runtime activated packages have been built in. | |
10 |
|
|
C |==========================================================| |
11 |
|
|
C | All packages can be selected/deselected at build time | |
12 |
|
|
C | ( when code is compiled ) and activated/deactivated at | |
13 |
|
|
C | runtime. This routine does a quick check to trap packages| |
14 |
|
|
C | that were activated at runtime but that were not compiled| |
15 |
|
|
C | in at build time. | |
16 |
|
|
C \==========================================================/ |
17 |
|
|
IMPLICIT NONE |
18 |
|
|
|
19 |
|
|
C === Global variables === |
20 |
|
|
#include "SIZE.h" |
21 |
|
|
#include "EEPARAMS.h" |
22 |
|
|
#include "PARAMS.h" |
23 |
heimbach |
1.8 |
#include "DYNVARS.h" |
24 |
gforget |
1.17 |
#ifdef ALLOW_CAL |
25 |
|
|
# include "cal.h" |
26 |
|
|
#endif |
27 |
|
|
#ifdef ALLOW_ECCO |
28 |
|
|
# include "ecco_cost.h" |
29 |
|
|
#endif |
30 |
heimbach |
1.3 |
#ifdef ALLOW_PROFILES |
31 |
|
|
#include "profiles.h" |
32 |
|
|
#endif |
33 |
|
|
|
34 |
heimbach |
1.2 |
C === Routine arguments === |
35 |
|
|
C myThid - Number of this instances |
36 |
|
|
INTEGER myThid |
37 |
|
|
|
38 |
|
|
C === Local variables === |
39 |
|
|
C msgBuf - Informational/error meesage buffer |
40 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
41 |
gforget |
1.11 |
#ifdef ALLOW_GENCOST_CONTRIBUTION |
42 |
|
|
INTEGER k |
43 |
|
|
#endif |
44 |
heimbach |
1.2 |
|
45 |
heimbach |
1.3 |
_BEGIN_MASTER(myThid) |
46 |
|
|
|
47 |
gforget |
1.10 |
#if (defined (ALLOW_TRANSPORT_COST_CONTRIBUTION) || \ |
48 |
|
|
defined (ALLOW_NEW_SSH_COST)) |
49 |
heimbach |
1.3 |
IF ( ndaysrec .GT. maxNumDays ) THEN |
50 |
jmc |
1.6 |
WRITE(msgBuf,'(2A,2I10)') |
51 |
heimbach |
1.3 |
& 'ECCO_CHECK: for ALLOW_TRANSPORT_COST_CONTRIBUTION: ', |
52 |
|
|
& 'ndaysrec > maxNumDays in ecco_cost.h ', |
53 |
|
|
& ndaysrec, maxNumDays |
54 |
atn |
1.15 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
55 |
heimbach |
1.3 |
& SQUEEZE_RIGHT , myThid ) |
56 |
|
|
CALL PRINT_ERROR( msgBuf , myThid ) |
57 |
|
|
STOP 'ABNORMAL END: S/R ECCO_CHECK' |
58 |
|
|
ENDIF |
59 |
gforget |
1.10 |
#endif |
60 |
heimbach |
1.3 |
|
61 |
gforget |
1.7 |
#ifdef ALLOW_PROFILES_CONTRIBUTION |
62 |
|
|
IF ( .NOT.usePROFILES ) THEN |
63 |
|
|
WRITE(msgBuf,'(2A)') |
64 |
|
|
& 'ECCO_CHECK: for ALLOW_PROFILES_CONTRIBUTION ', |
65 |
|
|
& 'requires usePROFILES to be .true.' |
66 |
atn |
1.15 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
67 |
gforget |
1.7 |
& SQUEEZE_RIGHT , myThid ) |
68 |
|
|
CALL PRINT_ERROR( msgBuf , myThid ) |
69 |
|
|
STOP 'ABNORMAL END: S/R ECCO_CHECK' |
70 |
|
|
ENDIF |
71 |
|
|
#endif |
72 |
|
|
|
73 |
gforget |
1.17 |
cgf next line is only for backward compatibility |
74 |
|
|
IF ( (using_topex).AND.(.NOT.using_tpj) ) using_tpj=.TRUE. |
75 |
|
|
|
76 |
heimbach |
1.3 |
_END_MASTER(myThid) |
77 |
heimbach |
1.2 |
|
78 |
gforget |
1.10 |
c check for missing data files |
79 |
|
|
#ifdef ALLOW_BP_COST_CONTRIBUTION |
80 |
|
|
CALL ECCO_CHECK_FILES( using_cost_bp,'bp', |
81 |
|
|
& bpdatfile, bpstartdate(1), myThid ) |
82 |
|
|
#endif |
83 |
|
|
#ifdef ALLOW_SST_COST_CONTRIBUTION |
84 |
|
|
CALL ECCO_CHECK_FILES( using_cost_sst,'sst', |
85 |
|
|
& sstdatfile, sststartdate(1), myThid ) |
86 |
|
|
#endif |
87 |
atn |
1.15 |
#ifdef ALLOW_TMI_SST_COST_CONTRIBUTION |
88 |
gforget |
1.10 |
CALL ECCO_CHECK_FILES( using_cost_sst,'sst', |
89 |
|
|
& tmidatfile, tmistartdate(1), myThid ) |
90 |
|
|
#endif |
91 |
|
|
#if (defined (ALLOW_SCAT_COST_CONTRIBUTION) || \ |
92 |
|
|
defined (ALLOW_DAILYSCAT_COST_CONTRIBUTION) ) |
93 |
|
|
CALL ECCO_CHECK_FILES( using_cost_scat,'scat', |
94 |
|
|
& scatxdatfile, scatxstartdate(1), myThid ) |
95 |
|
|
CALL ECCO_CHECK_FILES( using_cost_scat,'scat', |
96 |
|
|
& scatydatfile, scatystartdate(1), myThid ) |
97 |
|
|
#endif |
98 |
gforget |
1.17 |
|
99 |
|
|
#ifdef ALLOW_OLD_ESTIM_CODES |
100 |
|
|
|
101 |
gforget |
1.10 |
#ifdef ALLOW_SSH_COST_CONTRIBUTION |
102 |
gforget |
1.17 |
IF ( using_tpj ) CALL ECCO_CHECK_FILES( using_tpj, |
103 |
gforget |
1.11 |
& 'altim', topexfile, topexstartdate(1), myThid ) |
104 |
gforget |
1.10 |
IF ( using_ers ) CALL ECCO_CHECK_FILES( using_ers, |
105 |
gforget |
1.11 |
& 'altim', ersfile, ersstartdate(1), myThid ) |
106 |
gforget |
1.10 |
IF ( using_gfo ) CALL ECCO_CHECK_FILES( using_gfo, |
107 |
gforget |
1.11 |
& 'altim', gfofile, gfostartdate(1), myThid ) |
108 |
gforget |
1.10 |
c |
109 |
gforget |
1.17 |
IF ( (.NOT.using_tpj ).AND.(.NOT.using_ers) |
110 |
gforget |
1.10 |
& .AND.(.NOT.using_gfo) ) THEN |
111 |
|
|
c warn user as we override using_cost_altim |
112 |
|
|
WRITE(msgBuf,'(2A)') |
113 |
heimbach |
1.13 |
& '** WARNING ** S/R ECCO_CHECK: missing file: ', |
114 |
gforget |
1.10 |
& ' for altimeter data so cost gets switched off' |
115 |
|
|
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
116 |
|
|
& SQUEEZE_RIGHT , myThid) |
117 |
|
|
c switch off cost function term |
118 |
|
|
using_cost_altim = .FALSE. |
119 |
|
|
ENDIF |
120 |
|
|
#endif |
121 |
gforget |
1.11 |
#ifdef ALLOW_SSH_MEAN_COST_CONTRIBUTION |
122 |
|
|
CALL ECCO_CHECK_FILES( using_cost_altim, |
123 |
atn |
1.16 |
& 'mdt', mdtdatfile, modelstartdate(1), myThid ) |
124 |
gforget |
1.11 |
#endif |
125 |
gforget |
1.10 |
|
126 |
gforget |
1.17 |
#endif /* ALLOW_OLD_ESTIM_CODES */ |
127 |
|
|
|
128 |
gforget |
1.10 |
c left for later : slightly different treatment would apply to profiles and gencost |
129 |
|
|
|
130 |
gforget |
1.11 |
#ifdef ALLOW_GENCOST_CONTRIBUTION |
131 |
|
|
do k=1,NGENCOST |
132 |
|
|
if ( gencost_datafile(k) .ne. ' ' ) then |
133 |
|
|
CALL ECCO_CHECK_FILES( using_gencost(k), 'gencost', |
134 |
gforget |
1.17 |
& gencost_datafile(k), gencost_startdate1(k), myThid ) |
135 |
gforget |
1.14 |
#ifdef ALLOW_SEAICE_COST_CONTRIBUTION |
136 |
|
|
if (gencost_name(k).EQ.'siv4-conc') |
137 |
|
|
& using_cost_seaice=using_gencost(k) |
138 |
atn |
1.15 |
if (gencost_name(k).EQ.'siv4-deconc') |
139 |
gforget |
1.14 |
& using_cost_seaice=using_gencost(k) |
140 |
atn |
1.15 |
if (gencost_name(k).EQ.'siv4-exconc') |
141 |
gforget |
1.14 |
& using_cost_seaice=using_gencost(k) |
142 |
atn |
1.15 |
catn-- put stop statement if use old siv4 names: |
143 |
|
|
if (gencost_name(k).EQ.'siv4-sst') then |
144 |
|
|
WRITE(msgBuf,'(2A)') |
145 |
|
|
& 'ECCO_CHECK: OLD seaice gencost_name siv4-sst is retired,', |
146 |
|
|
& ' NEW name is siv4-deconc' |
147 |
|
|
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
148 |
|
|
& SQUEEZE_RIGHT , myThid ) |
149 |
|
|
CALL PRINT_ERROR( msgBuf , myThid ) |
150 |
|
|
STOP 'ABNORMAL END: S/R ECCO_CHECK' |
151 |
|
|
endif |
152 |
|
|
if (gencost_name(k).EQ.'siv4-vol') then |
153 |
|
|
WRITE(msgBuf,'(2A)') |
154 |
|
|
& 'ECCO_CHECK: OLD seaice gencost_name siv4-vol is retired,', |
155 |
|
|
& ' NEW name is siv4-exconc' |
156 |
|
|
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
157 |
|
|
& SQUEEZE_RIGHT , myThid ) |
158 |
|
|
CALL PRINT_ERROR( msgBuf , myThid ) |
159 |
|
|
STOP 'ABNORMAL END: S/R ECCO_CHECK' |
160 |
|
|
endif |
161 |
gforget |
1.14 |
#endif |
162 |
gforget |
1.11 |
endif |
163 |
|
|
enddo |
164 |
|
|
#endif |
165 |
|
|
|
166 |
heimbach |
1.2 |
RETURN |
167 |
|
|
END |
168 |
gforget |
1.10 |
|
169 |
|
|
|
170 |
|
|
SUBROUTINE ECCO_CHECK_FILES( |
171 |
|
|
O using_cost_local, |
172 |
|
|
I localname, localobsfile, localstartdate1, |
173 |
|
|
I myThid ) |
174 |
|
|
|
175 |
|
|
C /==========================================================\ |
176 |
|
|
C | SUBROUTINE ECCO_CHECK_FILES | |
177 |
|
|
C | o Check that obs files are present for specified years. | |
178 |
|
|
C | If not then set using_cost_local to false. | |
179 |
|
|
C \==========================================================/ |
180 |
|
|
IMPLICIT NONE |
181 |
|
|
|
182 |
|
|
C === Global variables === |
183 |
|
|
#include "SIZE.h" |
184 |
|
|
#include "EEPARAMS.h" |
185 |
|
|
#include "PARAMS.h" |
186 |
|
|
#include "ecco_cost.h" |
187 |
|
|
#ifdef ALLOW_CAL |
188 |
|
|
# include "cal.h" |
189 |
|
|
#endif |
190 |
|
|
|
191 |
|
|
C === Routine arguments === |
192 |
|
|
C myThid - Number of this instances |
193 |
|
|
INTEGER myThid |
194 |
|
|
LOGICAL using_cost_local |
195 |
|
|
character*(*) localname |
196 |
|
|
character*(MAX_LEN_FNAM) localobsfile |
197 |
|
|
integer localstartdate1 |
198 |
|
|
|
199 |
|
|
C === Local variables === |
200 |
|
|
C msgBuf - Informational/error meesage buffer |
201 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
202 |
gforget |
1.11 |
INTEGER irec, mody, modm, yday, locy, il |
203 |
gforget |
1.12 |
LOGICAL exst, singleFileTest, yearlyFileTest |
204 |
gforget |
1.10 |
character*(128) fname |
205 |
|
|
|
206 |
|
|
c == external functions == |
207 |
|
|
|
208 |
|
|
integer ilnblnk |
209 |
|
|
external ilnblnk |
210 |
|
|
|
211 |
|
|
c == end of interface == |
212 |
|
|
|
213 |
|
|
c left for later : refine test accounting for localstartdate1 |
214 |
|
|
|
215 |
|
|
#ifdef ALLOW_CAL |
216 |
|
|
|
217 |
|
|
_BEGIN_MASTER(myThid) |
218 |
|
|
|
219 |
|
|
IF ( (using_cost_local).AND.(localobsfile.EQ.' ') ) THEN |
220 |
|
|
c warn user as we override using_cost_local |
221 |
|
|
WRITE(msgBuf,'(4A)') |
222 |
|
|
& '** WARNING ** ECCO_CHECK_FILES: missing file', |
223 |
|
|
& ' definition so ',localname,' gets switched off' |
224 |
|
|
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
225 |
|
|
& SQUEEZE_RIGHT , myThid) |
226 |
|
|
c switch off cost function term |
227 |
|
|
using_cost_local = .FALSE. |
228 |
|
|
ENDIF |
229 |
|
|
|
230 |
|
|
singleFileTest = .FALSE. |
231 |
|
|
IF (using_cost_local) THEN |
232 |
|
|
inquire( file=localobsfile, exist=exst ) |
233 |
|
|
IF ( exst ) singleFileTest=.TRUE. |
234 |
|
|
ENDIF |
235 |
|
|
|
236 |
gforget |
1.12 |
yearlyFileTest = .FALSE. |
237 |
gforget |
1.10 |
IF ( (using_cost_local).AND.(.NOT.singleFileTest) ) THEN |
238 |
|
|
DO irec = 1, nmonsrec |
239 |
|
|
mody = modelstartdate(1)/10000 |
240 |
|
|
modm = modelstartdate(1)/100 - mody*100 |
241 |
|
|
yday = mody + INT((modm-1+irec-1)/12) |
242 |
|
|
|
243 |
gforget |
1.11 |
locy = localstartdate1/10000 |
244 |
|
|
|
245 |
gforget |
1.10 |
il=ilnblnk(localobsfile) |
246 |
|
|
write(fname(1:128),'(2a,i4)') |
247 |
|
|
& localobsfile(1:il), '_', yday |
248 |
|
|
inquire( file=fname, exist=exst ) |
249 |
|
|
|
250 |
gforget |
1.11 |
IF ( (.NOT.exst).AND.(yday.GE.locy) ) THEN |
251 |
gforget |
1.10 |
c warn user as we override using_cost_local |
252 |
|
|
WRITE(msgBuf,'(5A)') |
253 |
|
|
& '** WARNING ** ECCO_CHECK_FILES: missing',fname, |
254 |
|
|
& ' so ',localname,' gets switched off' |
255 |
|
|
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
256 |
|
|
& SQUEEZE_RIGHT , myThid) |
257 |
|
|
c switch off cost function term |
258 |
|
|
using_cost_local = .FALSE. |
259 |
gforget |
1.12 |
ELSEIF ( (exst).AND.(yday.GE.locy) ) THEN |
260 |
|
|
yearlyFileTest = .TRUE. |
261 |
gforget |
1.10 |
ENDIF |
262 |
|
|
ENDDO |
263 |
|
|
ENDIF |
264 |
gforget |
1.12 |
|
265 |
|
|
IF (using_cost_local) THEN |
266 |
|
|
IF ( (.NOT.yearlyFileTest).AND.(.NOT.singleFileTest) ) THEN |
267 |
|
|
c warn user as we override using_cost_local |
268 |
|
|
WRITE(msgBuf,'(4A)') |
269 |
|
|
& '** WARNING ** ECCO_CHECK_FILES: no data ', |
270 |
|
|
& ' so ',localname,' gets switched off' |
271 |
|
|
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
272 |
|
|
& SQUEEZE_RIGHT , myThid) |
273 |
|
|
c switch off cost function term |
274 |
|
|
using_cost_local = .FALSE. |
275 |
|
|
ENDIF |
276 |
|
|
ENDIF |
277 |
gforget |
1.10 |
|
278 |
|
|
_END_MASTER(myThid) |
279 |
|
|
|
280 |
|
|
#endif /* ALLOW_CAL */ |
281 |
|
|
|
282 |
|
|
RETURN |
283 |
|
|
END |
284 |
|
|
|
285 |
|
|
|
286 |
|
|
|