lkilcher / dolfyn

A library for oceanographic doppler instruments such as Acoustic Doppler Profilers (ADPs, ADCPs) and Acoustic Doppler Velocimeters (ADVs).
BSD 3-Clause "New" or "Revised" License
41 stars 25 forks source link

TRDI RioGrande Bottom Track Reference #121

Closed cresposito closed 7 months ago

cresposito commented 12 months ago

Hello. I am reading data from a TRDI RioGrande 600 Hz.

The (horizontal) velocity magnitude that I am seeing appears to be the same as what WinRiver II displays as using a reference of "None", rather than "Bottom Track".

See a screenshot of WinRiver II output below, as well as velocity commputed with dolfyn. What I would like to get is the third image, showing velocity in WinRiver II using the bottom track reference.

Changing the coordinate system between Earth and Instrument does not seem to fix this (nor should it, I think).

Is there a way to do this that I am missing? The code that I am running is below.

import dolfyn import numpy as np from dolfyn.adp import api from matplotlib import pyplot as plt import matplotlib.dates as dt

read adcp data

ds=dolfyn.read(myADCPFile.PD0)

rotate to earth coordinates

dolfyn.set_declination(ds, 4) # 4 degrees East dolfyn.rotate2(ds, 'Earth')

define time vector and velocity magnitude array

t = dolfyn.time.dt642date(ds.time) velMagHoriz=np.linalg.norm(ds.vel[:2,:,:],axis=0)

plot the data

ax = plt.figure(figsize=(12,8)).add_axes([.14, .14, .8, .74]) plt.pcolormesh(t, ds['range'], velMagHoriz, cmap='Blues', shading='nearest')

ax.plot(t, ds.dist_bt.mean(dim=["beam"]))

ax.set_xlabel('Time') ax.xaxis.set_major_formatter(dt.DateFormatter('%H:%M')) ax.set_ylabel('Altitude [m]') ax.set_ylim([12, 0])

plt.clim(0,2) plt.colorbar(label='Horizontal Vel [m/s]')

image image image
jmcvey3 commented 11 months ago

Hi @cresposito,

Yes, this is expected behavior. Dolfyn reads in whatever data is stored in the datafile - WinRiver (and VMDAS and Nortek's software as well) don't save corrected velocity in the binary datafile itself (though they will if exported to csv or matlab).

Bottom track can be easily removed in our case by running ds['vel'] - ds['vel_bt']. You could also try subtracting out the gps-measured velocity instead, if there are issues with BT.

It also looks like WinRiver is applying a "depth below surface" that the instrument is located. You can set that using dolfyn.adp.clean.set_range_offset(dataset, height_offset).