anchor.diff:  !-------------------------------------------------------------------------------
   
   !===============================================================================
  +subroutine rad3_write_rad_file(tr, file)
  +!===============================================================================
  +! Save the ASCII header file.  Supply filename without the .rad extension.
  +   type(rad3trace), intent(in) :: tr
  +   character(len=*), intent(in) :: file
  +   call rad3_check_file_name(file)
  +   open(IOUT, file=trim(file)//'.rad')
  +   write(IOUT, '(a,i0)')   'SAMPLES:', tr % n
  +   write(IOUT, '(a,f0.6)') 'FREQUENCY:', tr % frequency
  +   write(IOUT, '(a,i0)')   'FREQUENCY STEPS:', tr % frequency_steps
  +   write(IOUT, '(a,f0.6)') 'SIGNAL POSITION:', tr % signal_position
  +   write(IOUT, '(a,i0)')   'RAW SIGNAL POSITION:', tr % raw_signal_position
  +   write(IOUT, '(a,i0)')   'DISTANCE FLAG:', tr % distance_flag
  +   write(IOUT, '(a,i0)')   'TIME FLAG:', tr % time_flag
  +   write(IOUT, '(a,i0)')   'PROGRAM FLAG:', tr % program_flag
  +   write(IOUT, '(a,i0)')   'EXTERNAL FLAG:', tr % external_flag
  +   write(IOUT, '(a,f0.6)') 'TIME INTERVAL:', tr % time_interval
  +   write(IOUT, '(a,f0.6)') 'DISTANCE INTERVAL:', tr % distance_interval
  +   write(IOUT, '(a,a)')    'OPERATOR:', tr % operator_name
  +   write(IOUT, '(a,a)')    'CUSTOMER:', tr % customer_name
  +   write(IOUT, '(a,a)')    'SITE:', tr % site_name
  +   write(IOUT, '(a,a)')    'ANTENNAS:', tr % antennas
  +   write(IOUT, '(a,a)')    'ANTENNA ORIENTATION:', tr % antenna_orientation
  +   write(IOUT, '(a,f0.6)') 'ANTENNA SEPARATION:', tr % antenna_separation
  +   write(IOUT, '(a,a)')    'COMMENT:', tr % comment
  +   write(IOUT, '(a,f0.6)') 'TIMEWINDOW:', tr % timewindow
  +   write(IOUT, '(a,i0)')   'STACKS:', tr % stacks
  +   write(IOUT, '(a,i0)')   'STACK EXPONENT:', tr % stack_exponent
  +   write(IOUT, '(a,f0.6)') 'STACKING TIME:', tr % stacking_time
  +   write(IOUT, '(a,i0)')   'LAST TRACE:', tr % last_trace
  +   write(IOUT, '(a,f0.6)') 'STOP POSITION:', tr % stop_position
  +   write(IOUT, '(a,f0.10)')'SYSTEM CALIBRATION:', tr % system_calibration
  +   write(IOUT, '(a,f0.6)') 'START POSITION:', tr % start_position
  +   write(IOUT, '(a,i0)')   'SHORT FLAG:', tr % short_flag
  +   write(IOUT, '(a,i0)')   'INTERMEDIATE FLAG:', tr % intermediate_flag
  +   write(IOUT, '(a,i0)')   'LONG FLAG:', tr % long_flag
  +   write(IOUT, '(a,i0)')   'PREPROCESSING:', tr % preprocessing
  +   write(IOUT, '(a,i0)')   'HIGH:', tr % high
  +   write(IOUT, '(a,i0)')   'LOW:', tr % low
  +   write(IOUT, '(a,f0.6)') 'FIXED INCREMENT:', tr % fixed_increment
  +   write(IOUT, '(a,i0)')   'FIXED MOVES UP:', tr % fixed_moves_up
  +   write(IOUT, '(a,i0)')   'FIXED MOVES DOWN:', tr % fixed_moves_down
  +   write(IOUT, '(a,f0.6)') 'FIXED POSITION:', tr % fixed_position
  +   write(IOUT, '(a,f0.6)') 'WHEEL CALIBRATION:', tr % wheel_calibration
  +   write(IOUT, '(a,i0)')   'POSITIVE DIRECTION:', tr % positive_direction
  +   close(IOUT)
  +end subroutine rad3_write_rad_file
  +!-------------------------------------------------------------------------------
  +
  +!===============================================================================
   subroutine rad3_remove_mean(tr)
   !===============================================================================
   ! Remove the mean trace from each shot
  
positive.code: !-------------------------------------------------------------------------------
  
  !===============================================================================
  subroutine rad3_info(tr)
  !===============================================================================
  ! Write some useful information about a rad3 file to stdout
     type(rad3trace), intent(in) :: tr
     write(ISTDOUT,'(a,f0.8)') 'delta = ', tr % delta
     write(ISTDOUT,'(a,i0.0)') 'npts  = ', tr % n
     write(ISTDOUT,'(a,f0.8)') 'dx    = ', tr % distance_interval
     write(ISTDOUT,'(a,f0.8)') 'xmax  = ', tr % x(tr%last_trace)
     write(ISTDOUT,'(a,f0.8)') 'tmax  = ', tr % twtt(tr%n)
     write(ISTDOUT,'(a,i0.0)') 'xpts  = ', tr % last_trace
  end subroutine rad3_info
  !-------------------------------------------------------------------------------
  
  
negative.code: 
     ! Helper routines not exposed
     private :: rad3_error, &
                rad3_warning, &
                rad3_allocate, &
                rad3_verbose, &
                rad3_check_file_name
  
     ! Type defining a section (collection of traces)
     type rad3trace
  