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
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

project = "profinder"
author = "Jesse Cusack"
release = "0.2.3"
release = "0.2.4"
extensions = [
"myst_nb",
"sphinx.ext.autodoc",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "profinder"
version = "0.2.3"
version = "0.2.4"
description = "Functions to find profiles in ocean pressure data"
readme = "README.md"
authors = [
Expand Down
18 changes: 10 additions & 8 deletions src/profinder/profinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _find_segment(
time: Optional[ArrayLike] = None,
velocity: Optional[ArrayLike] = None,
min_speed: float = 0.2,
direction: Literal["up", "down", "both"] = "down",
direction: Literal["up", "down"] = "down",
) -> Tuple[int, int]:
"""Find the start and end indices of a single down or up segment.

Expand All @@ -119,8 +119,8 @@ def _find_segment(
Pre-computed velocity (same length as pressure). Overrides gradient(time).
min_speed : float
Minimum absolute velocity magnitude to be considered valid.
direction : {'up','down','both'}
Direction(s) in which the speed threshold is enforced.
direction : {'up','down'}
Direction in which the speed threshold is enforced.

Returns
-------
Expand All @@ -147,8 +147,10 @@ def _find_segment(
good_velocity = v > min_speed
elif direction == "up":
good_velocity = v < -min_speed
else: # both
good_velocity = np.abs(v) > min_speed
else:
raise ValueError(
"direction must be 'up' or 'down' when applying speed threshold."
)

good_data = good_pressure & good_velocity

Expand Down Expand Up @@ -337,7 +339,7 @@ def find_segment(
time: Optional[ArrayLike] = None,
velocity: Optional[ArrayLike] = None,
min_speed: float = 0.2,
direction: Literal["up", "down", "both"] = "down",
direction: Literal["up", "down"] = "down",
) -> Tuple[int, int]:
"""Find the start and end indices of a single down or up segment

Expand All @@ -358,8 +360,8 @@ def find_segment(
Pre-computed velocity (same length as pressure). Overrides gradient(time).
min_speed : float
Minimum absolute velocity magnitude to be considered valid.
direction : {'up','down','both'}
Direction(s) in which the speed threshold is enforced.
direction : {'up','down'}
Direction in which the speed threshold is enforced.

Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.