swirlspy.object package

Object identification methods.

swirlspy.object.fit_ellipse(da, ext=1, coord_label=['x', 'y'])

Get minimum enclosing ellipse and rectangle of storm.

Parameters
  • da (xarray.DataArray) – Contains the binary mask representing a single storm.

  • ext (scalar) – The relationship between the semi-major/semi-minor axis of the ellipse and the width and height of rectangle.

  • coord_label (list of str, optional) – The x and y coordinate labels respectively. Defaults to [‘x’, ‘y’].

Returns

  • ellipse (dict) – Contains ellipse attributes. ‘center’, ‘a’ (semi-major axis), ‘b’ (semi-minor-axis), and ‘angle’ (counterclockwise from vertical).

  • box (numpy.ndarray, shape (n,2)) – Contains coordinates of the vertices of the rectangle enclosing storm.

swirlspy.object.get_ellipse_mask(da, ellipse, coord_label=['x', 'y'])
Parameters
  • da (xarray.DataArray) – An xarray.DataArray with all values being zero.

  • ellipse (dict) – Contains ellipse information.

  • coord_label (list of str, optional) – The x and y coordinate labels respectively. Defaults to [‘x’, ‘y’].

Returns

ellipse_da – The elliptical mask.

Return type

xarray.DataArray

swirlspy.object.get_labeled_frame(da, thresh, min_size=20000000.0, coord_label=['x', 'y'])

Returns a labeled frame from a xarray.DataArray. Smaller objects are removed and the rest are labeled.

Parameters
  • da (xarray.DataArray) – Contains data to be separated into objects and labelled.

  • thresh (scalar) – The threshold to be applied to data.

  • min_size (scalar) – The minimum size allowed for an object, expressed in terms of the coordinates of the DataArray Defaults to 2e7(m^2).

  • coord_label (list of str.) – The x and y coordinate labels respectively. Defaults to [‘x’, ‘y’].

Returns

  • label_da = xarray.DataArray – Contains labelled objects.

  • uids (list of int) – The labels of the objects.