Skip to content

Commit c06fe82

Browse files
committed
merge in matrix test fix
2 parents 3bd7afa + 3609a59 commit c06fe82

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

.github/workflows/matrix_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
python-version: ["3.8", "3.9", "3.10", "3.11"]
23+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2424
os: [macos, ubuntu, windows]
2525

2626
steps:

tobac/tests/test_segmentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,8 @@ def test_segmentation_multiple_features():
630630
out_seg_mask_arr = out_seg_mask.core_data()
631631

632632
# assure that the number of grid cells belonging to each feature (ncells) are consistent with segmentation mask
633-
assert int(out_df[out_df.feature == 1].ncells.values) == size_feature1
634-
assert int(out_df[out_df.feature == 2].ncells.values) == size_feature2
633+
assert int(out_df[out_df.feature == 1].ncells.values[0]) == size_feature1
634+
assert int(out_df[out_df.feature == 2].ncells.values[0]) == size_feature2
635635
# assure that bulk statistic columns are created in output (one column added after segmentation)
636636
assert out_df.columns.size - fd_output.columns.size > 1
637637
# assure that statistics are calculated everywhere where an area for ncells is found

tobac/tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def test_transform_feature_points_3D():
559559
5, 105, 20, max_h1=1000, max_h2=1000
560560
)
561561

562-
orig_feat_df = tb_utils.combine_tobac_feats([orig_feat_df_1, orig_feat_df_2])
562+
orig_feat_df = tb_utils.combine_feature_dataframes([orig_feat_df_1, orig_feat_df_2])
563563

564564
orig_feat_df["latitude"] = orig_feat_df["hdim_1"]
565565
orig_feat_df["longitude"] = orig_feat_df["hdim_2"]

tobac/utils/general.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,6 @@ def transform_feature_points(
714714
the new grid, suitable for use in segmentation
715715
716716
"""
717-
from .. import analysis as tb_analysis
718717

719718
RADIUS_EARTH_M = 6371000
720719
is_3D = "vdim" in features
@@ -812,14 +811,12 @@ def transform_feature_points(
812811
)
813812

814813
if warn_dropped_features:
815-
returned_features = ret_features["feature"]
816-
all_features = features["feature"]
817-
removed_features = np.delete(
818-
all_features, np.where(np.any(all_features == returned_features))
819-
)
820-
warnings.warn(
821-
"Dropping feature numbers: " + str(removed_features.values), UserWarning
822-
)
814+
removed_features = np.setdiff1d(features["feature"], ret_features["feature"])
815+
if len(removed_features):
816+
warnings.warn(
817+
"Dropping feature numbers: " + str(removed_features.tolist()),
818+
UserWarning,
819+
)
823820

824821
# make sure that feature points are converted back to int64
825822
ret_features["feature"] = ret_features.feature.astype(int)

0 commit comments

Comments
 (0)