75 |
CHARACTER*(MAX_LEN_FNAM) fn |
CHARACTER*(MAX_LEN_FNAM) fn |
76 |
CHARACTER*(MAX_LEN_MBUF) suff |
CHARACTER*(MAX_LEN_MBUF) suff |
77 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
78 |
INTEGER prec, nRec |
INTEGER prec, nRec, nTimRec |
79 |
|
_RL timeRec(2) |
80 |
#ifdef ALLOW_MDSIO |
#ifdef ALLOW_MDSIO |
81 |
LOGICAL glf |
LOGICAL glf |
|
_RL timeRec(1) |
|
82 |
#endif |
#endif |
83 |
#ifdef ALLOW_MNC |
#ifdef ALLOW_MNC |
84 |
INTEGER ll, llMx, jj, jjMx |
INTEGER ll, llMx, jj, jjMx |
104 |
|
|
105 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
106 |
|
|
107 |
|
C--- set file properties |
108 |
ioUnit= standardMessageUnit |
ioUnit= standardMessageUnit |
109 |
undef = UNSET_RL |
undef = UNSET_RL |
110 |
#ifdef ALLOW_FIZHI |
#ifdef ALLOW_FIZHI |
115 |
ilen = ILNBLNK(fnames(listId)) |
ilen = ILNBLNK(fnames(listId)) |
116 |
WRITE( fn, '(A,A,A)' ) fnames(listId)(1:ilen),'.',suff(1:10) |
WRITE( fn, '(A,A,A)' ) fnames(listId)(1:ilen),'.',suff(1:10) |
117 |
|
|
118 |
|
C-- Set time information: |
119 |
|
IF ( freq(listId).LT.0. ) THEN |
120 |
|
C- Snap-shot: store a unique time (which is consistent with State-Var timing) |
121 |
|
nTimRec = 1 |
122 |
|
timeRec(1) = myTime |
123 |
|
ELSE |
124 |
|
C- Time-average: store the 2 edges of the time-averaging interval. |
125 |
|
C this time is consitent with intermediate Var (i.e., non-state, e.g, flux, |
126 |
|
C tendencies) timing. For State-Var, this is shifted by + halt time-step. |
127 |
|
nTimRec = 2 |
128 |
|
|
129 |
|
C- end of time-averaging interval: |
130 |
|
timeRec(2) = myTime |
131 |
|
|
132 |
|
C- begining of time-averaging interval: |
133 |
|
c timeRec(1) = myTime - freq(listId) |
134 |
|
C a) find the time of the previous multiple of output freq: |
135 |
|
timeRec(1) = myTime-deltaTClock*0.5 _d 0 |
136 |
|
timeRec(1) = (timeRec(1)-phase(listId))/freq(listId) |
137 |
|
i = INT( timeRec(1) ) |
138 |
|
timeRec(1) = phase(listId) + freq(listId)*FLOAT(i) |
139 |
|
c if ( listId.eq.2 ) write(0,*) 'f',i,timeRec(1)/deltaTClock |
140 |
|
timeRec(1) = MAX( timeRec(1), startTime ) |
141 |
|
|
142 |
|
C b) round off to nearest multiple of time-step: |
143 |
|
timeRec(1) = (timeRec(1)-baseTime)/deltaTClock |
144 |
|
i = NINT( timeRec(1) ) |
145 |
|
C if just half way, NINT will return the next time-step: correct this |
146 |
|
tmpLev = FLOAT(i) - 0.5 _d 0 |
147 |
|
IF ( timeRec(1).EQ.tmpLev ) i = i - 1 |
148 |
|
timeRec(1) = baseTime + deltaTClock*FLOAT(i) |
149 |
|
c if ( listId.eq.2 ) write(0,*) i,timeRec(1)/deltaTClock |
150 |
|
ENDIF |
151 |
|
|
152 |
#ifdef ALLOW_MNC |
#ifdef ALLOW_MNC |
153 |
C-- this is a trick to reverse the order of the loops on md (= field) |
C-- this is a trick to reverse the order of the loops on md (= field) |
154 |
C and lm (= averagePeriod): binary output: lm loop inside md loop ; |
C and lm (= averagePeriod): binary output: lm loop inside md loop ; |
603 |
C meta files but with more informations in it. |
C meta files but with more informations in it. |
604 |
glf = globalFiles |
glf = globalFiles |
605 |
nRec = nfields(listId)*averageCycle(listId) |
nRec = nfields(listId)*averageCycle(listId) |
|
timeRec(1) = myTime |
|
606 |
CALL MDS_WR_METAFILES(fn, prec, glf, .FALSE., |
CALL MDS_WR_METAFILES(fn, prec, glf, .FALSE., |
607 |
& 0, 0, nlevels(listId), ' ', |
& 0, 0, nlevels(listId), ' ', |
608 |
& nfields(listId), flds(1,listId), 1, timeRec, |
& nfields(listId), flds(1,listId), nTimRec, timeRec, |
609 |
& nRec, myIter, myThid) |
& nRec, myIter, myThid) |
610 |
ENDIF |
ENDIF |
611 |
#endif /* ALLOW_MDSIO */ |
#endif /* ALLOW_MDSIO */ |