modscripps / velosearaptor

python ADCP routines
https://modscripps.github.io/velosearaptor
GNU General Public License v3.0
8 stars 3 forks source link

3 beam solution #18

Open jessecusack opened 2 years ago

jessecusack commented 2 years ago

Sometimes one of my ADCP beams is hitting ice and needs to be excluded from the solution. This amounts to recalculating xyze.

To redo this we need to extract the following code from pycurrents for our own purpose:

            trans = Transform(angle=ppd.sysconfig.angle,
                              geometry=geom)
            if beam_index:
                ppd.vel[:] = ppd.vel[..., beam_index]
                ppd.amp[:] = ppd.amp[..., beam_index]
                ppd.cor[:] = ppd.cor[..., beam_index]
            xyze = trans.beam_to_xyz(ppd.vel, ibad=ibad)
            ppd.xyze = xyze

Line 1756 in rdiraw.py

It looks like bad beams can be specified! Unfortunately, there is no documentation on what ibad should look like...

I'll get to this after #17 is merged.

gunnarvoet commented 2 years ago

You can pass ibad (zero-based so beam 0 to 3) to Multiread(): https://github.com/gunnarvoet/gadcp/blob/6b49608b0935ef3b88d1b14b8a3c66cb57752999/gadcp/madcp.py#L301

jessecusack commented 2 years ago

That seems convenient. Do you know if ibad can be an array? i.e. the beam to exclude can vary with each ping?

The documentation implies it is just a single int.

gunnarvoet commented 2 years ago

Yeah, I don't think so.

jessecusack commented 2 years ago

Ok, that is less convenient. I think I'll have to do it by manually editing the vel array then. It should be as simple as replacing the bad beam data with its opposite beam.