tobac.analysis.feature_analysis.calculate_area#
- tobac.analysis.feature_analysis.calculate_area(features, mask, method_area=None, vertical_coord=None)#
Calculate the area of the segments for each feature.
- Parameters:
features (pandas.DataFrame) – DataFrame of the features whose area is to be calculated.
mask (iris.cube.Cube) – Cube containing mask (int for tracked volumes 0 everywhere else). Needs to contain either projection_x_coordinate and projection_y_coordinate or latitude and longitude coordinates.
method_area ({None, 'xy', 'latlon'}, optional) – Flag determining how the area is calculated. ‘xy’ uses the areas of the individual pixels, ‘latlon’ uses the area_weights method of iris.analysis.cartography, None checks wether the required coordinates are present and starts with ‘xy’. Default is None.
vertical_coord (None | str, optional (default: None)) – Name of the vertical coordinate. If None, tries to auto-detect. It looks for the coordinate or the dimension name corresponding to the string.
- Returns:
features – DataFrame of the features with a new column ‘area’, containing the calculated areas.
- Return type:
pandas.DataFrame
- Raises:
ValueError – If neither latitude/longitude nor projection_x_coordinate/projection_y_coordinate are present in mask_coords. If latitude/longitude coordinates are 2D. If latitude/longitude shapes are not supported. If method is undefined, i.e. method is neither None, ‘xy’ nor ‘latlon’.