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
20 changes: 15 additions & 5 deletions oceanarray/mooring_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
"heading",
"pitch",
"roll",
"analog_input_1",
"analog_input_2",
]

# Variables passed through without QC masking at the stack step.
Expand Down Expand Up @@ -116,6 +118,11 @@ def _parse_latlon_with_source(cfg: dict) -> tuple[float, float, str]:

source_key is the YAML key pair used, e.g. 'seabed_latitude/seabed_longitude',
or 'unknown (defaulting to 0, 0)' if none found.

Zero values (lat == 0 and lon == 0) are treated as unfilled placeholders and
skipped so that a later key with a real location is used instead. This handles
YAML templates where fields like ``seabed_latitude: 00 00.000 N`` are present
but not yet populated.
"""
for lat_key, lon_key in [
("seabed_latitude", "seabed_longitude"),
Expand All @@ -126,11 +133,14 @@ def _parse_latlon_with_source(cfg: dict) -> tuple[float, float, str]:
lat_s = cfg.get(lat_key)
lon_s = cfg.get(lon_key)
if lat_s is not None and lon_s is not None:
return (
_dms_to_deg(str(lat_s)),
_dms_to_deg(str(lon_s)),
f"{lat_key}/{lon_key}",
)
try:
lat_v = _dms_to_deg(str(lat_s))
lon_v = _dms_to_deg(str(lon_s))
except Exception: # noqa: BLE001 — _dms_to_deg parse failure; try next key
continue
if lat_v == 0.0 and lon_v == 0.0:
continue # treat (0, 0) as an unfilled placeholder
return lat_v, lon_v, f"{lat_key}/{lon_key}"
return 0.0, 0.0, "unknown (defaulting to 0, 0)"


Expand Down
File renamed without changes.
85 changes: 85 additions & 0 deletions oceanarray/plotters/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
"""Oceanarray plotting package.

Three-tier architecture
-----------------------
Tier 1 _primitives.py Data-agnostic plot primitives (array-in / Figure-out).
Tier 2 _current.py etc. Domain wrappers (xr.Dataset-in / Figure-out).
Tier 3 report/_plots.py Thin report wrappers (path-in / base64-out).

Public API
----------
Available now (pre-OdB):

plot_temperature_trajectory Lagrangian trajectory coloured by temperature
plot_speed_boxplot Current speed boxplot with percentile statistics

Legacy functions (from plotter.py — available via backward-compat shim):

plot_qartod_summary, plot_climatology, scatter_profile_vs_PRES,
pcolor_timeseries_by_depth, plot_timeseries_by_depth, plot_trim_windows,
plot_microcat_raw, plot_aquadopp_raw, plot_microcat,
show_variables, show_attributes, plot_mooring_timeseries, plot_grid

As each legacy function is migrated into the appropriate sub-module, remove
it from plotter.py and from the shim below. See the migration checklist at
.claude/plotters_update-20260718.md.

Future
------
Post-OdB: fill in _timeseries.py, _section.py, _diagnostic.py, _helpers.py;
implement remaining Tier-1 primitives; delete plotter.py once empty.
May eventually be split into a separate oceanvis package.
"""

# ---------------------------------------------------------------------------
# New functions (pre-OdB)
# ---------------------------------------------------------------------------
from oceanarray.plotters._current import ( # noqa: F401
plot_temperature_trajectory,
plot_speed_boxplot,
plot_multi_aquadopp_trajectories,
plot_aquadopp_speed_profile,
)

# ---------------------------------------------------------------------------
# Backward-compat shim — re-exports from legacy plotter.py
# Remove each entry here once the function has been migrated to a sub-module
# and the corresponding function deleted from plotter.py.
# ---------------------------------------------------------------------------
from oceanarray.plotter import ( # noqa: F401
plot_qartod_summary,
plot_climatology,
scatter_profile_vs_PRES,
pcolor_timeseries_by_depth,
plot_timeseries_by_depth,
plot_trim_windows,
plot_microcat_raw,
plot_aquadopp_raw,
plot_microcat,
show_variables,
show_attributes,
plot_mooring_timeseries,
plot_grid,
)

__all__ = [
# New (pre-OdB)
"plot_temperature_trajectory",
"plot_speed_boxplot",
"plot_multi_aquadopp_trajectories",
"plot_aquadopp_speed_profile",
# Legacy shim
"plot_qartod_summary",
"plot_climatology",
"scatter_profile_vs_PRES",
"pcolor_timeseries_by_depth",
"plot_timeseries_by_depth",
"plot_trim_windows",
"plot_microcat_raw",
"plot_aquadopp_raw",
"plot_microcat",
"show_variables",
"show_attributes",
"plot_mooring_timeseries",
"plot_grid",
]
Loading
Loading