Skip to content

NRT Rrs estimate and sun elevation display - #3

Open
belasi01 wants to merge 7 commits into
OceanOptics:masterfrom
belasi01:nrt-rrs-display
Open

NRT Rrs estimate and sun elevation display#3
belasi01 wants to merge 7 commits into
OceanOptics:masterfrom
belasi01:nrt-rrs-display

Conversation

@belasi01

@belasi01 belasi01 commented Sep 8, 2026

Copy link
Copy Markdown

Summary

Field-tested additions to the web UI's near-real-time display, developed while operating pySAS006 during the 2026 season:

  • Show Sun Elevation (with the configured threshold) in the sidebar.
  • Fix a HyperOCR frame-dispatcher bug: SATHPL/SATPLD Li frame headers weren't recognized (only handled for Lt), so Li was silently dropped for that HyperOCR variant. Also fixes a copy-paste bug where the Lt/Li wavelength fallback both wrote to Es_wavelength.
  • Scale Li by a configurable rho_sky (Fresnel reflectance, default 0.023) in the HyperSAS Spectrum plot, so Lt and rho_sky*Li fall in comparable orders of magnitude.
  • Compute and display an on-the-fly, approximate Rrs = (Lt - rho_sky*Li) / Ed spectrum (interpolating Li/Ed onto Lt's wavelength grid). This is explicitly a rough NRT estimate for visual QC during acquisition, not a replacement for HyperCP's post-processing.

Test plan

  • Deployed and run live on pySAS006 across multiple days at sea.
  • Verified Li now displays correctly for the SATHPL/SATPLD HyperOCR variant.
  • Visually confirmed Rrs spectrum tracks plausible values and updates live alongside Lt/Li/Es.

🤖 Generated with Claude Code

belasi01 and others added 7 commits September 7, 2026 22:16
Expose runner.sun_elevation (already computed for the auto-pilot
threshold) next to Ship Heading, using the same freshness guard as
the other NRT sidebar fields.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Display rho_sky*Li instead of raw Li in the spectrum plot so Lt and
Li fall in comparable orders of magnitude, a first step toward an
on-the-fly Rrs estimate. rho_sky defaults to the Fresnel reflectance
(0.023, Mobley 1999) and is configurable via [Rrs] rho_sky in
pysas_cfg.ini; this is a rough NRT approximation, not the precise
glint correction HyperCP computes in post-processing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
New spectral plot next to the timeseries graph showing Lt,
rho_sky*Li, and Ed together, mirroring the HyperSAS Spectrum
callback pattern (same cache/freshness logic, same Es-source
duality). This is a visual preparation step for an on-the-fly Rrs
estimate; the Rrs ratio itself (and the wavelength-grid interpolation
it needs, since Lt/Li/Es grids aren't guaranteed to match) is left
for a follow-up change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
set_dispatcher only recognized SATHPL/SATPLD headers for Lt, so Li
frames from that HyperOCR variant fell through to the else branch and
were silently dropped. Add the matching Li/Li_dark branches.

Also fix set_wavelengths: the fallback branches for missing Lt/Li
frame headers both assigned float('nan') to self.Es_wavelength
instead of self.Lt_wavelength/self.Li_wavelength respectively
(copy-paste bug), leaving stale or wrong wavelength arrays.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ntities

&rho; and &middot; did not render in Plotly trace names/titles on the
live pySAS006 (showed up as literal text), while &mu; and <sup>/<sub>
tags in the pre-existing labels rendered fine. Use literal ρ/· unicode
characters instead of HTML entities to sidestep Plotly's entity
whitelist.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace the preparatory Lt/rho_sky*Li/Ed comparison graph with the
actual Rrs = (Lt - rho_sky*Li) / Ed estimate, since displaying it
next to the near-identical HyperSAS Spectrum plot was redundant.
Li and Ed are interpolated onto the Lt wavelength grid via
numpy.interp since the three channels' wavelength grids are not
guaranteed to match. Division by near-zero Ed (e.g. at low sun
elevation) is silenced with np.errstate rather than spamming logs;
this remains a rough NRT approximation, not the HyperCP-grade Rrs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The 20s DATA_EXPIRED_DELAY guard hid the sidebar's sun elevation
after the runner enters auto-mode sleep (which only refreshes sun
position every ASLEEP_INTERRUPT = 120s while below threshold),
even though the last computed value was still meaningful. Show the
value whenever it has ever been computed (isnan guard only), and
display the configured min_sun_elevation threshold alongside it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant