Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix testing fix #451

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/matrix_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [macos, ubuntu, windows]

steps:
Expand Down
4 changes: 2 additions & 2 deletions tobac/tests/test_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,8 @@ def test_segmentation_multiple_features():
out_seg_mask_arr = out_seg_mask.core_data()

# assure that the number of grid cells belonging to each feature (ncells) are consistent with segmentation mask
assert int(out_df[out_df.feature == 1].ncells.values) == size_feature1
assert int(out_df[out_df.feature == 2].ncells.values) == size_feature2
assert int(out_df[out_df.feature == 1].ncells.values[0]) == size_feature1
assert int(out_df[out_df.feature == 2].ncells.values[0]) == size_feature2
# assure that bulk statistic columns are created in output (one column added after segmentation)
assert out_df.columns.size - fd_output.columns.size > 1
# assure that statistics are calculated everywhere where an area for ncells is found
Expand Down
2 changes: 1 addition & 1 deletion tobac/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def test_transform_feature_points_3D():
5, 105, 20, max_h1=1000, max_h2=1000
)

orig_feat_df = tb_utils.combine_tobac_feats([orig_feat_df_1, orig_feat_df_2])
orig_feat_df = tb_utils.combine_feature_dataframes([orig_feat_df_1, orig_feat_df_2])

orig_feat_df["latitude"] = orig_feat_df["hdim_1"]
orig_feat_df["longitude"] = orig_feat_df["hdim_2"]
Expand Down
15 changes: 6 additions & 9 deletions tobac/utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,6 @@ def transform_feature_points(
the new grid, suitable for use in segmentation

"""
from .. import analysis as tb_analysis

RADIUS_EARTH_M = 6371000
is_3D = "vdim" in features
Expand Down Expand Up @@ -812,14 +811,12 @@ def transform_feature_points(
)

if warn_dropped_features:
returned_features = ret_features["feature"]
all_features = features["feature"]
removed_features = np.delete(
all_features, np.where(np.any(all_features == returned_features))
)
warnings.warn(
"Dropping feature numbers: " + str(removed_features.values), UserWarning
)
removed_features = np.setdiff1d(features["feature"], ret_features["feature"])
if len(removed_features):
warnings.warn(
"Dropping feature numbers: " + str(removed_features.tolist()),
UserWarning,
)

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