#! /usr/bin/env python # -*- coding: cp1252 -*- ''' *************************************************************************************** G E N E R A T E U K O O A P 1 / 9 0 F I L E O B S - G E O M A R T Y P E (this version is adapted to Geomar scripts and formats of 2014 by nl) NOTE: Check any shot points that falls on midnight. If EIVA Survey Computer shot time replacement by GPS Shot time means that date should be altered, this must be done manually. DESCRIPTION: Merges information from two sources: a) The navigation files from the EIVA Survey computer, which holds records of Shot point (SP) number, UTM coordinates, date, time, depth and other parameters and b) accurate GPS based timing of each shot. Sequence of processing steps: A] The script applies an offset to EASTING & NORTHING coordinates in EIVA navigation file, in order to adjust for distance between seismic source and position reference point. Offset adjustment it based on treating shot points as vectors: First the difference vector between current and previous SP is calculated. This vector is divided by its own length, obtaining a unit length vector. The unit length vector is then multiplied by the offset distance, yielding a correction vector that is subtracted from current SP. First SP is treated differently though, as there is no previous SP in that case; instead, next SP is used to obtain correction vector. B] Collect corresponding GPS time stamp from the other file. Convert GPS time stamp to UTC. Check that timestamps in EIVA and GPS-file differs only by a user-defined amount. C] Generate UKOOA file. INPUT FILES: Must be in same directory as this script. Name of input files stated in Constant section below. OUTPUT FILE: Will be placed in same directory as this script. UKOOA P1/90 HEADER, UTM ZONE, OFFSET DISTANCE: See 'Constant' section below. EXTERNAL LIBRARY USED: UTM to Lat/Long conversion - download library from: http://www.pygps.org/#LatLongUTMconversion Either: a) On Linux: Unpack it, and run "python setup.py install" as root. In order to build Python modules you must first install 'python-devel'. b) Windows/Linux: Put "LatLongUTMconversion.py" in the same directory as this file. PYTHON ON WINDOWS: This script was developed on Windows version of Python. It should run on Unix/Linux without any changes. Download Python for Windows from http://www.python.org N O T E : In UKOOA file, line termination will be CR+LF on Win, and LF on Linux/Unix. VERSION: Ver Date By Description ---------------------------------------------------------------------------------- 0.6 08 Aug 2014 O.M. LINE 367: Fixed error condition: If GPS shot time is less then LEAP_SECONDS after midnight, also the day part of the time variable will be decremented (note: we use Python's time object that also keeps info on year-month-day). Thus the comparison with nav data event time would fail (incorrectly). Fixed by checking 'day' part of variable, and adding 24 hours if necessary. 0.5 Aug 2014 Nina Adjusted UKOOA P1/90 output formatting so Geomar is content. 0.4 23 Dec 2013 O.M. 2013 version. 0.3 8 Jun 2010 O.M. Can now use coordinates in all hemispheres. 0.2 4 Jun 2009 O.M. Changes: a) SP numbering made consecutive b) Much more plot QC output c) Fixed round off error if GPS fraction was > 0.995 s 0.1 1 Jun 2009 O. Meyer Initial version ---------------------------------------------------------------------------------- Department of Earth Science University of Bergen N O R W A Y *************************************************************************************** ''' import LatLongUTMconversion import os from string import split from os.path import join from datetime import datetime, timedelta from time import strptime, strftime, gmtime from cmath import * CR_LF = '\x0d\x0a' #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #++++ #++++ You can edit this section: LINE_NAME = '32' # Max 6 characters, only number UTM_Zone = '33W' # MUST also include letter! WGS84 = 23 # Datum constant, see LatLongUTMconversion file. SOURCE_OFFSET = 67.0 # Offset shot point positions by this amount. GPS_LEAPSECONDS = 16 # Set to zero, if using UiB time stamp equipment (it outputs time in UTC, so no adjustment is needed) # TIME_DIFF_TOLERANCE = 2.0 # In seconds. +/- tolerance on difference between Survey Computer # shot event time stamp, and time stamp from Ashtech GG24. SHOT_DISTANCE = 200.0 # In meter SHOT_DISTANCE_TOLERANCE = 3.0 # Shot interval distance tolerance, in meter EivaLogFile = 'OBS_2014-Storfjorden_event_data_line3-1-fixed.txt' # Name of EIVA Survey Computer log file, fixed (get rid of excess SPs) GPS_TimestampFile = 'p3-1-Storfjorden-OBS-2014-gps-timestamps-fixed.txt' # Name of GPS Time stamp file (fixed) UkooaFile = 'OBS-2014-P3-1-UKOOA-geomar.txt' # Name of output file # NOTE: Plotting file also generated, with "_plot" extension PlotFile = UkooaFile.split('.')[0] + '_plot.txt' # You don't need to change this. UKOOA_Header = \ '''H0100 SURVEY AREA| STORFJORDEN, SVALBARD H0101 SURVEY DETAILS| OBS-2014, PROFILE 3-1 H0102 VESSEL DETAILS| R.V. HAAKON MOSBY H0200 SURVEY DATE| AUGUST 2014 H0201 FILE CREATED| %s H0202 FILE VERSION| UKOOA P1/1990 - MODIFIED, SEE BELOW H0300 CLIENT| OBS-2014 H0400 GEOPHYSICAL CONTRACTOR| UNIVERSITY OF BERGEN, NORWAY H0500 POSITIONING CONTRACTOR| N/A H0600 POSITIONING PROCESSING| O.M. UNIVERSITY OF BERGEN, DEPT OF EARTH SCIENCE H0700 POSITIONING SYSTEM H0700 SURVEY COMPUTER SOFTWARE| NAVIPAC, EIVA, DENMARK H0700 GPS PRIMARY| SEAPATH 200 H0700 GPS SECONDARY| TRIMBLE 200D H0700 GPS DIFF CORRECTION UNIT| FUGRO SEASTAR MOD 3510 LR H0800 SHOTPOINT POSITION| CENTER OF SOURCE ARRAY H1000 CLOCK TIME| UTC H0900 OFFSET SHIP SYSTEM TO SP| %s M BEHIND H1200 SPHEROID AS SURVEYED| A,1/F WGS-84 Spheroid 6378137.000 298.2572236 H1300 SPHEROID AS PLOTTED| A,1/F WGS-84 Spheroid 6378137.000 298.2572236 H1400 GEODETIC DATUM SURVEYED| WGS-84 H1500 GEODETIC DATUM PLOTTED| WGS-84 H1700 VERTICAL DATUM SL| ECHO SOUNDER H1800 PROJECTION| 001 UTM NORTHERN HEMISPHERE H1900 ZONE| %s NORTHERN HEMISPHERE H2000 GRID UNIT| 1 INTERNATIONAL METER 1.00 H2001 HEIGHT UNIT| 1 INTERNATIONAL METER 1.00 H2002 ANGULAR UNITS| 1 DEGREES H2600 ORIGINAL POSITIONS REFERENCED TO GRAVITYMETER, FRAME 38, 24 M FROM STERN H2600 SOURCE DETAILS H2600 OFFSET CENTRE OF SOURCE TO POS REF: 60 METER H2600 OFFSET CENTRE OF SOURCE TO STERN: 60-24=36 METER H2600 4 AIRGUNS, TOTAL VOLUME: 4800 CUIN H2600 NO 1: BOLT 1500 1200 CUIN H2600 NO 2: BOLT 1500 1200 CUIN H2600 NO 3: BOLT 1500 1200 CUIN H2600 NO 4: BOLT 1500 1200 CUIN H2600 AIR PRESSURE NOMINAL: 138 BAR H2600 SOURCE DEPTH NOMINAL: 6 METER H2600 MAGNETOMETER DETAILS H2600 MFR: GEOMETRICS, MOD: G-882, SN: 882150 H2600 TOW FISH CABLE LENGTH DEPLOYED: 195 METER H2600 OFFSET TO SOURCE: 195-36 = 159 METER H2600 OFFSET TO NAVIGATION SYSTEM REFERENCE: 195+24 = 219 METER H2600 MINI-STREAMER DETAILS H2600 MFR: GEOMETRICS, MOD: MICROEEL H2600 CHANNELS: 8, GL: 6.25 M, 50 M ACTIVE, SN: ME-0008 H2600 STREAMER DEPTH NOMINAL: NO DEPTH CONTROL H2600 OFFSET MIDPOINT FIRST CH TO POS REF: X M H2600 OFFSET MIDPOINT FIRST CH TO SOURCE: X-Y=Z METER H2600 GRAVITYMETER DETAILS H2600 MFR: L&R (SENSOR AND FRAME) ZLS (ELECTRONICS), SN: S-99 H2600 SOFTWARE VERSION: 1.98 (FOGPACK GYROS) H2600 H2600 FILE FORMAT MODIFIED TO INCLUDE SHOTPOINT TIME IN COLUMNS [7..19] H2600 H2600 00011111111112222222222333333333344444444445555555555666666666677777777778 H2600 78901234567890123456789012345678901234567890123456789012345678901234567890 H2600 <--SP TIME--><-SP-><---LAT--><--LONG---><--EAST-><-NORTH-><-DEP>