Skip to content
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
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
build-artifact:
name: Build echoshader package
runs-on: ubuntu-22.04
if: github.repository == 'OSOceanAcoustics/echoshader'
if: github.repository == 'echostack-org/echoshader'
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# .github/workflows/pytest.yml
name: PyTest

on: [push, pull_request, workflow_dispatch]

jobs:
Expand All @@ -9,23 +10,23 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
runs-on: [ubuntu-latest]
experimental: [false]

steps:
- name: Check out repository code
uses: actions/checkout@v7
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel
pip install -r requirements-dev.txt
pip install -e .
python -m pip install --upgrade pip setuptools wheel
pip install -e ".[dev,test]"

- name: Run Coverage Pytest
run: pytest --cov=./ --cov-report=xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v7
env:
Expand Down
Binary file modified .gitignore
Binary file not shown.
30 changes: 6 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ exclude: |
notebooks/|
docs/source/conf.py
)

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
Expand All @@ -16,34 +17,15 @@ repos:
- id: pretty-format-json
args: ["--autofix", "--indent=2", "--no-sort-keys"]

- repo: https://github.com/PyCQA/isort
rev: 9.0.0a3
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.5.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.2
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 7.3.0
hooks:
- id: flake8
- id: ruff-check
args: ["--fix"]
- id: ruff-format

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.49.0
hooks:
- id: markdownlint
args: ["**/**/*.md", "--ignore", "docs/source/gsoc", "--enable", "MD013", "--disable", "MD043", "line_length", "--fix"]
# uncomment the below line and comment out the above line to check the lines over 90
# args: ["**/**/*.md", "--enable", "MD013", "--disable", "MD043", "--fix"]

# 09/19/2022 Don.S.: Comment out and not use codespell at the moment
# doesn't seem to be ignoring .ipynb when specified...
# - repo: https://github.com/codespell-project/codespell
# rev: v2.1.0
# hooks:
# - id: codespell
# args: ["-w", "docs/source", "echoshader"]
6 changes: 1 addition & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"
python: "3.12"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
Expand Down
436 changes: 6 additions & 430 deletions docs/source/GSoC/EchoMap.ipynb

Large diffs are not rendered by default.

1,912 changes: 5 additions & 1,907 deletions docs/source/GSoC/Echogram_EchoStats.ipynb

Large diffs are not rendered by default.

1,581 changes: 16 additions & 1,565 deletions docs/source/version_0.1.0/echogram_examples.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/source/version_0.1.0/get_moored_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.14"
"version": "3.12.13"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions docs/source/version_0.1.0/get_ship_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@
"outputs": [],
"source": [
"from pathlib import Path\n",
"import itertools as it\n",
"import datetime as dt\n",
"from dateutil import parser as dtparser\n",
"\n",
"import fsspec\n",
"from urllib import request\n",
"\n",
"import echopype as ep\n",
"import xarray as xr"
Expand Down Expand Up @@ -215,11 +211,7 @@
"MVBS_ds[\"longitude\"]=lon\n",
"MVBS_ds[\"latitude\"]=lat\n",
"\n",
"import datetime\n",
"history = (\n",
" f\"{datetime.datetime.utcnow()} +00:00. \"\n",
" \"Interpolated from Platform latitude/longitude.\"\n",
" )\n",
"history = f\"{dt.datetime.now(dt.UTC).isoformat()} Interpolated from Platform latitude/longitude.\"\n",
"MVBS_ds[\"latitude\"] = MVBS_ds[\"latitude\"].assign_attrs({\"history\": history})\n",
"MVBS_ds[\"longitude\"] = MVBS_ds[\"longitude\"].assign_attrs({\"history\": history})\n",
"\n",
Expand Down Expand Up @@ -253,7 +245,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.14"
"version": "3.12.13"
}
},
"nbformat": 4,
Expand Down
5 changes: 2 additions & 3 deletions docs/source/version_0.1.0/hist_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -276,7 +276,6 @@
"source": [
"import panel as pn\n",
"import xarray as xr\n",
"import echoshader\n",
"pn.extension('bokeh', comms='default') "
]
},
Expand Down Expand Up @@ -1481,7 +1480,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.14"
"version": "3.12.13"
}
},
"nbformat": 4,
Expand Down
5 changes: 2 additions & 3 deletions docs/source/version_0.1.0/track_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -284,7 +284,6 @@
"source": [
"import panel as pn\n",
"import xarray as xr\n",
"import echoshader\n",
"pn.extension('bokeh', comms='default') "
]
},
Expand Down Expand Up @@ -1740,7 +1739,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.14"
"version": "3.12.13"
}
},
"nbformat": 4,
Expand Down
15 changes: 4 additions & 11 deletions echoshader/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,11 @@ def _check_input(self):
else:
if actual != expected:
raise ValueError(
f"'Sv' dimension at index {i} "
f"must be '{expected}', but got '{actual}'."
f"'Sv' dimension at index {i} must be '{expected}', but got '{actual}'."
)

