-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests in test_applying_masks_handler and test_nasc_computation
- Loading branch information
1 parent
73292e4
commit 88ad2fd
Showing
2 changed files
with
4 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,16 @@ | ||
import pytest | ||
|
||
from oceanstream.L2_calibrated_data import sv_interpolation | ||
from oceanstream.L2_calibrated_data.noise_masks import create_default_noise_masks_oceanstream | ||
from oceanstream.L3_regridded_data import applying_masks_handler, nasc_computation | ||
from oceanstream.L3_regridded_data import nasc_computation | ||
|
||
|
||
def test_compute_per_dataset_nasc(enriched_ek60_Sv): | ||
enriched_Sv = enriched_ek60_Sv | ||
Sv_with_masks = create_default_noise_masks_oceanstream(enriched_Sv) | ||
|
||
process_parameters = { | ||
"mask_transient": { | ||
"var_name": "Sv", | ||
}, | ||
"mask_impulse": { | ||
"var_name": "Sv", | ||
}, | ||
"mask_attenuation": { | ||
"var_name": "Sv", | ||
}, | ||
} | ||
cleaned_ds = applying_masks_handler.apply_selected_noise_masks_and_or_noise_removal( | ||
Sv_with_masks, | ||
process_parameters, | ||
) | ||
interpolated_ds = sv_interpolation.interpolate_sv(cleaned_ds) | ||
interpolated_ds = interpolated_ds.rename({"Sv": "Sv_denoised", "Sv_interpolated": "Sv"}) | ||
process_parameters = { | ||
"remove_background_noise": { | ||
"ping_num": 40, | ||
"range_sample_num": 10, | ||
"noise_max": -125, | ||
"SNR_threshold": 3, | ||
}, | ||
} | ||
interpolated_ds = applying_masks_handler.apply_selected_noise_masks_and_or_noise_removal( | ||
interpolated_ds, process_parameters | ||
) | ||
|
||
nasc_os = nasc_computation.compute_per_dataset_nasc(interpolated_ds) | ||
nasc_os = nasc_computation.compute_per_dataset_nasc(enriched_ek60_Sv) | ||
|
||
val = ( | ||
nasc_os["NASC_dataset"]["NASC"] | ||
.sel(channel="GPT 18 kHz 009072058c8d 1-1 ES18-11") | ||
.values[0][0] | ||
) | ||
assert val == pytest.approx(31774234.87447954, 0.0001) | ||
assert val == pytest.approx(25554438.181145363, 0.0001) | ||
assert nasc_os["maximum_depth"][0:3] == "199" | ||
assert nasc_os["maximum_distance"][0:3] == "3.2" |