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
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ Every release is archived on Zenodo under the concept DOI
[10.5281/zenodo.22321312](https://doi.org/10.5281/zenodo.22321312), which
always resolves to the latest version.

## 1.38.4 — 2026-12-03

Why Marshall & Smith's (1990) two-stream model gives about half the
Monte Carlo's Raman effect in open question 7 (DECISIONS.md section 155).
The package does not change; no shipped value changed.

**Found.** Removing the differences one at a time, from the Monte Carlo
of 1.38.3 to the model, closes on the model within 0.03 percent. The
largest step is the factor mu_r = 1/2, "the average cosine for the Raman
scattering process", that their Eq. (15a) puts on the source of
downward Raman light: it halves the Raman light and moves the reduction
of Kd by 0.500 to 0.920 times. Taking the beams straight down and the
Raman light as a stream attenuated by 1.5 a move it the two ways and
partly cancel. The transfer equation integrated over the lower
hemisphere has no such cosine; the paper does not derive it, so this is
recorded as a reading of the equation.

**Docs.** `OPEN_QUESTIONS.md` question 7 and DATA.md section 3 say so;
`examples/README.md` now says, beside the model's 0.59 percent, what the
Monte Carlo gives. `tools/raman_mc.py --question7-chain` writes
`examples/data/raman_question7/chain.csv`.

## 1.38.3 — 2026-12-03

Raman scattering, a second step: open question 7's case through the
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors:
- family-names: Ishibashi
given-names: T.
orcid: "https://orcid.org/0000-0003-1711-9908"
version: 1.38.3
version: 1.38.4
doi: "10.5281/zenodo.22321312"
license: Apache-2.0
repository-code: "https://github.com/tishibashi-cpu/jerlov"
Expand Down
5 changes: 4 additions & 1 deletion DATA.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ the same case (1.38.3, DECISIONS.md section 154) gives 1.15 to 2.55 times
the two-stream reduction, up to 1.46 percent over 0-10 m at 700 nm, so
the statement that Raman light cannot do it over the top 10 m, which
rested on a reduction under 1 percent, is withdrawn; 1.46 percent is
still below the 4.5 percent deficit. So, as far as can be said here:
still below the 4.5 percent deficit. Most of the difference is the
factor mu_r = 1/2 on the source in their Eq. (15a) (p. 74), which halves
the Raman light (DECISIONS.md section 155, a reading of the equation, not
a confirmed misprint). So, as far as can be said here:
rounding cannot account for the deficits; broad filters can at 700 nm
and at 600 nm in 1976; Raman light over the top 10 m lowers Kd by under
1.5 percent. Nothing here accounts for 675 nm in either edition, nor for
Expand Down
96 changes: 96 additions & 0 deletions DECISIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11254,3 +11254,99 @@ below, where the weight exp(-(c - sigma) s) is 0, so roulette ends it.
The site's second page quoted section 131's conclusion and is changed
with question 7; the example and its README, which print Marshall &
Smith's model's own figures, are not.

## 155. Why Marshall & Smith's two streams give about half the Monte Carlo's Raman effect (1.38.4): the plan

Section 154 found the Monte Carlo's Raman reduction of Kd 1.15 to 2.55
times the two-stream model's and did not say why. The user asked on
2026-12-03 for the difference to be taken apart, and for the examples'
README to say what the Monte Carlo gives beside the model's 0.59 percent.

### The steps, set now

Between the Monte Carlo and the two-stream model lie these differences,
each removed in turn by a computation in `tools/raman_mc.py`
(`q7_chain`), cumulative, each the step before with one thing changed:

- S0, the Monte Carlo (section 154's CSV).
- S1, `q7_once`: no elastic scattering of either light, no surface, the
Raman light emitted by Mobley et al.'s Eq. (9) about the refracted beam
(mu_w = 0.961) and reaching the depth unscattered (an exponential
integral over directions); the sun's own light exp(-c z / mu_w).
- S2: the Raman light emitted evenly in all directions.
- S3: the beams as the model takes them (p. 74, "D ~ 1"): straight down,
the exciting light's scalar irradiance equal to its plane irradiance
and attenuated by K' = a' + b_b', the sun's by K = a + b_b.
- S4: the Raman light attenuated as the model's diffuse stream,
exp(-a_r (z - z')) with a_r = 1.5 a (p. 74), instead of over its
directions.
- S5: the source as the model writes it, Eq. (15a) (p. 74, read from the
page image), mu_r b_r E0 / 2 with mu_r = 1/2 "the average cosine for
the Raman scattering process", instead of b_r E0 / 2, the power an
even emission sends into the lower hemisphere. (Integrating the
transfer equation over the lower hemisphere gives the source of Ed
without a cosine; whether the model's factor is meant otherwise is
not said on the page.)
- S6, the two-stream model (the example's `raman_kd`), which differs from
S5 only by the backscattering terms (G+-, K_r, and the Raman light
scattered up and back, Eq. 20b).

For each step and each of section 154's 18 cases (b_r as measured), the
reduction 1 - Kd with Raman over Kd without, over 0-10, 0-20 and 0-30 m,
as section 154 took it.

### The measures, set now

1. **The chain closes.** S5 is within 3 percent (relative) of S6 in all
18 cases; otherwise the chain is said to miss something, and what is
left is recorded.
2. **Each step's share.** For every step, the factor by which it moves
the reduction, across the 18 cases (least and greatest). The step
that moves it most, by the median of its factors' distance from 1, is
named as the main cause of the difference; if two are within 10
percent of each other, both are named.

### Documents

`examples/data/raman_question7/chain.csv`; a test that re-reads it,
recomputes the measures and checks the quoted figures, and recomputes
the semi-analytic steps for two cases; OPEN_QUESTIONS.md question 7
("What is not known" loses or keeps the question as the result says);
DATA.md section 3, a sentence; `examples/README.md`, the sentence the
user asked for beside the 0.59 percent; CHANGELOG; NEXT_STEPS. If S5's
factor is the main cause, it is recorded as a reading of Eq. (15a), not
as a confirmed misprint, since the paper's derivation of mu_r is not
given. The package does not change: 1.38.4.

### Result

`python tools/raman_mc.py --question7-chain` (about 20 seconds) wrote
`examples/data/raman_question7/chain.csv`.

**Changed after the first run.** In the first run S3's change (the beams
straight down) was put at the wrong step, so S3 came out equal to S2 in
every case; the factor of exactly 1 showed it. It was fixed before
anything was recorded, and the run made again.

1. **Met: the chain closes.** S5 is within 0.03 percent of the two-stream
model in all 18 cases (1.000007 to 1.000246 times): the
backscattering terms of Eq. (20b) do not matter here.
2. **The main cause is S5, the factor mu_r = 1/2 that Eq. (15a) puts on
the source.** Each step's factor on the reduction across the 18 cases,
and the median of its distance from 1:
- S0 to S1 (scattering and the surface left out): 0.910 to 0.997,
0.018;
- S1 to S2 (even emission for Eq. 9): 0.940 to 0.994, 0.053;
- S2 to S3 (the beams straight down, E0 = Ed, K = a + b_b): 0.628 to
0.923, 0.257;
- S3 to S4 (the diffuse stream at 1.5 a): 1.034 to 1.358, 0.306;
- S4 to S5 (mu_r = 1/2): 0.500 to 0.920, 0.473;
- S5 to S6 (the backscattering terms): 1.000 to 1.000, 0.000.
S5 halves the Raman light; its factor on the reduction is 0.500 where
the Raman light is small and nearer 1 where it dominates and the
logarithm saturates. S3 and S4 move the reduction in opposite
directions and partly cancel. As the plan says, this is recorded as a
reading of Eq. (15a): the page gives mu_r as "the average cosine for
the Raman scattering process" without deriving it, and the transfer
equation integrated over the lower hemisphere has no cosine on the
source.
23 changes: 17 additions & 6 deletions OPEN_QUESTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,19 +575,30 @@ writes to `examples/data/raman_question7/runs.csv`.
statement that Raman light cannot do it there is withdrawn
(DECISIONS.md section 154). The largest reduction over 0-10 m, 1.46
percent, is still below type I's smallest deficit there, 4.5 percent.
- Why the two streams give less (DECISIONS.md section 155): removing the
differences one at a time, from the Monte Carlo to the model, closes on
the model within 0.03 percent, and the largest step is the factor mu_r
= 1/2 that their Eq. (15a) puts on the source of downward Raman light,
"the average cosine for the Raman scattering process" (p. 74); it
halves the Raman light, moving the reduction by 0.500 to 0.920 times.
Taking the beams straight down and the Raman light as a stream
attenuated by 1.5 a move it by 0.628 to 0.923 and 1.034 to 1.358 times,
partly cancelling. The transfer equation integrated over the lower
hemisphere has no cosine on that source; the paper does not derive
it.

**What is not known.** The widths, shapes and tails of the filters behind
each of Jerlov's values; the result moves with where a filter's
short-wavelength tail ends, and "real filters have longer tails than
predicted by the Gaussian" (Marshall & Smith, p. 78). Whether Jerlov's red
values all come from the top 10 m, where Raman light is small, or some
from deeper, where it is not. Why Marshall & Smith's two streams give
about half the Monte Carlo's Raman effect; and whether their coefficient,
measured with excitation at 488 nm, holds at 549 and 565 nm (both
computations take it so). So the deficit at 675 nm, and the 1968 one at
from deeper, where it is not. Whether Marshall & Smith's factor mu_r on
the source is meant in a way the page does not show; and whether their
coefficient, measured with excitation at 488 nm, holds at 549 and 565 nm
(both computations take it so). So the deficit at 675 nm, and the 1968 one at
600 nm against Smith & Baker, have no account here.

**Where.** DATA.md section 3; DECISIONS.md sections 129, 130, 131, 153
and 154; `examples/jerlov_kd_below_pure_water.py`; `tools/raman_mc.py`
**Where.** DATA.md section 3; DECISIONS.md sections 129, 130, 131, 153,
154 and 155; `examples/jerlov_kd_below_pure_water.py`; `tools/raman_mc.py`
and `examples/data/raman_question7/runs.csv`; the sources `jerlov1968`,
`jerlov1976` and `austin1986`.
2 changes: 1 addition & 1 deletion docs/pages/disagree.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/pages/dive.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/pages/shallow.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/pages/waters.html

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,10 @@ pure water over 0-10 m appears at **0.853** of its absorption at 700 nm,
which reaches the 1976 deficit there; at 675 nm no filter up to 60 nm
does. Raman scattering, the other mechanism Marshall & Smith name, is
computed by their own two-stream model: over 0-10 m it lowers Kd by at
most **0.59** percent at 675 and 700 nm.
most **0.59** percent at 675 and 700 nm. A Monte Carlo of the same case
(`tools/raman_mc.py`, not this script) gives more, up to 1.46 percent at
700 nm, mostly because the model halves its Raman source; see
`OPEN_QUESTIONS.md` question 7.

## What they do not show

Expand Down
19 changes: 19 additions & 0 deletions examples/data/raman_question7/chain.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
source,emitted_nm,depth_m,S0,S1,S2,S3,S4,S5,S6
smith1981,600.0,10.0,1.415828e-03,1.361844e-03,1.284456e-03,1.086473e-03,1.473937e-03,7.376329e-04,7.375644e-04
smith1981,600.0,20.0,7.922699e-03,7.339380e-03,6.905518e-03,4.990202e-03,6.674286e-03,3.364387e-03,3.363560e-03
smith1981,600.0,30.0,4.737512e-02,4.377264e-02,4.151456e-02,2.714644e-02,3.527520e-02,1.877601e-02,1.877156e-02
smith1981,675.0,10.0,2.720919e-03,2.679193e-03,2.517130e-03,1.875552e-03,2.509162e-03,1.258047e-03,1.257908e-03
smith1981,675.0,20.0,5.974195e-02,5.841596e-02,5.562206e-02,3.492513e-02,4.455208e-02,2.444747e-02,2.444492e-02
smith1981,675.0,30.0,2.674339e-01,2.649530e-01,2.606038e-01,2.123628e-01,2.330237e-01,1.839646e-01,1.839565e-01
smith1981,700.0,10.0,1.094090e-02,1.075215e-02,1.012265e-02,6.557426e-03,8.689346e-03,4.406044e-03,4.405808e-03
smith1981,700.0,20.0,2.625726e-01,2.608536e-01,2.565058e-01,2.057529e-01,2.265517e-01,1.771949e-01,1.771911e-01
smith1981,700.0,30.0,4.683484e-01,4.663403e-01,4.633629e-01,4.276102e-01,4.423625e-01,4.068438e-01,4.068408e-01
pope1997,600.0,10.0,1.407180e-03,1.341600e-03,1.266735e-03,1.086176e-03,1.475090e-03,7.381515e-04,7.381309e-04
pope1997,600.0,20.0,6.747937e-03,6.145749e-03,5.783759e-03,4.284008e-03,5.743130e-03,2.889957e-03,2.889287e-03
pope1997,600.0,30.0,3.569103e-02,3.246284e-02,3.071103e-02,2.039234e-02,2.676296e-02,1.397978e-02,1.397651e-02
pope1997,675.0,10.0,3.061633e-03,3.008973e-03,2.828451e-03,2.085316e-03,2.788439e-03,1.398578e-03,1.398447e-03
pope1997,675.0,20.0,7.336042e-02,7.184075e-02,6.863522e-02,4.344628e-02,5.487842e-02,3.078165e-02,3.077900e-02
pope1997,675.0,30.0,2.942579e-01,2.920494e-01,2.877792e-01,2.393707e-01,2.600725e-01,2.107590e-01,2.107520e-01
pope1997,700.0,10.0,1.006242e-02,9.866322e-03,9.289690e-03,6.081641e-03,8.067522e-03,4.084549e-03,4.084346e-03
pope1997,700.0,20.0,2.526083e-01,2.506333e-01,2.461712e-01,1.945289e-01,2.158168e-01,1.655409e-01,1.655373e-01
pope1997,700.0,30.0,4.646595e-01,4.632782e-01,4.601951e-01,4.231166e-01,4.384939e-01,4.015010e-01,4.014982e-01
2 changes: 1 addition & 1 deletion jerlov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,4 @@
# number is meant (DECISIONS.md section 126).
_data.check_public(globals(), __all__)

__version__ = "1.38.3"
__version__ = "1.38.4"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "jerlov"
version = "1.38.3"
version = "1.38.4"
description = "Inherent optical properties of Jerlov water types, with provenance"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
63 changes: 63 additions & 0 deletions tests/test_monte_carlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,3 +1028,66 @@ def test_raman_question_7_against_a_single_emission_check():
got = tool.q7_once(float(r["emitted_nm"]), r["source"],
float(r["depth_m"]), ex, caught)
assert got == pytest.approx(float(r["once"]), rel=1e-5)


@source_tree
def test_raman_two_streams_taken_apart():
"""DECISIONS.md section 155: the chain from the Monte Carlo to
Marshall & Smith's two streams, its measures and quoted figures."""
import statistics
path = ROOT / "examples" / "data" / "raman_question7" / "chain.csv"
with path.open() as handle:
rows = list(csv.DictReader(handle))
assert len(rows) == 18
mc_rows = {(r["source"], r["emitted_nm"], r["depth_m"]): r
for r in _q7_rows() if r["b_r"] == "b_r"}
for r in rows:
m = mc_rows[(r["source"], r["emitted_nm"], r["depth_m"])]
assert r["S0"] == m["reduction"]
assert r["S6"] == m["two_stream_reduction"]
close = [float(r["S5"]) / float(r["S6"]) for r in rows]
assert all(abs(x - 1) <= 0.03 for x in close) # measure 1
assert max(abs(x - 1) for x in close) < 0.0003
steps = ("S0", "S1", "S2", "S3", "S4", "S5", "S6")
factors = {b: [float(r[b]) / float(r[a]) for r in rows]
for a, b in zip(steps, steps[1:])}
distance = {k: statistics.median(abs(x - 1) for x in v)
for k, v in factors.items()}
main = max(distance, key=distance.get)
assert main == "S5" # measure 2
others = sorted(distance.values())[-2]
assert distance["S5"] > 1.1 * others
section = _flat_text("DECISIONS.md").split("## 155. ")[1]
for k, v in factors.items():
assert (f"{min(v):.3f} to {max(v):.3f}, {distance[k]:.3f}"
in section), k
q7 = _flat_text("OPEN_QUESTIONS.md").split("## 7. ")[1]
s3, s4, s5 = factors["S3"], factors["S4"], factors["S5"]
assert f"{min(s5):.3f} to {max(s5):.3f} times" in q7
assert (f"{min(s3):.3f} to {max(s3):.3f} and {min(s4):.3f} to "
f"{max(s4):.3f} times") in q7
assert f"{min(s5):.3f} to {max(s5):.3f} times" in \
_flat_text("CHANGELOG.md")
readme = _flat_text("examples/README.md")
at700 = max(float(r["reduction"]) for r in _q7_rows()
if r["depth_m"] == "10.0" and r["emitted_nm"] == "700.0")
assert f"up to {100 * at700:.2f} percent at 700 nm" in readme


@source_tree
def test_raman_chain_steps_recomputed():
tool = _tool_module("raman_mc")
ex = tool._example()
caught: set = set()
path = ROOT / "examples" / "data" / "raman_question7" / "chain.csv"
with path.open() as handle:
rows = list(csv.DictReader(handle))
for r in rows[:2]:
z = float(r["depth_m"])
for step in tool.CHAIN_STEPS:
share, kd = tool.q7_step(step, float(r["emitted_nm"]),
r["source"], z, ex, caught)
assert math.log1p(share) / (z * kd) == pytest.approx(
float(r[step]), rel=1e-5)
assert tool.q7_step("S1", 700.0, "smith1981", 10.0, ex, caught)[0] \
== tool.q7_once(700.0, "smith1981", 10.0, ex, caught)
Loading