ogs5py.tools.tools.unique_rows

ogs5py.tools.tools.unique_rows(data, decimals=4, fast=True)[source]

Unique made row-data with respect to given precision.

this is constructed to work best if point-pairs appear. The output is sorted like the input data. data needs to be 2D

Parameters
  • data (ndarray) – 2D array containing the list of vectors that should be made unique

  • decimals (int, optional) – Number of decimal places to round the ‘data’ to (default: 3). If decimals is negative, it specifies the number of positions to the left of the decimal point. This will not round the output, it is just for comparison of the vectors.

  • fast (bool, optional) – If fast is True, the vector comparison is executed by a decimal comparison. If fast is False, all pairwise distances are calculated. Default: True

Returns

  • result (ndarray) – 2D array of unique rows of data

  • ix (ndarray) – index positions of output in input data (data[ix] = result) len(ix) = result.shape[0]

  • ixr (ndarray) – reversed index positions of input in output data (result[ixr] = data) len(ixr) = data.shape[0]

Notes

This routine will preserve the order within the given array as effectively as possible. If you use it with a stack of 2 arrays and the first one is already unique, the resulting array will still have the first array at the beginning.