Coastal & Marine Geology InfoBank

Home FACS Activities Atlas Geology School Related Sites More

USGS InfoBank program -- tmechk

Skip navigational links
Loading
InfoBank Programs: by Name   by Topic  
Expanded Description
Topic Description
Name
tmechk
Synopsis
/infobank/programs/time/tmechk/tmechk.for
Description
  Program to check for negative, zero, and excessive time jumps, and

  for invalid times. 
       
COMMENTS
  An output log file is created listing the location of all time errors found.

  Also an optional output file can be created which is a copy of the input
  file with all time errors (except for excessive time jumps) flagged with a
  '!' in column 1.
    
PROMPTS
  Enter input file name:

  Enter output log file name:
  Enter the MAXIMUM acceptable time jump (integer seconds):
    (a negative time jump causes a "!" to be inserted
     before non-excessive jumps in a copy of the input file)
    
SUBPROGRAMS
  openem       (external shareable)

  forerror     (external shareable)
  countheaders (internal function)
    
AUTHOR
  Ed Maple  6/4/90

    Extensive modifications made to version of TMECHK written by Ed
    Maple on 5/2/84, and modified by Ed Maple and Clint Steele.
  Clint Steele  11/19/92   changed handling of negative time jumps
       to report but still update last time
  Michael Hamer 5/31/94    fixed "!" writing only for negative, zero 
       and impossible times.  Added 'BANG' to end of "!" file.
  Michael Hamer 5/03/99    removed calls to percentage

    
Reads
          read (InputUnit, '(q,a)', end=900)
     *        RecordLength, InputRecord(1:RecordLength)
          read (InputRecord(1:RecordLength), 
     *        '(i4,i3,3i2,i1,i1)', iostat = ReadStatus, end = 900)
     *        CurrentYear, CurrentDay, CurrentHour, CurrentMinute, 
     *        CurrentSecond, CurrentTenth, CurrentHundreth
          read (InputUnit, '(a1)') Bang
Writes
      write (LogUnit, '(a)')
     *    'Timecheck for file '//InputFileName (1:NameLength)
      write (LogUnit, '(a,i5,a,/)') '  Time gap = ', AcceptableTimeGap,
     *    ' seconds.'
          write (LogUnit, '(a)')
     *        '"!" flags in file '//OutputFileName (1:NameLength)
              write (LogUnit, '(a17,i6)') '  Error reading #', ReadCount
                  write (LogUnit, 400) ErrorMessage, ReadCount,
     *                            CurrentYear, CurrentDay, CurrentHour,
     *                            CurrentMinute, CurrentSecond,
     *                            CurrentTenth, CurrentHundreth
                      write (LogUnit, 410)
     *                    ErrorMessage, ReadCount, 
     *                    LastYear, LastDay, LastHour,
     *                    LastMinute, LastSecond, 
     *                    LastTenth, LastHundreth,
     *                    CurrentYear, CurrentDay,
     *                    CurrentHour, CurrentMinute, CurrentSecond,
     *                    CurrentTenth, CurrentHundreth, 
     *                    (CurrentYear-LastYear),
     *                    DeltaDay, DeltaHour,
     *                    DeltaMinute, DeltaSecond, 
     *                    DeltaTenth, DeltaHundreth
                      write (LogUnit, 400)
     *                    ErrorMessage, ReadCount, CurrentYear, 
     *                    CurrentDay,
     *                    CurrentHour, CurrentMinute, CurrentSecond,
     *                    CurrentTenth, CurrentHundreth
                      write (LogUnit, 410)
     *                    ErrorMessage, ReadCount, 
     *                    LastYear, LastDay, LastHour,
     *                    LastMinute, LastSecond, 
     *                    LastTenth, LastHundreth,
     *                    CurrentYear, CurrentDay,
     *                    CurrentHour, CurrentMinute, CurrentSecond,
     *                    CurrentTenth, CurrentHundreth,
     *                    (CurrentYear - LastYear), 
     *                    DeltaDay, DeltaHour,
     *                    DeltaMinute, DeltaSecond, 
     *                    DeltaTenth, DeltaHundreth
                  write (OutputUnit, '(''!'',a)')
     *                InputRecord (2:RecordLength)
                  write (OutputUnit, '(a)') InputRecord (1:RecordLength)
      write (LogUnit, '(/,a,i4.4,i3.3,3i2.2,2i1.1)')
     *    'Starting time = ', CurrentYear,
     *    CurrentDay, CurrentHour, CurrentMinute,
     *    CurrentSecond, CurrentTenth, CurrentHundreth
      write (LogUnit, '(a,i4.4,i3.3,3i2.2,2i1.1)')
     *    '  Ending time = ', LastYear,
     *    LastDay, LastHour, LastMinute, LastSecond,
     *    LastTenth, LastHundreth
Opens
          open (unit = OutputUnit, status = 'NEW', form = 'FORMATTED',
     *           iostat = ErrorCode,
     *          file = (InputFileName (1:Semicolon) // 'BANG'))
Calls
      call openem (1, -1)
      call stringlen (InputFileName, NameLength)
              call forerror (ErrorCode)
          call stringlen (OutputFileName, NameLength)
              call converttimex ('COMPRESS', CurrentDay, CurrentHour,
     *                          CurrentMinute, CurrentSecond,
     *                          CurrentTenth, CurrentHundreth, 
     *                          CurrentTime, TimeError)
                  call converttimex ('EXPAND', DeltaDay, DeltaHour, 
     *                              DeltaMinute, DeltaSecond,
     *                              DeltaTenth, DeltaHundreth, 
     *                              abs(DeltaTime), TimeError)
      call converttimex ('EXPAND', CurrentDay, CurrentHour,
     *                  CurrentMinute, CurrentSecond, 
     *                  CurrentTenth, CurrentHundreth,
     *                  StartTime, TimeError)

Skip footer navigational links

Coastal and Marine Science Centers:  Pacific   St. Petersburg   Woods Hole  
InfoBank   Coastal and Marine Geology Program   Geologic Information   Ask-A-Geologist   USGS Disclaimer  


Accessibility FOIA Privacy Policies and Notices

Take Pride in America logo USA.gov logo U.S. Department of the Interior | U.S. Geological Survey
URL: http://walrus.wr.usgs.gov/infobank/programs/time/tmechk/tmechk.doc.html
Page Contact Information: InfoBank staff
Page Last Modified: Mon Sep 16 03:38:55 PDT 2013  (chd)