-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcross_correlation.py
44 lines (39 loc) · 1.73 KB
/
cross_correlation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python
"""Script to compute cross correlation between DSHIP data and LIMRAD94 data to check for possible time shift
input: DSHIP data
output: print to console of time shifts detected on given days and with used version
author: Johannes Roettenbacher
"""
import sys
sys.path.append('/projekt1/remsens/work/jroettenbacher/Base/larda')
sys.path.append('.')
import datetime as dt
import logging
import functions_jr as jr
log = logging.getLogger('jr')
log.setLevel(logging.INFO)
log.addHandler(logging.StreamHandler())
versions = [1, 2]
date = dt.datetime(2020, 2, 15, 0, 0, 0)
seapath = jr.read_seapath(date)
seapath = jr.calc_heave_rate(seapath)
for version in versions:
t_shift, shift, seapath = jr.calc_time_shift_limrad_seapath(seapath, version, plot_xcorr=True)
print(f"Time shift calculated from {date:%Y-%m-%d}: {t_shift:.4f} with version {version}.")
# 1.9362, 1.9363
date = dt.datetime(2020, 2, 16, 0, 0, 0)
seapath = jr.read_seapath(date)
seapath = jr.calc_heave_rate(seapath)
for version in versions:
t_shift, shift, seapath = jr.calc_time_shift_limrad_seapath(seapath, version)
print(f"Time shift calculated from {date:%Y-%m-%d}: {t_shift:.4f} with version {version}.")
# 1.9353, 1.9353
begin_dt = dt.datetime(2020, 1, 25, 6, 0, 5)
end_dt = dt.datetime(2020, 1, 25, 18, 0, 0)
seapath = jr.read_seapath(begin_dt)
seapath = jr.calc_heave_rate(seapath)
for version in versions:
t_shift, shift, seapath = jr.calc_time_shift_limrad_seapath(seapath, version, plot_xcorr=True,
begin_dt=begin_dt, end_dt=end_dt)
print(f"Time shift calculated from {begin_dt:%Y-%m-%d}: {t_shift:.4f} with version {version}.")
# 0, 1.671, depending on the time chosen