11# Copyright (c) Brockmann Consult GmbH, 2026.
22# License: MIT
33"""
4- This module provides functions and empirical model functions for
5- NASA Ocean Colour algorithms .
4+ Empirical model functions for NASA Ocean Colour algorithms. Refer to the
5+ Algorithm Publication Tool (https://doi.org/10.5067/JCQB8QALDOYD) .
66
77Refer to Lachlan et al. (2019, https://doi.org/10.3389/feart.2019.00176)
8- for propagating radiometric data uncertainties through NASA Ocean Color
8+ for propagating radiometric data uncertainties through NASA Ocean Colour
99algorithms.
10+
11+ Further references:
12+
13+ Hu et al. (2019). Improving Satellite Global Chlorophyll a Data
14+ Products Through Algorithm Refinement and Data Recovery. Journal
15+ of Geophysical Research: Oceans, 124(3), 1524-1543.
16+ https://doi.org/10.1029/2019JC014941.
17+
18+ O'Reilly and Werdell (2019). Chlorophyll algorithms for ocean
19+ color sensors - OC4, OC5 & OC6. Remote Sensing of Environment,
20+ 229, 32-47. https://doi.org/10.1016/j.rse.2019.04.021.
1021"""
1122
1223from abc import ABC
@@ -75,39 +86,6 @@ def blend(ci: Array, cx: Array) -> Array:
7586 super ().__init__ (f )
7687
7788
78- class Ci (ToF ):
79- """
80- The chlorophyll index (CI) function.
81-
82- For chlorophyll retrievals below 0.25 mg m-3. For details refer
83- to https://doi.org/10.5067/JCQB8QALDOYD.
84- """
85-
86- def __init__ (self , b , g , r ):
87- """Creates a new instance.
88-
89- :param b: The blue spectral waveband (nm).
90- :param g: The green spectral waveband (nm).
91- :param r: The red spectral waveband (nm).
92- """
93- self .t = (g - b ) / (r - b )
94-
95- def f (x ):
96- """
97- Returns the ocean colour index.
98-
99- :param x: Remote sensing reflectance, shape (n_wavebands, ...).
100- The last waveband refers to green.
101- :returns: The ocean colour index.
102- """
103- B = x [0 ] # noqa: N806
104- G = x [1 ] # noqa: N806
105- R = x [2 ] # noqa: N806
106- return G - (B + (R - B ) * self .t )
107-
108- super ().__init__ (f )
109-
110-
11189class Mbr (ToF ):
11290 """The maximum band ratio function."""
11391
@@ -128,35 +106,42 @@ def f(x):
128106 super ().__init__ (f )
129107
130108
131- class OCi (ToM ):
132- """
133- NASA's ocean colour chlorophyll index (OCI) model function.
134-
135- Needs values of chlorophyll index (:class:`Ci`) as input. Used
136- for chlorophyll retrievals below 0.25 mg m-3. For details refer
137- to https://doi.org/10.5067/JCQB8QALDOYD. Further references:
138-
139- Hu et al. (2019). Improving Satellite Global Chlorophyll a Data
140- Products Through Algorithm Refinement and Data Recovery. Journal
141- of Geophysical Research: Oceans, 124(3), 1524-1543.
142- https://doi.org/10.1029/2019JC014941.
143-
144- O'Reilly and Werdell (2019). Chlorophyll algorithms for ocean
145- color sensors - OC4, OC5 & OC6. Remote Sensing of Environment,
146- 229, 32-47. https://doi.org/10.1016/j.rse.2019.04.021.
147- """
109+ class OCI (ToM ):
110+ """NASA's ocean colour chlorophyll index (OCI) model function."""
148111
149112 def __init__ (self ):
113+ """Creates a new model function instance."""
114+
150115 def f (p , x ):
151- """
116+ r """
152117 The model function.
153118
154- :param p: The model parameters, shape (2,).
155- :param x: The ocean colour index.
156- :returns: The chlorophyll concentration.
119+ Let :math:`p = (a_0, a_1) \in \mathbb{R}^{2}` be the model
120+ parameters and let :math:`\lambda = (\lambda_\mathrm{b},
121+ \lambda_\mathrm{g}, \lambda_\mathrm{r}) \in \mathbb{R}^{3}`
122+ denote the central wavelengths of wavebands in the blue,
123+ green and red, respectively. Further let
124+
125+ .. math::
126+ x = (\lambda, R_\mathrm{rs}(\lambda))
127+ \in \mathbb{R}^{2 \times 3}
128+
129+ denote the function inputs. Then:
130+
131+ :param p: The parameters :math:`p \in \mathbb{R}^{2}`.
132+ :param x: The inputs :math:`x \in \mathbb{R}^{2 \times 3}`.
133+ :returns: The chlorophyll concentration (mg m-3).
157134 """
158135 a0 , a1 = p
159- return jnp .power (10.0 , a0 + a1 * x )
136+ b = x [0 , 0 ]
137+ g = x [1 , 0 ]
138+ r = x [2 , 0 ]
139+ B = x [1 , 0 ] # noqa: N806
140+ G = x [1 , 1 ] # noqa: N806
141+ R = x [1 , 2 ] # noqa: N806
142+ c = G - (B + (R - B ) * (g - b ) / (r - b ))
143+
144+ return jnp .power (10.0 , a0 + a1 * c )
160145
161146 super ().__init__ (f )
162147
@@ -176,17 +161,7 @@ class OCx(ToM, ABC):
176161
177162 Needs values of maximum common logarithm of remote sensing
178163 reflectance band ratios (:class:`Mbr`) as input. Used for
179- chlorophyll retrievals above 0.35 mg m-3. For details refer
180- to https://doi.org/10.5067/JCQB8QALDOYD. Further references:
181-
182- Hu et al. (2019). Improving Satellite Global Chlorophyll a Data
183- Products Through Algorithm Refinement and Data Recovery. Journal
184- of Geophysical Research: Oceans, 124(3), 1524-1543.
185- https://doi.org/10.1029/2019JC014941.
186-
187- O'Reilly and Werdell (2019). Chlorophyll algorithms for ocean
188- color sensors - OC4, OC5 & OC6. Remote Sensing of Environment,
189- 229, 32-47. https://doi.org/10.1016/j.rse.2019.04.021.
164+ chlorophyll retrievals above 0.35 mg m-3.
190165 """
191166
192167 n : Literal [2 , 3 , 4 , 5 , 6 ]
0 commit comments