Skip to content

Commit 8ed2c7d

Browse files
authored
Merge pull request #1229 from OSOceanAcoustics/dev
Release/v0.8.2
2 parents 5b96ff4 + 7679b96 commit 8ed2c7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4108
-3874
lines changed

.ci_helpers/run-test.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,24 @@
118118
for k, v in test_to_run.items():
119119
print(f"=== RUNNING {k.upper()} TESTS===")
120120
print(f"Touched files: {','.join([os.path.basename(p) for p in v])}")
121-
if k == "root":
122-
file_glob_str = "echopype/tests/test_*.py"
123-
cov_mod_arg = ["--cov=echopype"]
121+
# Run specific test files
122+
# The input files must all starts with "test" in their name
123+
# otherwise module globbing for specific test files will
124+
# be used
125+
if all(f.name.startswith("test") for f in v):
126+
# For specific test files
127+
test_files = [str(p) for p in v]
124128
else:
125-
file_glob_str = f"echopype/tests/{k}/*.py"
126-
cov_mod_arg = [f"--cov=echopype/{k}"]
127-
if args.include_cov:
128-
pytest_args = original_pytest_args + cov_mod_arg
129-
test_files = glob.glob(file_glob_str)
129+
# Run all tests in a module
130+
if k == "root":
131+
file_glob_str = "echopype/tests/test_*.py"
132+
cov_mod_arg = ["--cov=echopype"]
133+
else:
134+
file_glob_str = f"echopype/tests/{k}/*.py"
135+
cov_mod_arg = [f"--cov=echopype/{k}"]
136+
if args.include_cov:
137+
pytest_args = original_pytest_args + cov_mod_arg
138+
test_files = glob.glob(file_glob_str)
130139
final_args = pytest_args + test_files
131140
print(f"Pytest args: {final_args}")
132141
exit_code = pytest.main(final_args)

.github/workflows/build.yaml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,20 @@ on:
99
workflow_dispatch:
1010

1111
env:
12-
CONDA_ENV: echopype
1312
NUM_WORKERS: 2
1413

1514
jobs:
1615
test:
1716
name: ${{ matrix.python-version }}-build
18-
runs-on: ubuntu-20.04
17+
runs-on: ubuntu-latest
1918
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
2019
continue-on-error: ${{ matrix.experimental }}
2120
strategy:
2221
fail-fast: false
2322
matrix:
24-
python-version: ["3.9", "3.10"] # TODO: add back 3.11 once parsed2zarr is fixed
23+
python-version: ["3.9", "3.10", "3.11"]
2524
runs-on: [ubuntu-latest]
2625
experimental: [false]
27-
include:
28-
- runs-on: ubuntu-latest
29-
python-version: "3.11"
30-
experimental: true
3126
services:
3227
# TODO: figure out how to update tag when there's a new one
3328
minio:
@@ -46,30 +41,20 @@ jobs:
4641
- name: Set environment variables
4742
run: |
4843
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
49-
- name: Setup micromamba
50-
uses: mamba-org/setup-micromamba@v1
44+
- name: Set up Python
45+
uses: actions/setup-[email protected]
5146
with:
52-
environment-file: .ci_helpers/py${{ matrix.python-version }}.yaml
53-
environment-name: ${{ env.CONDA_ENV }}
54-
cache-environment: true
55-
post-cleanup: 'all'
56-
- name: Print conda environment
57-
shell: bash -l {0}
58-
run: |
59-
micromamba info
60-
micromamba list
47+
python-version: ${{ matrix.python-version }}
48+
- name: Upgrade pip
49+
run: python -m pip install --upgrade pip
6150
- name: Remove docker-compose python
62-
if: ${{ matrix.python-version == '3.10' || matrix.python-version == '3.11' }}
63-
shell: bash -l {0}
6451
run: sed -i "/docker-compose/d" requirements-dev.txt
6552
- name: Install dev tools
66-
shell: bash -l {0}
67-
run: |
68-
micromamba install -c conda-forge -n ${{ env.CONDA_ENV }} --yes --file requirements-dev.txt
53+
run: python -m pip install -r requirements-dev.txt
6954
- name: Install echopype
70-
shell: bash -l {0}
71-
run: |
72-
python -m pip install -e .[plot]
55+
run: python -m pip install -e ".[plot]"
56+
- name: Print installed packages
57+
run: python -m pip list
7358
- name: Copying test data to services
7459
shell: bash -l {0}
7560
run: |

