c subroutine chmtimes(mtimes,mxtms,ntms,ispval) integer mtimes(3,mxtms) logical int_is_str, isshort mtime_to_min(iday,ihr,min) = iday*1440 + ihr*60 + min c c Check mtimes as given by namelist. c If isshort=T, this means mtimes has been given in the form: c "id0,ih0,im0,'to',id1,ih1,im1,'by',idelmin", where: c id0,ih0,im0 = beginning model time, id1,ih1,im1 = ending model time, and c idelmin is delta time in minutes. c e.g: mtimes = 0,0,0,'to',1,0,0,'by',60 c In this case (isshort), expand to proper mtimes c If not isshort, just check validity of each component of each model time c Also return ntms as number of valid times. c isshort = .false. if ((int_is_str(mtimes(1,2),'to').or. + int_is_str(mtimes(1,2),'TO')).and. + (int_is_str(mtimes(2,3),'by').or. + int_is_str(mtimes(2,3),'BY'))) isshort = .true. if (isshort) then idmin = mtimes(3,3) maxmin = mtime_to_min(mtimes(2,2),mtimes(3,2),mtimes(1,3)) nntms = (maxmin - + mtime_to_min(mtimes(1,1),mtimes(2,1),mtimes(3,1))) / idmin + 1 if (nntms.gt.mxtms) then write(6,"(/'>>> WARNING: too many times? ntms=',i3, + ' mxtms=',i3,' -- number of times will be limited to ', + 'mxtms=',i3)") nntms,mxtms,mxtms endif do i=1,mxtms if (i.gt.1) then min=mtime_to_min(mtimes(1,i-1),mtimes(2,i-1),mtimes(3,i-1))+ + idmin call min_to_mtime(min,mtimes(1,i),mtimes(2,i),mtimes(3,i)) if (mtime_to_min(mtimes(1,i),mtimes(2,i),mtimes(3,i)).gt. + maxmin.or.i.eq.mxtms) then ntms = i-1 if (i.eq.mxtms) ntms = i return endif endif enddo else do i=1,mxtms if (mtimes(1,i).ne.ispval.and.mtimes(2,i).ne.ispval.and. + mtimes(3,i).ne.ispval) then if (mtimes(1,i).lt.0.or.mtimes(1,i).gt.367) then write(6,"('>>> Warning: bad model day=',i5)") mtimes(1,i) endif if (mtimes(2,i).lt.0.or.mtimes(2,i).gt.23) then write(6,"('>>> Warning: bad model hour=',i5)") mtimes(2,i) endif if (mtimes(3,i).lt.0.or.mtimes(3,i).gt.59) then write(6,"('>>> Warning: bad model minute=',i5)") + mtimes(3,i) endif endif enddo ntms = 0 do i=1,mxtms if (mtimes(1,i).ne.ispval.and.mtimes(2,i).ne.ispval.and. + mtimes(3,i).ne.ispval) ntms = ntms+1 enddo endif return end