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

Fix warnings #161

Merged
merged 1 commit into from
Jan 31, 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
4 changes: 3 additions & 1 deletion oceanstream/denoise/apply_masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ def apply_seabed_mask(ds: xr.Dataset, config) -> xr.Dataset:

ds_processed = apply_selected_masks(ds, params)

return ds_processed
return ds_processed

return ds
4 changes: 2 additions & 2 deletions oceanstream/denoise/background_noise_remover.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Functions:

- `apply_remove_background_noise`:
Main function that applies the `remove_noise` function from echopype to an Sv dataset.
Main function that applies the `remove_noise` function from echopype to a Sv dataset.
Computes default parameters based on dataset characteristics when not provided.
The dataset initially passed to the function, processed in the following manner:
`Sv_corrected` and `Sv_noise` variables are generated by the echopype `remove_noise` function.
Expand Down Expand Up @@ -76,7 +76,7 @@ def apply_remove_background_noise(
# Compute range_sample_num if not provided
if range_sample_num is None:
range_sample_nums = []
for ch in range(ds_Sv.dims["channel"]):
for ch in range(ds_Sv.sizes["channel"]):
mean_diff = np.nanmean(np.diff(ds_Sv["echo_range"].isel(channel=ch).values[0, :]))
if np.isnan(mean_diff):
raise ValueError(
Expand Down
6 changes: 5 additions & 1 deletion oceanstream/settings/defaults.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
"m": null,
"thr": -5,
"start": 0,
"offset": 0
"offset": 0,
"dask_chunking": {
"ping_time": 100,
"range_sample": 100
}
}
},
"transient": {
Expand Down
12 changes: 9 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,15 @@ def denoise_dataset(dataset):
@pytest.fixture(scope="session")
def ftp_data():
test_data_folder = Path(TEST_DATA_FOLDER) / "ek60"
# with FTP(FTP_MAIN) as ftp:
# ftp.login()
# download_ftp_directory(ftp, FTP_PARTIAL_PATH, test_data_folder)

# if there is data in here skip downloading...
must_download = not os.path.exists(test_data_folder) or not os.listdir(test_data_folder)

if must_download:
with FTP(FTP_MAIN) as ftp:
ftp.login()
download_ftp_directory(ftp, FTP_PARTIAL_PATH, test_data_folder)

yield str(test_data_folder)
# Optional: Cleanup after tests are done
# shutil.rmtree(TEST_DATA_FOLDER)
Expand Down
3 changes: 3 additions & 0 deletions tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
markers =
ignore: marks a test as ignored.
Loading