.github/workflows/pr.yaml

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
paths-ignore: ["**/docker.yaml", "docs"]
66

77
env:
8-
CONDA_ENV: echopype
98
NUM_WORKERS: 2
109

1110
jobs:
@@ -17,16 +16,9 @@ jobs:
1716
strategy:
1817
fail-fast: false
1918
matrix:
20-
python-version: ["3.9", "3.10"] # TODO: add back 3.11 once parsed2zarr is fixed
19+
python-version: ["3.9", "3.10", "3.11"]
2120
runs-on: [ubuntu-latest]
2221
experimental: [false]
23-
include:
24-
- runs-on: ubuntu-latest
25-
python-version: "3.11"
26-
experimental: true
27-
defaults:
28-
run:
29-
shell: bash -l {0}
3022
services:
3123
# TODO: figure out how to update tag when there's a new one
3224
minio:
@@ -42,35 +34,28 @@ jobs:
4234
uses: actions/checkout@v4
4335
with:
4436
fetch-depth: 0 # Fetch all history for all branches and tags.
37+
- name: Set up Python
38+
uses: actions/[email protected]
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
- name: Upgrade pip
42+
run: python -m pip install --upgrade pip
4543
- name: Set environment variables
4644
run: |
4745
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
48-
- name: Setup micromamba
49-
uses: mamba-org/setup-micromamba@v1
50-
with:
51-
environment-file: .ci_helpers/py${{ matrix.python-version }}.yaml
52-
environment-name: ${{ env.CONDA_ENV }}
53-
cache-environment: true
54-
post-cleanup: 'all'
55-
- name: Print conda environment
56-
run: |
57-
micromamba info
58-
micromamba list
5946
- name: Remove docker-compose python
60-
if: ${{ matrix.python-version == '3.10' || matrix.python-version == '3.11' }}
6147
run: sed -i "/docker-compose/d" requirements-dev.txt
6248
- name: Install dev tools
63-
run: |
64-
micromamba install -c conda-forge -n ${{ env.CONDA_ENV }} --yes --file requirements-dev.txt
49+
run: python -m pip install -r requirements-dev.txt
6550
# We only want to install this on one run, because otherwise we'll have
6651
# duplicate annotations.
6752
- name: Install error reporter
6853
if: ${{ matrix.python-version == '3.9' }}
69-
run: |
70-
python -m pip install pytest-github-actions-annotate-failures
54+
run: python -m pip install pytest-github-actions-annotate-failures
7155
- name: Install echopype
72-
run: |
73-
python -m pip install -e .[plot]
56+
run: python -m pip install -e ".[plot]"
57+
- name: Print installed packages
58+
run: python -m pip list
7459
- name: Copying test data to services
7560
run: |
7661
python .ci_helpers/docker/setup-services.py --deploy --data-only --http-server ${{ job.services.httpserver.id }}

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ Please report any bugs by [creating issues on GitHub](https://medium.com/nyc-pla
6767
Contributors
6868
------------
6969

70-
Wu-Jung Lee ([@leewujung](https://github.com/leewujung)) founded the echopype project in 2018. It is currently led by Wu-Jung Lee and Emilio Mayorga ([@emiliom](https://github.com/emiliom)), who are primary developers together with Brandon Reyes ([@b-reyes](https://github.com/b-reyes)), Landung "Don" Setiawan ([@lsetiawan](https://github.com/lsetiawan)), and previously Kavin Nguyen ([@ngkavin](https://github.com/ngkavin)) and Imran Majeed ([@imranmaj](https://github.com/imranmaj)). Valentina Staneva ([@valentina-s](https://github.com/valentina-s)) is also part of the development team.
70+
[![Contributors](https://contrib.rocks/image?repo=OSOceanAcoustics/echopype)](https://github.com/OSOceanAcoustics/echopype/graphs/contributors)
71+
72+
Wu-Jung Lee ([@leewujung](https://github.com/leewujung)) founded the echopype project in 2018. It is currently led by Wu-Jung Lee and Emilio Mayorga ([@emiliom](https://github.com/emiliom)), who are primary developers together with Landung "Don" Setiawan ([@lsetiawan](https://github.com/lsetiawan)), and previously Brandon Reyes ([@b-reyes](https://github.com/b-reyes)), Kavin Nguyen ([@ngkavin](https://github.com/ngkavin)) and Imran Majeed ([@imranmaj](https://github.com/imranmaj)). Valentina Staneva ([@valentina-s](https://github.com/valentina-s)) is also part of the development team.
7173

7274
Other contributors are listed in [echopype documentation](https://echopype.readthedocs.io).
7375

@@ -79,13 +81,10 @@ of the NOAA Alaska Fisheries Science Center
7981
for providing low-level file parsing routines for
8082
Simrad EK60 and EK80 echosounders.
8183

82-
83-
License
84-
-------
84+
## License
8585

8686
Echopype is licensed under the open source [Apache 2.0 license](https://opensource.org/licenses/Apache-2.0).
8787

88-
8988
---------------
9089

91-
Copyright (c) 2018-2022, echopype Developers.
90+
Copyright (c) 2018-2023, Echopype Developers.

docs/source/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
title: ""
55
author: Echopype Developers
6-
copyright: "2022"
6+
copyright: "2023"
77
logo: _static/echopype_logo_square.png
88

99
# Force re-execution of notebooks on each build.

docs/source/contributing.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,20 @@ the latter via `minio <https://minio.io>`_.
145145
will execute all tests. The entire test suite can be a bit slow, taking up to 40 minutes
146146
or more. If your changes impact only some of the subpackages (``convert``, ``calibrate``,
147147
``preprocess``, etc), you can run ``run-test.py`` with only a subset of tests by passing
148-
as an argument a comma-separated list of the modules that have changed. For example:
148+
as an argument a comma-separated list of the modules that have changed or also run only particular test
149+
files by passing a comma-separated list of test files that you want to run. For example:
149150

150151
.. code-block:: bash
151152
152153
python .ci_helpers/run-test.py --local --pytest-args="-vv" echopype/calibrate/calibrate_ek.py,echopype/preprocess/noise_est.py
153154
154155
will run only tests associated with the ``calibrate`` and ``preprocess`` subpackages.
156+
157+
.. code-block:: bash
158+
159+
python .ci_helpers/run-test.py --local --pytest-args="-vv" echopype/tests/convert/test_convert_azfp.py,echopype/tests/clean/test_noise.py
160+
161+
will run only the tests in the ``test_convert_azfp.py`` and ``test_noise.py`` files.
155162
For ``run-test.py`` usage information, use the ``-h`` argument:
156163
``python .ci_helpers/run-test.py -h``
157164

docs/source/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ interoperable data format and scalable analysis workflows that adapt well
1212
with increasing data volume - by providing open-source tools as entry points for
1313
scientists to make discovery using these new data.
1414

15-
1615
## Contributors
1716

18-
Wu-Jung Lee ([@leewujung](https://github.com/leewujung)) founded the echopype project in 2018. It is currently led by Wu-Jung Lee and Emilio Mayorga ([@emiliom](https://github.com/emiliom)), who are primary developers together with Brandon Reyes ([@b-reyes](https://github.com/b-reyes)), Landung "Don" Setiawan ([@lsetiawan](https://github.com/lsetiawan)), and previously Kavin Nguyen ([@ngkavin](https://github.com/ngkavin)) and Imran Majeed ([@imranmaj](https://github.com/imranmaj)). Valentina Staneva ([@valentina-s](https://github.com/valentina-s)) is also part of the development team.
17+
Wu-Jung Lee ([@leewujung](https://github.com/leewujung)) founded the echopype project in 2018. It is currently led by Wu-Jung Lee and Emilio Mayorga ([@emiliom](https://github.com/emiliom)), who are primary developers together with Landung "Don" Setiawan ([@lsetiawan](https://github.com/lsetiawan)), and previously Brandon Reyes ([@b-reyes](https://github.com/b-reyes)), Kavin Nguyen ([@ngkavin](https://github.com/ngkavin)) and Imran Majeed ([@imranmaj](https://github.com/imranmaj)). Valentina Staneva ([@valentina-s](https://github.com/valentina-s)) is also part of the development team.
1918

2019
Other contributors include:
2120
Frederic Cyr ([@cyrf0006](https://github.com/cyrf0006)),
@@ -25,7 +24,8 @@ Marian Peña ([@marianpena](https://github.com/marianpena)),
2524
Mark Langhirt ([@bnwkeys](https://github.com/bnwkeys)),
2625
Erin LaBrecque ([@erinann](https://github.com/erinann)),
2726
Emma Ozanich ([@emma-ozanich](https://github.com/emma-ozanich)),
28-
Aaron Marburg ([@amarburg](https://github.com/amarburg)). A complete list of direct contributors is on our [GitHub Contributors Page](https://github.com/OSOceanAcoustics/echopype/graphs/contributors).
27+
Aaron Marburg ([@amarburg](https://github.com/amarburg)).
28+
A complete list of direct contributors is on our [GitHub Contributors Page](https://github.com/OSOceanAcoustics/echopype/graphs/contributors).
2929

3030
We thank Dave Billenness of ASL Environmental Sciences for
3131
providing the AZFP Matlab Toolbox as reference for our

docs/source/whats-new.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,49 @@ What's new
44
See [GitHub releases page](https://github.com/OSOceanAcoustics/echopype/releases) for the complete history.
55

66

7+
# v0.8.2 (2023 November 20)
8+
9+
## Overview
10+
11+
This release includes a number of important performance enhancements, bug fixes, and under-the-hood refactoring to improve code readability.
12+
13+
## Enhancements
14+
- Full refactor of the functionality to directly storing parsed data to zarr before set_groups_* (#1185, #1218, #1070)
15+
- This avoids memory expansion during NaN padding across channel
16+
- Improve `compute_MVBS` using flox (#1124)
17+
- Revive and improve `compute_NASC` using flox (#1167)
18+
- Refactor AZFP XML parser
19+
- Improved XML parsing by using `xml.etree.ElementTree` to be consistent with other XML parsers in echopype (#1135)
20+
- Parse more parameters and store in the resulting `EchoData` objects (#1135)
21+
- Add partial support for AZFP multiple phase settings (#1182)
22+
- Overhaul AZFP Environment group
23+
- Set mandatory variables not in data to NaN (`sounds_speed_indicative`, `absorption_indicative`) (#1226)
24+
- Parse and store AZFP pressure data when exist (#1189, #1226)
25+
- Add `utils.misc.depth_from_pressure` function for converting pressure to depth (#1207)
26+
- Remove unused mechanism to selectively parse some EK datagrams (#1214)
27+
- Enhancements of `EchoData.update_platform` method
28+
- Factor out utility functions to a submodule (#1209)
29+
- Auto-assign timestamp for fixed-location external data using first `ping_time`(#1196)
30+
- Add support for `consolidate` subpackage functions to accept both in-memory or stored datasets (#1216) [NOT MERGED]
31+
32+
## Bug fixes
33+
- Fix `EchoData.to_zarr` encoding (#1128)
34+
- Eliminate preferred chunks
35+
- Ensuring chunk alignment and encoding only when handling dask arrays
36+
- Fix scaling bugs in `compute_NASC` (#1167)
37+
- Fix `UnicodeDecodeError` for ES60 files (#1215)
38+
- Handle missing `receiver_sampling_frequency` for EK80 data (#1219)
39+
40+
## Infrastructure and refactoring
41+
- Add support for running individual test files (#1166)
42+
- Add module based testing (#1180)
43+
- Update CI to barebone python, without conda (#1192)
44+
45+
46+
47+
48+
49+
750
# v0.8.1 (2023 September 2)
851

952
## Overview

echopype/calibrate/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def compute_Sv(echodata: EchoData, **kwargs) -> xr.Dataset:
153153
- for EK60 echosounder, allowed parameters include:
154154
`"sa_correction"`, `"gain_correction"`, `"equivalent_beam_angle"`
155155
- for AZFP echosounder, allowed parameters include:
156-
`"EL"`, `"DS"`, `"TVR"`, `"VTX"`, `"equivalent_beam_angle"`, `"Sv_offset"`
156+
`"EL"`, `"DS"`, `"TVR"`, `"VTX0"`, `"equivalent_beam_angle"`, `"Sv_offset"`
157157
158158
Passing in calibration parameters for other echosounders
159159
are not currently supported.
@@ -242,7 +242,7 @@ def compute_TS(echodata: EchoData, **kwargs):
242242
- for EK60 echosounder, allowed parameters include:
243243
`"sa_correction"`, `"gain_correction"`, `"equivalent_beam_angle"`
244244
- for AZFP echosounder, allowed parameters include:
245-
`"EL"`, `"DS"`, `"TVR"`, `"VTX"`, `"equivalent_beam_angle"`, `"Sv_offset"`
245+
`"EL"`, `"DS"`, `"TVR"`, `"VTX0"`, `"equivalent_beam_angle"`, `"Sv_offset"`
246246
247247
Passing in calibration parameters for other echosounders
248248
are not currently supported.

echopype/calibrate/cal_params.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"impedance_transceiver", # z_er
3030
"receiver_sampling_frequency",
3131
),
32-
"AZFP": ("EL", "DS", "TVR", "VTX", "equivalent_beam_angle", "Sv_offset"),
32+
"AZFP": ("EL", "DS", "TVR", "VTX0", "equivalent_beam_angle", "Sv_offset"),
3333
}
3434

3535
EK80_DEFAULT_PARAMS = {
@@ -352,7 +352,7 @@ def get_cal_params_AZFP(beam: xr.DataArray, vend: xr.DataArray, user_dict: dict)
352352
out_dict[p] = beam[p] # has only channel dim
353353

354354
# Params from Vendor_specific group
355-
elif p in ["EL", "DS", "TVR", "VTX", "Sv_offset"]:
355+
elif p in ["EL", "DS", "TVR", "VTX0", "Sv_offset"]:
356356
out_dict[p] = vend[p] # these params only have the channel dimension
357357

358358
return out_dict
@@ -396,7 +396,10 @@ def get_cal_params_EK(
396396
# Private function to get fs
397397
def _get_fs():
398398
# If receiver_sampling_frequency recorded, use it
399-
if "receiver_sampling_frequency" in vend:
399+
if (
400+
"receiver_sampling_frequency" in vend
401+
and not np.isclose(vend["receiver_sampling_frequency"], 0).all()
402+
):
400403
return vend["receiver_sampling_frequency"]
401404
else:
402405
# If receiver_sampling_frequency not recorded, use default value

echopype/calibrate/calibrate_azfp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def _cal_power_samples(self, cal_type, **kwargs):
6363
# TODO: take care of dividing by zero encountered in log10
6464
spreading_loss = 20 * np.log10(self.range_meter)
6565
absorption_loss = 2 * self.env_params["sound_absorption"] * self.range_meter
66-
SL = self.cal_params["TVR"] + 20 * np.log10(self.cal_params["VTX"]) # eq.(2)
66+
SL = self.cal_params["TVR"] + 20 * np.log10(self.cal_params["VTX0"]) # eq.(2)
6767

6868
# scaling factor (slope) in Fig.G-1, units Volts/dB], see p.84
6969
a = self.cal_params["DS"]

echopype/calibrate/range.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def compute_range_AZFP(echodata: EchoData, env_params: Dict, cal_type: str) -> x
6060
# Notation below follows p.86 of user manual
6161
N = vend["number_of_samples_per_average_bin"] # samples per bin
6262
f = vend["digitization_rate"] # digitization rate
63-
L = vend["lockout_index"] # number of lockout samples
63+
L = vend["lock_out_index"] # number of lockout samples
6464

6565
# keep this in ref of AZFP matlab code,
6666
# set to 1 since we want to calculate from raw data

echopype/commongrid/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from .api import compute_MVBS, compute_MVBS_index_binning
1+
from .api import compute_MVBS, compute_MVBS_index_binning, compute_NASC
22

33
__all__ = [
44
"compute_MVBS",
5+
"compute_NASC",
56
"compute_MVBS_index_binning",
67
]

0 commit comments

Comments
 (0)