diff --git a/oceanstream/L3_regridded_data/shoal_detection_handler.py b/oceanstream/L3_regridded_data/shoal_detection_handler.py index 3b0e806..d05dfe9 100644 --- a/oceanstream/L3_regridded_data/shoal_detection_handler.py +++ b/oceanstream/L3_regridded_data/shoal_detection_handler.py @@ -40,8 +40,8 @@ "thr": -70, "maxvgap": 5, "maxhgap": 5, - "minvlen": 0, - "minhlen": 0, + "minvlen": 5, + "minhlen": 5, "dask_chunking": {"ping_time": 1000, "range_sample": 1000}, } diff --git a/tests/test_applying_masks_handler.py b/tests/test_applying_masks_handler.py index a88d821..59f3829 100644 --- a/tests/test_applying_masks_handler.py +++ b/tests/test_applying_masks_handler.py @@ -61,6 +61,6 @@ def test_apply_mask_organisms_in_order(enriched_ek60_Sv): } ds_processed = apply_mask_organisms_in_order(ds_Sv_with_shoal_combined_mask, process_parameters) - assert np.nanmean(ds_processed["Sv"].values) == pytest.approx(-56.85248587691882, 0.0001) + assert np.nanmean(ds_processed["Sv"].values) == pytest.approx(-63.41369478688135, 0.0001) with pytest.raises(ValueError, match="Unexpected mask"): apply_selected_noise_masks_and_or_noise_removal(ds_processed, "invalid_parameters") diff --git a/tests/test_nasc_process.py b/tests/test_nasc_process.py index fd8a167..42eb6cd 100644 --- a/tests/test_nasc_process.py +++ b/tests/test_nasc_process.py @@ -2,7 +2,7 @@ from oceanstream.L3_regridded_data.csv_export_nasc import * -@pytest.mark.ignore +# @pytest.mark.ignore def test_compute_per_dataset_nasc(ek_60_Sv_full_denoised): dataset = ek_60_Sv_full_denoised nasc = base_nasc_data(dataset) @@ -12,15 +12,15 @@ def test_compute_per_dataset_nasc(ek_60_Sv_full_denoised): assert len(short_nasc) == 3 assert "fish_NASC_38000.0" in short_nasc -@pytest.mark.ignore +# @pytest.mark.ignore def test_compute_masked_nasc(ek_60_Sv_shoal): dataset = ek_60_Sv_shoal fish_nasc = mask_nasc_data(dataset, {"mask_shoal": False}, True, "fish_NASC") - assert fish_nasc['fish_NASC_38000.0'] == pytest.approx(130821359, 0.0001) + assert fish_nasc['fish_NASC_38000.0'] == pytest.approx(103252307.9526562, 0.0001) -@pytest.mark.ignore +# @pytest.mark.ignore def test_compute_full_nasc(ek_60_Sv_shoal): dataset = ek_60_Sv_shoal nasc = full_nasc_data(dataset, BASE_NASC_PARAMETERS) assert len(nasc) == 24 - assert nasc['fish_NASC_38000.0'] == pytest.approx(130821359, 0.0001) + assert nasc['fish_NASC_38000.0'] == pytest.approx(103252307.9526562, 0.0001) diff --git a/tests/test_shoal_detection_handler.py b/tests/test_shoal_detection_handler.py index 427c52d..4195e74 100644 --- a/tests/test_shoal_detection_handler.py +++ b/tests/test_shoal_detection_handler.py @@ -23,7 +23,7 @@ def shoal_masks(ek_60_Sv_denoised): @pytest.mark.ignore def test_create_shoal_mask_multichannel(ek_60_Sv_denoised): mask = create_shoal_mask_multichannel(ek_60_Sv_denoised) - assert _count_false_values(mask) == 4873071 + assert _count_false_values(mask) == 4471604 @pytest.mark.ignore @@ -33,5 +33,5 @@ def test_attach_shoal_mask_to_ds(ek_60_Sv_denoised): ds_Sv_shoal_combined, ds_Sv_shoal_combined["mask_shoal"] ) assert np.nanmean(ds_Sv_shoal_combined["Sv"].values) == pytest.approx( - -56.46381852479049, 0.0001 + -61.21094022368077, 0.0001 ) diff --git a/tests/test_shoal_process.py b/tests/test_shoal_process.py index ccacde0..fa53603 100644 --- a/tests/test_shoal_process.py +++ b/tests/test_shoal_process.py @@ -1,6 +1,4 @@ -from oceanstream.L3_regridded_data.shoal_detection_handler import attach_shoal_mask_to_ds, WEILL_DEFAULT_PARAMETERS -import pytest - +from oceanstream.L3_regridded_data.shoal_detection_handler import attach_shoal_mask_to_ds from oceanstream.L3_regridded_data.shoal_process import ( process_shoals, @@ -9,9 +7,17 @@ ) from oceanstream.utils import tfc -@pytest.mark.ignore +WEILL_DEFAULT_PARAMETERS = { + "thr": -55, + "maxvgap": 5, + "maxhgap": 5, + "minvlen": 5, + "minhlen": 5, + "dask_chunking": {"ping_time": 1000, "range_sample": 1000}, +} + +# @pytest.mark.ignore def prep_dataset(Sv): - # parameters = {"thr": -55, "maxvgap": -5, "maxhgap": 0, "minvlen": 5, "minhlen": 5} parameters = WEILL_DEFAULT_PARAMETERS shoal_dataset = attach_shoal_mask_to_ds(Sv, parameters=parameters, method="will") shoal_dataset["mask_shoal"][:, :, 0:25] = False @@ -20,34 +26,27 @@ def prep_dataset(Sv): shoal_dataset["mask_shoal"][:, 800:, :] = False return shoal_dataset -@pytest.mark.ignore +# @pytest.mark.ignore def test_split_shoal(ek_60_Sv_denoised): - expected_results = [ - (10362, 6104418), - (11155, 6103625), - (44, 6114736), - (21, 6114759), - (21, 6114759), - (20, 6114760), - ] + expected_results = [(13671, 6101109), (13465, 6101315), (30, 6114750)] shoal_dataset = prep_dataset(ek_60_Sv_denoised) res = split_shoal_mask(shoal_dataset) res_tfc = [tfc(r) for r in res] assert res_tfc == expected_results -@pytest.mark.ignore +# @pytest.mark.ignore def test_single_shoal(ek_60_Sv_denoised): shoal_dataset = prep_dataset(ek_60_Sv_denoised) mask = split_shoal_mask(shoal_dataset)[0] res = process_single_shoal(shoal_dataset, mask) assert len(res) == 3 assert len(res[0]) == 24 - assert res[0]["area"] == 4252 + assert res[0]["area"] == 6017 -@pytest.mark.ignore +# @pytest.mark.ignore def test_shoals(ek_60_Sv_denoised): shoal_dataset = prep_dataset(ek_60_Sv_denoised) res = process_shoals(shoal_dataset) none_res = [r for r in res if r is None] - assert len(res) == 10 + assert len(res) == 7 assert len(none_res) == 0