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

Bin mapping #98

Open jessecusack opened 2 years ago

jessecusack commented 2 years ago

Thank you for developing a nice package! I am trying to process a TRDI workhorse that pitched 10 - 15 degrees and needs bin mapping prior to coordinate rotations. Correct me if I am wrong, but it doesn't seem like you have bin mapping functionality in here? If I were to attempt to add this, where would be the appropriate place?

jmcvey3 commented 2 years ago

@jessecusack Thank you! You are correct, we have not tried to tackle bin mapping. I appreciate you wanting to attempt this; it would fall under the 'ADP' api, so would be added as a new file in the dolfyn/adp directory.

apaloczy commented 1 year ago

Just found this issue. Thank you for developing DOLfYN!

@jessecusack, @jmcvey3, I started implementing bin-mapping following Dewey & Stringer (2007)'s Equation B1 here a while ago. It could use more testing, but some sanity checks with simple synthetic velocity fields and different pitch/roll angles seem to give qualitatively correct results. Do you think this function might be useful as a starting point?

lkilcher commented 1 year ago

Let's get a PR for this ASAP!

jessecusack commented 1 year ago

I ended up implementing bin mapping in a different package, the code is here:

https://github.com/modscripps/velosearaptor/blob/9c70a0b9ab376ca14a416d4e5fae07340b65a0b0/velosearaptor/madcp.py#L897

One advantage of the linear interpolation method I use in the above is that it is vectorized and therefore quite fast. A downside is that it creates a rather large arrays that hog RAM.

I guess parts of this or @apaloczy's package could be copied into dolfyn relatively easily, but I don't have time to figure it myself.

jmcvey3 commented 1 year ago

Thanks @jessecusack. The MODScripps code is implemented in TRDI's coordinate system, correct?

The copying in should be easy, yes; testing and making sure the coordinate systems are correct would be the hard part.

jessecusack commented 1 year ago

Yes it does use the TRDI coordinate system.