# Match geometry algorithm

The Match geometry operator allows you to resample Operand 1 to match the ping geometry of Operand 2. This virtual variable is useful to change resampled data back to its original ping geometry.

Ping geometry is read from the data file and includes:

- Ping start range
- Ping stop range
- Number of samples in the ping

The resampling is a weighted mean calculation.

**Notes:**

- The Match geometry operator can upsample or downsample. Ping times for Operand 1 and 2 must match. See also: Match ping times operator.
- Echoview offers various Resample operators with more resampling options.
- For data with units in dB, the weighted mean is calculated in the linear domain.

Figure 1: Illustration for Match geometry resampling. Representative pings, samples and sample start range and sample stop range are displayed.

### Illustration definitions

Ping geometry of pings in Operand 1

xN is the Nth sample of a ping in Operand 1. Sample xN start range in meters (rxN-1) and sample stop range in meters (rxN) are derived from the ping geometry of Operand 1.

v(xN) is the value of the Nth sample of a ping in Operand 1.

Ping geometry of pings in Operand 2

yM is the Mth sample of a matching ping in Operand 2. Sample yM start range in meters (ryM-1) and sample stop range in meters (ryM) are derived from the ping geometry of Operand 2.

Ping geometry of pings in Match geometry pings

sampleM is the Mth sample of the Match geometry ping. The ping geometry is the ping geometry of Operand 2.

v(sampleM) is the value of the Mth sample of the Match geometry ping.

Calculations for the value of an output sample consider the weighted mean contribution of samples in Operand 1 to the output sample with the ping geometry of Operand 2.

- Where an Operand 1 sample is completely within the boundaries of the output sample, the weighting for the Operand 1 sample is w = 1.
- Where an Operand 1 sample partially overlaps the output sample, the weighting for the Operand 1 sample is w.

- w is calculated as the part of the Operand 1 sample that overlaps the output sample divided by the Operand 1 sample thickness.

### Example calculation for the first sample of the output ping in the illustration

Operand 1 sample index xi |
Operand 1 sample weight wi |
Match geometry virtual variable |

x1 with v(x1) | w1 =1 | |

x2 with V(x2) | w1 =1 | |

x3 with v(x3) |