find_intersections

metpy.calc.find_intersections(x, a, b, direction='all', log_x=False)[source]

Calculate the best estimate of intersection.

Calculates the best estimates of the intersection of two y-value data sets that share a common x-value set.

Parameters
  • x (array-like) – 1-dimensional array of numeric x-values

  • a (array-like) – 1-dimensional array of y-values for line 1

  • b (array-like) – 1-dimensional array of y-values for line 2

  • direction (string, optional) – specifies direction of crossing. ‘all’, ‘increasing’ (a becoming greater than b), or ‘decreasing’ (b becoming greater than a). Defaults to ‘all’.

  • log_x (bool, optional) – Use logarithmic interpolation along the x axis (i.e. for finding intersections in pressure coordinates). Default is False.

Returns

  • A tuple (x, y) of array-like with the x and y coordinates of the

  • intersections of the lines.

Notes

This function implicity converts xarray.DataArray to pint.Quantity, with the results given as pint.Quantity.