Tide compensation#
Compensate varying tidal elevations that might occur during seismo-acoustic surveys.
Description#
The tidal elevation (and thus deviation from the mean sea level) is predicted using the tidal constituents based on the TPXO9-atlas models provided by Gary Egbert & Svetlana Erofeeva from the Oregon State University (available on request for academic purposes).
To derive an individual tidal elevation for each shotpoint (and time) the Python package tpxo-tide-prediction
is utilized that allows to compute the required tidal information for each shotpoint (i.e. timestamp) of a seismo-acoustic profile.
For more information refer to the GitHub project page.
Usage#
This script is designed to be used from the terminal (i.e. command line).
Command line interface#
The script can handle three different inputs:
- single SEG-Y file (e.g.,
filename.sgy
) - datalist of files to process (e.g.,
datalist.txt
) - directory with input files (e.g.,
/input_dir
)
Additionally, the directory path of the tidal constituent netCDF files (provided from OSU) is required (model_dir
).
There are two options to run the script. We recommend using the CLI entry point like:
Alternatively, the script can be executed using the (more verbose) command:
>>> python -m pseudo_3D_interpolation.tide_compensation_segy {filename.sgy | datalist.txt | </directory>} [optional parameters]
Optionally, the following parameters can be specified:
--help
,-h
: Show help.--output_dir {DIR}
: Output directory (either--inplace
or--output_dir
are required!).--inplace
: Replace input data without creating copy (either--inplace
or--output_dir
are required!).--suffix {sgy}
: File suffix (default:sgy
). Only used if directory is specified.--filename_suffix {SUFFIX}
: Filename suffix (e.g.pad
,static
) to filter input files. Only used if directory is specified.--txt_suffix {despk}
: Suffix to append to output filename (default:despk
).--constituents
,-c
: Available tidal constituents supported by TPXO9 atlas model.- defaults: M2, S2, K1, O1, N2, P1, K2, Q1,
- 2N2, K2, M4, MF, MM, MN4, MS4,
- S1 (only v5)
--correct_minor
: Correct for minor tidal constituents.--src_coords
: Byte position of input coordinates in SEG-Y file(s).source
(default)CDP
group
--crs_src
: Source CRS of SEG-Y file(s). Indicate using EPSG code or PROJ.4 string.- default: EPSG:32760 (WGS 84 / UTM zone 60S)
--write_aux
: Write times and tide predictions to auxiliary file (*.tid
).--verbose {LEVEL}
,-V
: Level of output verbosity (default:0
).
Python script#
Additionally, it is possible to just import the essential functions read_parameter_file
, tide_predict
, and write_tides
when using these methods in a custom script:
Import package#
Read input parameter from file#
# (A) read inputs from parameter file
lat, lon, times = read_parameter_file('path/to/parameter/file.txt')
# (B) read only `time` from parameter file and provide fixed location
lat = -36.446349
lon = 175.166068
lat, lon, times = read_parameter_file('path/to/parameter/file', lat, lon)
Compute tidal elevation#
# lat, lon: int, float, np.ndarray
# times: str, np.ndarray(dtype='datetime64[s]')
# (A) default configuration
tide = tide_predict('path/to/TPXO9-atlas-model', lat, lon, times)
# (B) custom configuration (less constituents, no correction of minor constituents)
tide = tide_predict('path/to/TPXO9-atlas-model', lat, lon, times,
constituents=['m2','s2','n2','k2'], correct_minor=False)
Write computed tides to formatted output file#
# (A) custom output file
# full output (tide at every time at every location)
write_tides('path/to/output/file.tide', tide, mode='full')
# or `track` output (lat-lon-time triplets)
write_tides('path/to/output/file.tide', tide, mode='track')
# (B) create output file from parameter file
basepath, filename = os.path.split('path/to/parameter/file.txt')
basename, suffix = os.path.splitext(filename)
write_tides(basepath, basename, tide, mode='full')