def _init_widget(self):
self.colormap = panel.widgets.LiteralInput(
name="Colormap", value="jet", type=(str, list)
)
self.colormap = panel.widgets.LiteralInput(name="Colormap", value="jet", type=(str, list))

self.Sv_range_slider = panel.widgets.EditableRangeSlider(
name="Sv Range Slider",
Expand All @@ -138,9 +135,7 @@ def _init_widget(self):
step=0.01,
)

self.tile_select = panel.widgets.Select(
name="Map Tile Select", value="OSM", options=tiles
)
self.tile_select = panel.widgets.Select(name="Map Tile Select", value="OSM", options=tiles)

self.channel_select = panel.widgets.Select(
name="Channel Select", options=self.MVBS_ds.channel.values.tolist()
Expand Down Expand Up @@ -249,9 +244,7 @@ def echogram(

if rgb_composite is True:
if channel is None or len(channel) != 3:
raise ValueError(
"Must have exactly 3 frequency channels for tricolor echogram."
)
raise ValueError("Must have exactly 3 frequency channels for tricolor echogram.")

self.tri_channel = channel

Expand Down
16 changes: 4 additions & 12 deletions echoshader/echogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ def single_echogram(
return echogram


def convert_to_color(
MVBS_ds: xarray, channel_sel: str, th_bottom: float, th_top: float
):
def convert_to_color(MVBS_ds: xarray, channel_sel: str, th_bottom: float, th_top: float):
"""
Convert backscatter data to a color array based on threshold values.

Expand Down Expand Up @@ -119,12 +117,8 @@ def convert_to_color(
)
"""
da_color = MVBS_ds.sel(channel=channel_sel)
da_color = da_color.where(
da_color <= th_top, other=th_top
) # set to ceiling at the top
da_color = da_color.where(
da_color >= th_bottom, other=th_bottom
) # threshold at the bottom
da_color = da_color.where(da_color <= th_top, other=th_top) # set to ceiling at the top
da_color = da_color.where(da_color >= th_bottom, other=th_bottom) # threshold at the bottom
da_color = da_color.expand_dims("channel")
da_color = (da_color - th_bottom) / (th_top - th_bottom)
da_color = numpy.squeeze(da_color.Sv.data).transpose()
Expand Down Expand Up @@ -198,9 +192,7 @@ def tricolor_echogram(
rgb_ch = {"R": None, "G": None, "B": None}

for ch, color in rgb_map.items():
rgb_ch[color] = convert_to_color(
MVBS_ds, channel_sel=ch, th_bottom=vmin, th_top=vmax
)
rgb_ch[color] = convert_to_color(MVBS_ds, channel_sel=ch, th_bottom=vmin, th_top=vmax)

rgb = holoviews.RGB(
(
Expand Down
4 changes: 1 addition & 3 deletions echoshader/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ def get_track_corners(MVBS_ds: xarray.Dataset):
return left, bottom, right, top


def convert_EPSG(
lat: Union[int, float], lon: Union[int, float], mercator_to_coord: bool = True
):
def convert_EPSG(lat: Union[int, float], lon: Union[int, float], mercator_to_coord: bool = True):
"""
Converts coordinates between EPSG coordinate reference systems (CRS).

Expand Down
Loading