You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function calculate_area takes features, mask as argument. If mask is 3D (i.e. incl. time), calculate_area fails because internally calculates an area field (np.array) which is 2D. Both mask and area are provided to thescipy.ndimage function labeled_comprehension which however assumes that the 1st two arguments have the same shape. confict -> 2D != 3D
Here is part of the error
File [~/TROPOS/proj/2022-06-tobac-devel/tobac/tobac/analysis.py:960](https://file+.vscode-resource.vscode-cdn.net/home/senf/TROPOS/proj/2022-06-tobac-devel/tobac/examples/Basics/~/TROPOS/proj/2022-06-tobac-devel/tobac/tobac/analysis.py:960), incalculate_area(features, mask, method_area)
957else:
958raiseValueError("method undefined")
-->960feature_areas=labeled_comprehension(
961area, mask.data, features["feature"], np.sum, area.dtype, np.nan962 )
964features["area"] =feature_areas966returnfeaturesFile [~/TROPOS/proj/2022-06-tobac-devel/tobac-env-py38/lib/python3.8/site-packages/scipy/ndimage/_measurements.py:511](https://file+.vscode-resource.vscode-cdn.net/home/senf/TROPOS/proj/2022-06-tobac-devel/tobac/examples/Basics/~/TROPOS/proj/2022-06-tobac-devel/tobac-env-py38/lib/python3.8/site-packages/scipy/ndimage/_measurements.py:511), inlabeled_comprehension(input, labels, index, func, out_dtype, default, pass_positions)
509input, labels=numpy.broadcast_arrays(input, labels)
510exceptValueErrorase:
-->511raiseValueError("input and labels must have the same shape "512"(excepting dimensions with width 1)") frome514ifindexisNone:
515ifnotpass_positions:
ValueError: inputandlabelsmusthavethesameshape (exceptingdimensionswithwidth1)
A solution would be to care in the calculations that areahas always the same shape as mask.
As calculate_area is not included in the testing I guess it is not really used by the group, right?
The text was updated successfully, but these errors were encountered:
fsenf
added
the
bug
Code that is failing or producing the wrong result
label
Sep 8, 2023
Footprint area of 3D segments is now resolved by #378 . It may be useful to add a function to calculate volume of 3D objects in future, but I will close this for now
The function
calculate_area
takesfeatures, mask
as argument. If mask is 3D (i.e. incl. time),calculate_area
fails because internally calculates an area field (np.array
) which is 2D. Bothmask
andarea
are provided to thescipy.ndimage
functionlabeled_comprehension
which however assumes that the 1st two arguments have the same shape. confict -> 2D != 3DHere is part of the error
A solution would be to care in the calculations that
area
has always the same shape asmask
.As
calculate_area
is not included in the testing I guess it is not really used by the group, right?The text was updated successfully, but these errors were encountered: