jerlov 0.7.2__tar.gz → 0.7.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jerlov-0.7.2/jerlov.egg-info → jerlov-0.7.3}/PKG-INFO +3 -2
- {jerlov-0.7.2 → jerlov-0.7.3}/README.md +2 -1
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/__init__.py +1 -1
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/shortwave.py +22 -3
- {jerlov-0.7.2 → jerlov-0.7.3/jerlov.egg-info}/PKG-INFO +3 -2
- {jerlov-0.7.2 → jerlov-0.7.3}/pyproject.toml +1 -1
- {jerlov-0.7.2 → jerlov-0.7.3}/tests/test_shortwave.py +27 -3
- {jerlov-0.7.2 → jerlov-0.7.3}/LICENSE +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/NOTICE +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/_data.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/backscattering.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/colour.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/__init__.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/austin1986_kd.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/austin1986_model.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/boss2001_chi.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/cie1931_2deg_cmf.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/cie_d65.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/jerlov1968_kd.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/jerlov1968_total_irradiance.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/jerlov1976_kd.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/paulson1977_shortwave.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/petzold1972_stations.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/petzold1972_vsf.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/smart2007_b_from_c.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/solonenko2015_iop.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/williamson2022_aw.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/williamson2022_iop.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/williamson2022_measured.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/data/williamson2023_depth.csv +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/petzold.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/py.typed +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/scene.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/sources.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov/water.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov.egg-info/SOURCES.txt +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov.egg-info/dependency_links.txt +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov.egg-info/requires.txt +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/jerlov.egg-info/top_level.txt +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/setup.cfg +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/tests/test_api.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/tests/test_backscattering.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/tests/test_colour.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/tests/test_depth.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/tests/test_packaging.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/tests/test_petzold.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/tests/test_quoted_figures.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/tests/test_reproduces_papers.py +0 -0
- {jerlov-0.7.2 → jerlov-0.7.3}/tests/test_scene.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jerlov
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary: Inherent optical properties of Jerlov water types, with provenance
|
|
5
5
|
Author: T. Ishibashi
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -72,7 +72,8 @@ paper's own constant, so constants are attached to sources.
|
|
|
72
72
|
|
|
73
73
|
## What this package will not do
|
|
74
74
|
|
|
75
|
-
- **Extrapolate.** Asking for a wavelength outside the data raises.
|
|
75
|
+
- **Extrapolate.** Asking for a wavelength outside the data raises. Values
|
|
76
|
+
that a source itself extrapolated are returned, but marked, and they warn.
|
|
76
77
|
- **Fill a gap.** Where a published value is wrong and could not be
|
|
77
78
|
recovered, the value is NaN and stays NaN through interpolation.
|
|
78
79
|
- **Supply bb.** The backscattering coefficient is not determined by the
|
|
@@ -47,7 +47,8 @@ paper's own constant, so constants are attached to sources.
|
|
|
47
47
|
|
|
48
48
|
## What this package will not do
|
|
49
49
|
|
|
50
|
-
- **Extrapolate.** Asking for a wavelength outside the data raises.
|
|
50
|
+
- **Extrapolate.** Asking for a wavelength outside the data raises. Values
|
|
51
|
+
that a source itself extrapolated are returned, but marked, and they warn.
|
|
51
52
|
- **Fill a gap.** Where a published value is wrong and could not be
|
|
52
53
|
recovered, the value is NaN and stays NaN through interpolation.
|
|
53
54
|
- **Supply bb.** The backscattering coefficient is not determined by the
|
|
@@ -15,12 +15,13 @@ them from Jerlov (1968) Table XXI and reproduces R for every row.
|
|
|
15
15
|
|
|
16
16
|
from __future__ import annotations
|
|
17
17
|
|
|
18
|
+
import warnings
|
|
18
19
|
from dataclasses import dataclass
|
|
19
20
|
|
|
20
21
|
import numpy as np
|
|
21
22
|
|
|
22
23
|
from . import _data
|
|
23
|
-
from .water import _like_input, _require_number
|
|
24
|
+
from .water import ProvenanceWarning, _like_input, _require_number
|
|
24
25
|
|
|
25
26
|
CITATION = (
|
|
26
27
|
"Paulson, C. A. and Simpson, J. J. (1977), 'Irradiance measurements in "
|
|
@@ -42,15 +43,33 @@ class ShortwaveParameters:
|
|
|
42
43
|
zeta2_m: float
|
|
43
44
|
"""Attenuation length of the slow term, metres. Blue-green light."""
|
|
44
45
|
fit_depth_m: float | None
|
|
45
|
-
"""Depth
|
|
46
|
+
"""Depth the row was fitted down to: 100 m, or 50 m for ``I_upper50``.
|
|
47
|
+
The paper's text says so; the table does not. None for the rows that are
|
|
48
|
+
not Jerlov types."""
|
|
46
49
|
note: str
|
|
47
50
|
|
|
48
51
|
def fraction_at(self, depth_m):
|
|
49
|
-
"""``I(z)/I(0)`` at one or more depths.
|
|
52
|
+
"""``I(z)/I(0)`` at one or more depths.
|
|
53
|
+
|
|
54
|
+
Below :attr:`fit_depth_m` the two exponentials are extrapolated
|
|
55
|
+
beyond the data they were fitted to, and a
|
|
56
|
+
:class:`~jerlov.ProvenanceWarning` says so. Jerlov's own Table XXI
|
|
57
|
+
goes deeper for the clearer types; see
|
|
58
|
+
:func:`jerlov1968_solar_fraction`.
|
|
59
|
+
"""
|
|
50
60
|
z = np.atleast_1d(np.asarray(depth_m, dtype=float))
|
|
51
61
|
_require_number(z, "depth_m")
|
|
52
62
|
if np.any(z < 0):
|
|
53
63
|
raise ValueError("depth_m cannot be negative")
|
|
64
|
+
if self.fit_depth_m is not None and np.any(z > self.fit_depth_m):
|
|
65
|
+
warnings.warn(
|
|
66
|
+
f"{self.key}: Paulson & Simpson (1977) fitted these "
|
|
67
|
+
f"parameters to the upper {self.fit_depth_m:g} m; at "
|
|
68
|
+
f"{float(np.max(z)):g} m the two exponentials are "
|
|
69
|
+
"extrapolated. See DATA.md section 14.",
|
|
70
|
+
ProvenanceWarning,
|
|
71
|
+
stacklevel=_data.caller_stacklevel(),
|
|
72
|
+
)
|
|
54
73
|
out = (self.R * np.exp(-z / self.zeta1_m)
|
|
55
74
|
+ (1 - self.R) * np.exp(-z / self.zeta2_m))
|
|
56
75
|
return _like_input(out, depth_m)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jerlov
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary: Inherent optical properties of Jerlov water types, with provenance
|
|
5
5
|
Author: T. Ishibashi
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -72,7 +72,8 @@ paper's own constant, so constants are attached to sources.
|
|
|
72
72
|
|
|
73
73
|
## What this package will not do
|
|
74
74
|
|
|
75
|
-
- **Extrapolate.** Asking for a wavelength outside the data raises.
|
|
75
|
+
- **Extrapolate.** Asking for a wavelength outside the data raises. Values
|
|
76
|
+
that a source itself extrapolated are returned, but marked, and they warn.
|
|
76
77
|
- **Fill a gap.** Where a published value is wrong and could not be
|
|
77
78
|
recovered, the value is NaN and stays NaN through interpolation.
|
|
78
79
|
- **Supply bb.** The backscattering coefficient is not determined by the
|
|
@@ -84,9 +84,9 @@ def test_the_alternative_type_I_fit_is_reachable():
|
|
|
84
84
|
assert fifty.fit_depth_m == 50
|
|
85
85
|
assert fifty.water_type == "I"
|
|
86
86
|
assert fifty.R != hundred.R
|
|
87
|
-
# The paper gives it because the profile changes slope;
|
|
88
|
-
#
|
|
89
|
-
assert abs(fifty.fraction_at(
|
|
87
|
+
# The paper gives it because the profile changes slope; they must
|
|
88
|
+
# therefore disagree, even inside the 50 m both were fitted over.
|
|
89
|
+
assert abs(fifty.fraction_at(40.0) - hundred.fraction_at(40.0)) > 1e-4
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
def test_the_rows_that_are_not_water_types_are_not_offered():
|
|
@@ -130,3 +130,27 @@ def test_table_xxi_is_public():
|
|
|
130
130
|
assert len(jerlov.jerlov1968_solar_fraction(t)[0]) == 12
|
|
131
131
|
with pytest.raises(KeyError, match="known:"):
|
|
132
132
|
jerlov.jerlov1968_solar_fraction("IV")
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def test_below_the_fitted_depth_it_warns():
|
|
136
|
+
"""Paulson & Simpson fitted the upper 100 m, and 50 m for I_upper50."""
|
|
137
|
+
import warnings
|
|
138
|
+
|
|
139
|
+
with warnings.catch_warnings():
|
|
140
|
+
warnings.simplefilter("error")
|
|
141
|
+
jerlov.solar_fraction("IB", 100.0)
|
|
142
|
+
jerlov.shortwave_parameters("I_upper50").fraction_at([0.0, 50.0])
|
|
143
|
+
with pytest.warns(jerlov.ProvenanceWarning, match="upper 100 m"):
|
|
144
|
+
jerlov.solar_fraction("IB", 100.5)
|
|
145
|
+
with pytest.warns(jerlov.ProvenanceWarning, match="upper 50 m"):
|
|
146
|
+
jerlov.shortwave_parameters("I_upper50").fraction_at([10.0, 60.0])
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def test_rows_that_are_not_types_carry_no_fit_depth_and_do_not_warn():
|
|
150
|
+
import warnings
|
|
151
|
+
|
|
152
|
+
p = jerlov.shortwave_parameters("run_1", include_non_types=True)
|
|
153
|
+
assert p.fit_depth_m is None
|
|
154
|
+
with warnings.catch_warnings():
|
|
155
|
+
warnings.simplefilter("error")
|
|
156
|
+
p.fraction_at(150.0)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|