#! /usr/bin/env python # -*- coding: cp1252 -*- ''' *************************************************************************************** S V A L E X - 2 0 0 7 S U R V E Y U K O O A F I L E G E N E R A T I O N DESCRIPTION: Script applies an offset to easting, northing to adjust for distance between seismic source and position reference point. Then UKOOA and plot files are generated. INPUT PARAMETERS: No. 1: Input file Data column description: See extraction in first section. No. 2: UTM Zone No. 3: Line name No. 4: Offset distance OUTPUT FILES: Will be placed in same directory as input file. UKOOA HEADER, UTM ZONE, OFFSET DISTANCE See 'Constant' section below. The UKOOA automatically includes values from other constants. 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: 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.1 29 Aug 2007 O. Meyer Initial version ---------------------------------------------------------------------------------- Dept. of Earth Science University of Bergen N O R W A Y *************************************************************************************** ''' import LatLongUTMconversion from string import split from os.path import join from datetime import datetime, timedelta from time import strptime, strftime, gmtime from cmath import * from sys import * #---- First check number of command line parameters if len(argv[0:]) <> 5: # One more that actual number, as name of script is in argv[0] print"Error: Need arguments: Navdata file, UTM Zone, Line Name, Source" exit(1) #---- Get command line parameters: # No. 1: Input file # Data column description: See extraction in first section. # No. 2: UTM Zone # No. 3: Line name # No. 4: Offset distance DATA_FILE = argv[1] UTM_Zone = argv[2] LINE_NAME = argv[3] SOURCE_OFFSET = argv[4] #----- Directory, file names DATA_DIRECTORY = './VAN_MIJEN_FJORD/EIVA' #DATA_FILE = 'SvalexVMF-07-01' UKOOA_FILE = DATA_FILE + '.UKOOA.txt' PLOT_FILE = DATA_FILE + '.plot.txt' #----- Constants #LINE_NAME = 'VM-01' # Max 5 characters #UTM_Zone = '33X' WGS84 = 23 # Datum constant, see LatLongUTMconversion file. #SOURCE_OFFSET = 57.0 # Offset shotpoint positions by this amount. FIRST_SP = 1 LAST_SP = 1086 CR_LF = '\x0d\x0a' UKOOA_Header = \ '''H0100 SURVEY AREA VAN MIJEN FJORD, SVALBARD, NORWAY H0101 SURVEY DETAILS SVALEX-2007 H0102 VESSEL DETAILS R.V. HAAKON MOSBY H0200 SURVEY DATE AUGUST 2007 H0201 FILE CREATED %s H0202 FILE VERSION UKOOA P1/1990 H0300 CLIENT SVALEX-2007 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 SEAPATH 200 (PRIM), TRIMBLE 200D (SEC) H0800 SHOTPOINT POSITION CENTRE 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 AS SURVEYED WGS-84 H1500 GEODETIC DATUM AS PLOTTED WGS-84 H1700 VERTICAL DATUM SL : ECHO SOUNDER H1800 PROJECTION 001 UTM NORTHERN HEMISPHERE H1900 ZONE %s NORTHERN HEMISPHERE H2000 GRID UNIT 1 METRE H2001 HEIGHT UNIT 1 METRE H2002 ANGULAR UNITS 1 DEGREES H2600 SOURCE 6 AIRGUNS, PRESSURE 138 BAR H2600 H2600 00011111111112222222222333333333344444444445555555555666666666677777777778 H2600 78901234567890123456789012345678901234567890123456789012345678901234567890 H2600 <-SP-><---LAT--><--LONG---><--EAST-><-NORTH-><-DEP>