SCOPE-RTM 0.1.0__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.
- scope_rtm-0.1.0/PKG-INFO +219 -0
- scope_rtm-0.1.0/README.md +181 -0
- scope_rtm-0.1.0/pyproject.toml +65 -0
- scope_rtm-0.1.0/setup.cfg +4 -0
- scope_rtm-0.1.0/src/SCOPE_RTM.egg-info/PKG-INFO +219 -0
- scope_rtm-0.1.0/src/SCOPE_RTM.egg-info/SOURCES.txt +50 -0
- scope_rtm-0.1.0/src/SCOPE_RTM.egg-info/dependency_links.txt +1 -0
- scope_rtm-0.1.0/src/SCOPE_RTM.egg-info/entry_points.txt +3 -0
- scope_rtm-0.1.0/src/SCOPE_RTM.egg-info/requires.txt +21 -0
- scope_rtm-0.1.0/src/SCOPE_RTM.egg-info/top_level.txt +1 -0
- scope_rtm-0.1.0/src/scope/__init__.py +153 -0
- scope_rtm-0.1.0/src/scope/biochem/__init__.py +19 -0
- scope_rtm-0.1.0/src/scope/biochem/leaf.py +962 -0
- scope_rtm-0.1.0/src/scope/canopy/__init__.py +54 -0
- scope_rtm-0.1.0/src/scope/canopy/fluorescence.py +1404 -0
- scope_rtm-0.1.0/src/scope/canopy/foursail.py +595 -0
- scope_rtm-0.1.0/src/scope/canopy/layered_rt.py +333 -0
- scope_rtm-0.1.0/src/scope/canopy/reflectance.py +496 -0
- scope_rtm-0.1.0/src/scope/canopy/thermal.py +620 -0
- scope_rtm-0.1.0/src/scope/cli/__init__.py +3 -0
- scope_rtm-0.1.0/src/scope/cli/fetch_upstream.py +62 -0
- scope_rtm-0.1.0/src/scope/cli/prepare_scope_input.py +100 -0
- scope_rtm-0.1.0/src/scope/config.py +32 -0
- scope_rtm-0.1.0/src/scope/data/__init__.py +5 -0
- scope_rtm-0.1.0/src/scope/data/grid.py +113 -0
- scope_rtm-0.1.0/src/scope/energy/__init__.py +41 -0
- scope_rtm-0.1.0/src/scope/energy/balance.py +1232 -0
- scope_rtm-0.1.0/src/scope/energy/fluxes.py +241 -0
- scope_rtm-0.1.0/src/scope/io/__init__.py +29 -0
- scope_rtm-0.1.0/src/scope/io/export.py +169 -0
- scope_rtm-0.1.0/src/scope/io/prepare.py +406 -0
- scope_rtm-0.1.0/src/scope/runners/__init__.py +5 -0
- scope_rtm-0.1.0/src/scope/runners/grid.py +1714 -0
- scope_rtm-0.1.0/src/scope/spectral/__init__.py +23 -0
- scope_rtm-0.1.0/src/scope/spectral/fluspect.py +496 -0
- scope_rtm-0.1.0/src/scope/spectral/loaders.py +224 -0
- scope_rtm-0.1.0/src/scope/spectral/optics.py +33 -0
- scope_rtm-0.1.0/src/scope/spectral/soil.py +182 -0
- scope_rtm-0.1.0/tests/test_benchmark_summary_regression.py +199 -0
- scope_rtm-0.1.0/tests/test_cli_wrappers.py +43 -0
- scope_rtm-0.1.0/tests/test_compare_scope_benchmark.py +53 -0
- scope_rtm-0.1.0/tests/test_example_scripts.py +67 -0
- scope_rtm-0.1.0/tests/test_grid_data_module.py +61 -0
- scope_rtm-0.1.0/tests/test_kernel_execution_modes.py +284 -0
- scope_rtm-0.1.0/tests/test_netcdf_export.py +67 -0
- scope_rtm-0.1.0/tests/test_package_name.py +22 -0
- scope_rtm-0.1.0/tests/test_prepare_scope_input.py +198 -0
- scope_rtm-0.1.0/tests/test_scope_benchmark_parity.py +94 -0
- scope_rtm-0.1.0/tests/test_scope_benchmark_suite.py +190 -0
- scope_rtm-0.1.0/tests/test_scope_grid_runner.py +2261 -0
- scope_rtm-0.1.0/tests/test_scope_timeseries_benchmark_parity.py +56 -0
- scope_rtm-0.1.0/tests/test_scope_timeseries_benchmark_suite.py +163 -0
scope_rtm-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SCOPE-RTM
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: PyTorch reimplementation of the SCOPE radiative transfer model.
|
|
5
|
+
Author-email: Marc Yin <marc.yin@example.com>
|
|
6
|
+
License-Expression: GPL-3.0-only
|
|
7
|
+
Keywords: scope,radiative-transfer,remote-sensing,pytorch,fluorescence,thermal
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: torch>=2.2
|
|
21
|
+
Requires-Dist: numpy>=1.26
|
|
22
|
+
Requires-Dist: scipy>=1.11
|
|
23
|
+
Requires-Dist: xarray>=2024.1
|
|
24
|
+
Requires-Dist: rioxarray>=0.15
|
|
25
|
+
Requires-Dist: pandas>=2.2
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=8.1; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
29
|
+
Requires-Dist: prosail>=2.0; extra == "dev"
|
|
30
|
+
Requires-Dist: rich>=13.7; extra == "dev"
|
|
31
|
+
Provides-Extra: docs
|
|
32
|
+
Requires-Dist: mkdocs>=1.6; extra == "docs"
|
|
33
|
+
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
|
|
34
|
+
Requires-Dist: mkdocs-mermaid2-plugin>=1.2; extra == "docs"
|
|
35
|
+
Provides-Extra: release
|
|
36
|
+
Requires-Dist: build>=1.2; extra == "release"
|
|
37
|
+
Requires-Dist: twine>=5.1; extra == "release"
|
|
38
|
+
|
|
39
|
+
# SCOPE
|
|
40
|
+
|
|
41
|
+
PyTorch-first implementation of the SCOPE canopy radiative transfer model for reflectance, fluorescence, thermal radiance, and coupled energy-balance workflows.
|
|
42
|
+
|
|
43
|
+
## What It Is
|
|
44
|
+
|
|
45
|
+
`scope` is designed for users who need:
|
|
46
|
+
|
|
47
|
+
- asset-backed SCOPE physics in Python
|
|
48
|
+
- batched ROI/time execution on `xarray` datasets
|
|
49
|
+
- differentiable model components in PyTorch
|
|
50
|
+
- reproducible MATLAB parity checks in CI and local development
|
|
51
|
+
|
|
52
|
+
The current implementation supports:
|
|
53
|
+
|
|
54
|
+
- leaf optics through FLUSPECT
|
|
55
|
+
- canopy reflectance through 4SAIL-based transport
|
|
56
|
+
- layered fluorescence and thermal radiative transfer
|
|
57
|
+
- leaf biochemistry and coupled energy balance
|
|
58
|
+
- directional and vertical-profile outputs on the homogeneous canopy path
|
|
59
|
+
- ROI/time workflows with `xarray` input and output assembly
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
Published package name:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
python -m pip install SCOPE-RTM
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Import name:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
import scope
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 1. Clone the repository
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git clone <your-repo-url> scope
|
|
79
|
+
cd scope
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Fetch the pinned upstream SCOPE assets
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
python scripts/fetch_upstream_scope.py
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If you installed the package in an environment already, the same helper is available as:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
scope-fetch-upstream
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 3. Create an environment and install
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
python -m venv .venv
|
|
98
|
+
source .venv/bin/activate
|
|
99
|
+
python -m pip install --upgrade pip
|
|
100
|
+
python -m pip install -e ".[dev]"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 4. Verify the install
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
PYTHONPATH=src python examples/basic_scene_reflectance.py
|
|
107
|
+
PYTHONPATH=src python -m pytest -q tests/test_scope_benchmark_parity.py tests/test_scope_timeseries_benchmark_parity.py
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 5-Minute Quickstart
|
|
111
|
+
|
|
112
|
+
### Minimal scene reflectance run
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
PYTHONPATH=src python examples/basic_scene_reflectance.py
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Expected output:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"product": "reflectance",
|
|
123
|
+
"dims": {"y": 1, "x": 1, "time": 1, "wavelength": 2001},
|
|
124
|
+
"rsot_650nm": 0.047138178221010914,
|
|
125
|
+
"rsot_865nm": 0.4100649627325952,
|
|
126
|
+
"rsot_1600nm": 0.26994893328935227
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### High-level workflow run
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
PYTHONPATH=src python examples/scope_workflow_demo.py
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Expected output:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"product": "scope_workflow",
|
|
141
|
+
"components": [
|
|
142
|
+
"reflectance",
|
|
143
|
+
"reflectance_directional",
|
|
144
|
+
"reflectance_profile",
|
|
145
|
+
"fluorescence",
|
|
146
|
+
"fluorescence_directional",
|
|
147
|
+
"fluorescence_profile"
|
|
148
|
+
],
|
|
149
|
+
"rsot_650nm_t0": 0.04522854188089004,
|
|
150
|
+
"LoF_peak_t0": 1.985767010834904e-05,
|
|
151
|
+
"LoF_peak_wavelength_t0": 744.0
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Main Entry Points
|
|
156
|
+
|
|
157
|
+
For most users, the preferred entry points are:
|
|
158
|
+
|
|
159
|
+
- [`ScopeGridRunner.run_scope_dataset(...)`](src/scope/runners/grid.py)
|
|
160
|
+
High-level reflectance/fluorescence/thermal workflow dispatch from prepared `xarray` inputs.
|
|
161
|
+
- [`prepare_scope_input_dataset(...)`](src/scope/io/prepare.py)
|
|
162
|
+
Build a runner-ready dataset from weather, observation, and Sentinel-2 bio inputs.
|
|
163
|
+
- [`write_netcdf_dataset(...)`](src/scope/io/export.py)
|
|
164
|
+
Persist prepared or simulated outputs to NetCDF with safe backend selection and compression handling.
|
|
165
|
+
|
|
166
|
+
For direct lower-level use:
|
|
167
|
+
|
|
168
|
+
- [`FluspectModel`](src/scope/spectral/fluspect.py)
|
|
169
|
+
- [`CanopyReflectanceModel`](src/scope/canopy/reflectance.py)
|
|
170
|
+
- [`CanopyFluorescenceModel`](src/scope/canopy/fluorescence.py)
|
|
171
|
+
- [`CanopyThermalRadianceModel`](src/scope/canopy/thermal.py)
|
|
172
|
+
- [`CanopyEnergyBalanceModel`](src/scope/energy/balance.py)
|
|
173
|
+
|
|
174
|
+
## Documentation Map
|
|
175
|
+
|
|
176
|
+
- [Installation Guide](docs/installation.md)
|
|
177
|
+
- [Quickstart](docs/quickstart.md)
|
|
178
|
+
- [Model Mechanics](docs/model-mechanics.md)
|
|
179
|
+
- [Input / Output Reference](docs/input-output-reference.md)
|
|
180
|
+
- [Examples](docs/examples.md)
|
|
181
|
+
- [Production Notes](docs/production-notes.md)
|
|
182
|
+
- [Benchmark Policy](docs/benchmark-policy.md)
|
|
183
|
+
|
|
184
|
+
Build the docs locally with:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
python -m pip install -e ".[docs]"
|
|
188
|
+
mkdocs build --strict
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Production Notes
|
|
192
|
+
|
|
193
|
+
- Asset-backed constructors such as `from_scope_assets(...)` require an upstream SCOPE checkout. The recommended path is `scope-fetch-upstream`.
|
|
194
|
+
- The default CI suite runs parity tests in live-or-pregenerated mode. On machines without MATLAB, the tests compare against checked-in MATLAB fixtures.
|
|
195
|
+
- The self-hosted GPU and live-MATLAB lanes remain optional operational lanes; see [docs/benchmark-policy.md](docs/benchmark-policy.md).
|
|
196
|
+
- Documentation can be built locally with `mkdocs build --strict` and is deployed by the dedicated GitHub Pages workflow.
|
|
197
|
+
- Distribution artifacts can be built locally with `python -m build` and validated with `python -m twine check dist/*`.
|
|
198
|
+
|
|
199
|
+
## Testing
|
|
200
|
+
|
|
201
|
+
Run the default suite with:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
PYTHONPATH=src python -m pytest -q
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The strongest automated checks currently include:
|
|
208
|
+
|
|
209
|
+
- kernel parity and execution-mode regression tests
|
|
210
|
+
- ROI/time runner consistency tests
|
|
211
|
+
- committed scene and time-series benchmark summary regression tests
|
|
212
|
+
- live-or-pregenerated MATLAB parity tests for the single-scene and time-series benchmark gates
|
|
213
|
+
|
|
214
|
+
## Release Workflows
|
|
215
|
+
|
|
216
|
+
- `.github/workflows/release.yml`
|
|
217
|
+
Builds `sdist` and wheel artifacts for `SCOPE-RTM`, validates them with `twine check`, and auto-publishes to PyPI on version tags. Manual dispatch still supports TestPyPI or PyPI.
|
|
218
|
+
- `.github/workflows/docs.yml`
|
|
219
|
+
Builds the MkDocs site and deploys it to GitHub Pages.
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# SCOPE
|
|
2
|
+
|
|
3
|
+
PyTorch-first implementation of the SCOPE canopy radiative transfer model for reflectance, fluorescence, thermal radiance, and coupled energy-balance workflows.
|
|
4
|
+
|
|
5
|
+
## What It Is
|
|
6
|
+
|
|
7
|
+
`scope` is designed for users who need:
|
|
8
|
+
|
|
9
|
+
- asset-backed SCOPE physics in Python
|
|
10
|
+
- batched ROI/time execution on `xarray` datasets
|
|
11
|
+
- differentiable model components in PyTorch
|
|
12
|
+
- reproducible MATLAB parity checks in CI and local development
|
|
13
|
+
|
|
14
|
+
The current implementation supports:
|
|
15
|
+
|
|
16
|
+
- leaf optics through FLUSPECT
|
|
17
|
+
- canopy reflectance through 4SAIL-based transport
|
|
18
|
+
- layered fluorescence and thermal radiative transfer
|
|
19
|
+
- leaf biochemistry and coupled energy balance
|
|
20
|
+
- directional and vertical-profile outputs on the homogeneous canopy path
|
|
21
|
+
- ROI/time workflows with `xarray` input and output assembly
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
Published package name:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
python -m pip install SCOPE-RTM
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Import name:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import scope
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 1. Clone the repository
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone <your-repo-url> scope
|
|
41
|
+
cd scope
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. Fetch the pinned upstream SCOPE assets
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
python scripts/fetch_upstream_scope.py
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If you installed the package in an environment already, the same helper is available as:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
scope-fetch-upstream
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 3. Create an environment and install
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
python -m venv .venv
|
|
60
|
+
source .venv/bin/activate
|
|
61
|
+
python -m pip install --upgrade pip
|
|
62
|
+
python -m pip install -e ".[dev]"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 4. Verify the install
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
PYTHONPATH=src python examples/basic_scene_reflectance.py
|
|
69
|
+
PYTHONPATH=src python -m pytest -q tests/test_scope_benchmark_parity.py tests/test_scope_timeseries_benchmark_parity.py
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 5-Minute Quickstart
|
|
73
|
+
|
|
74
|
+
### Minimal scene reflectance run
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
PYTHONPATH=src python examples/basic_scene_reflectance.py
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Expected output:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"product": "reflectance",
|
|
85
|
+
"dims": {"y": 1, "x": 1, "time": 1, "wavelength": 2001},
|
|
86
|
+
"rsot_650nm": 0.047138178221010914,
|
|
87
|
+
"rsot_865nm": 0.4100649627325952,
|
|
88
|
+
"rsot_1600nm": 0.26994893328935227
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### High-level workflow run
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
PYTHONPATH=src python examples/scope_workflow_demo.py
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Expected output:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"product": "scope_workflow",
|
|
103
|
+
"components": [
|
|
104
|
+
"reflectance",
|
|
105
|
+
"reflectance_directional",
|
|
106
|
+
"reflectance_profile",
|
|
107
|
+
"fluorescence",
|
|
108
|
+
"fluorescence_directional",
|
|
109
|
+
"fluorescence_profile"
|
|
110
|
+
],
|
|
111
|
+
"rsot_650nm_t0": 0.04522854188089004,
|
|
112
|
+
"LoF_peak_t0": 1.985767010834904e-05,
|
|
113
|
+
"LoF_peak_wavelength_t0": 744.0
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Main Entry Points
|
|
118
|
+
|
|
119
|
+
For most users, the preferred entry points are:
|
|
120
|
+
|
|
121
|
+
- [`ScopeGridRunner.run_scope_dataset(...)`](src/scope/runners/grid.py)
|
|
122
|
+
High-level reflectance/fluorescence/thermal workflow dispatch from prepared `xarray` inputs.
|
|
123
|
+
- [`prepare_scope_input_dataset(...)`](src/scope/io/prepare.py)
|
|
124
|
+
Build a runner-ready dataset from weather, observation, and Sentinel-2 bio inputs.
|
|
125
|
+
- [`write_netcdf_dataset(...)`](src/scope/io/export.py)
|
|
126
|
+
Persist prepared or simulated outputs to NetCDF with safe backend selection and compression handling.
|
|
127
|
+
|
|
128
|
+
For direct lower-level use:
|
|
129
|
+
|
|
130
|
+
- [`FluspectModel`](src/scope/spectral/fluspect.py)
|
|
131
|
+
- [`CanopyReflectanceModel`](src/scope/canopy/reflectance.py)
|
|
132
|
+
- [`CanopyFluorescenceModel`](src/scope/canopy/fluorescence.py)
|
|
133
|
+
- [`CanopyThermalRadianceModel`](src/scope/canopy/thermal.py)
|
|
134
|
+
- [`CanopyEnergyBalanceModel`](src/scope/energy/balance.py)
|
|
135
|
+
|
|
136
|
+
## Documentation Map
|
|
137
|
+
|
|
138
|
+
- [Installation Guide](docs/installation.md)
|
|
139
|
+
- [Quickstart](docs/quickstart.md)
|
|
140
|
+
- [Model Mechanics](docs/model-mechanics.md)
|
|
141
|
+
- [Input / Output Reference](docs/input-output-reference.md)
|
|
142
|
+
- [Examples](docs/examples.md)
|
|
143
|
+
- [Production Notes](docs/production-notes.md)
|
|
144
|
+
- [Benchmark Policy](docs/benchmark-policy.md)
|
|
145
|
+
|
|
146
|
+
Build the docs locally with:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
python -m pip install -e ".[docs]"
|
|
150
|
+
mkdocs build --strict
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Production Notes
|
|
154
|
+
|
|
155
|
+
- Asset-backed constructors such as `from_scope_assets(...)` require an upstream SCOPE checkout. The recommended path is `scope-fetch-upstream`.
|
|
156
|
+
- The default CI suite runs parity tests in live-or-pregenerated mode. On machines without MATLAB, the tests compare against checked-in MATLAB fixtures.
|
|
157
|
+
- The self-hosted GPU and live-MATLAB lanes remain optional operational lanes; see [docs/benchmark-policy.md](docs/benchmark-policy.md).
|
|
158
|
+
- Documentation can be built locally with `mkdocs build --strict` and is deployed by the dedicated GitHub Pages workflow.
|
|
159
|
+
- Distribution artifacts can be built locally with `python -m build` and validated with `python -m twine check dist/*`.
|
|
160
|
+
|
|
161
|
+
## Testing
|
|
162
|
+
|
|
163
|
+
Run the default suite with:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
PYTHONPATH=src python -m pytest -q
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The strongest automated checks currently include:
|
|
170
|
+
|
|
171
|
+
- kernel parity and execution-mode regression tests
|
|
172
|
+
- ROI/time runner consistency tests
|
|
173
|
+
- committed scene and time-series benchmark summary regression tests
|
|
174
|
+
- live-or-pregenerated MATLAB parity tests for the single-scene and time-series benchmark gates
|
|
175
|
+
|
|
176
|
+
## Release Workflows
|
|
177
|
+
|
|
178
|
+
- `.github/workflows/release.yml`
|
|
179
|
+
Builds `sdist` and wheel artifacts for `SCOPE-RTM`, validates them with `twine check`, and auto-publishes to PyPI on version tags. Manual dispatch still supports TestPyPI or PyPI.
|
|
180
|
+
- `.github/workflows/docs.yml`
|
|
181
|
+
Builds the MkDocs site and deploys it to GitHub Pages.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "SCOPE-RTM"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "PyTorch reimplementation of the SCOPE radiative transfer model."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{name = "Marc Yin", email = "marc.yin@example.com"}]
|
|
11
|
+
license = "GPL-3.0-only"
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
keywords = ["scope", "radiative-transfer", "remote-sensing", "pytorch", "fluorescence", "thermal"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Science/Research",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Topic :: Scientific/Engineering",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Atmospheric Science",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"torch>=2.2",
|
|
28
|
+
"numpy>=1.26",
|
|
29
|
+
"scipy>=1.11",
|
|
30
|
+
"xarray>=2024.1",
|
|
31
|
+
"rioxarray>=0.15",
|
|
32
|
+
"pandas>=2.2"
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
scope-fetch-upstream = "scope.cli.fetch_upstream:main"
|
|
37
|
+
scope-prepare = "scope.cli.prepare_scope_input:main"
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
dev = [
|
|
41
|
+
"pytest>=8.1",
|
|
42
|
+
"pytest-cov>=4.1",
|
|
43
|
+
"prosail>=2.0",
|
|
44
|
+
"rich>=13.7"
|
|
45
|
+
]
|
|
46
|
+
docs = [
|
|
47
|
+
"mkdocs>=1.6",
|
|
48
|
+
"mkdocs-material>=9.5",
|
|
49
|
+
"mkdocs-mermaid2-plugin>=1.2"
|
|
50
|
+
]
|
|
51
|
+
release = [
|
|
52
|
+
"build>=1.2",
|
|
53
|
+
"twine>=5.1"
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[tool.setuptools]
|
|
57
|
+
package-dir = {"" = "src"}
|
|
58
|
+
|
|
59
|
+
[tool.setuptools.packages.find]
|
|
60
|
+
where = ["src"]
|
|
61
|
+
|
|
62
|
+
[tool.pytest.ini_options]
|
|
63
|
+
addopts = "-ra"
|
|
64
|
+
testpaths = ["tests"]
|
|
65
|
+
pythonpath = ["src"]
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SCOPE-RTM
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: PyTorch reimplementation of the SCOPE radiative transfer model.
|
|
5
|
+
Author-email: Marc Yin <marc.yin@example.com>
|
|
6
|
+
License-Expression: GPL-3.0-only
|
|
7
|
+
Keywords: scope,radiative-transfer,remote-sensing,pytorch,fluorescence,thermal
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: torch>=2.2
|
|
21
|
+
Requires-Dist: numpy>=1.26
|
|
22
|
+
Requires-Dist: scipy>=1.11
|
|
23
|
+
Requires-Dist: xarray>=2024.1
|
|
24
|
+
Requires-Dist: rioxarray>=0.15
|
|
25
|
+
Requires-Dist: pandas>=2.2
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=8.1; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
29
|
+
Requires-Dist: prosail>=2.0; extra == "dev"
|
|
30
|
+
Requires-Dist: rich>=13.7; extra == "dev"
|
|
31
|
+
Provides-Extra: docs
|
|
32
|
+
Requires-Dist: mkdocs>=1.6; extra == "docs"
|
|
33
|
+
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
|
|
34
|
+
Requires-Dist: mkdocs-mermaid2-plugin>=1.2; extra == "docs"
|
|
35
|
+
Provides-Extra: release
|
|
36
|
+
Requires-Dist: build>=1.2; extra == "release"
|
|
37
|
+
Requires-Dist: twine>=5.1; extra == "release"
|
|
38
|
+
|
|
39
|
+
# SCOPE
|
|
40
|
+
|
|
41
|
+
PyTorch-first implementation of the SCOPE canopy radiative transfer model for reflectance, fluorescence, thermal radiance, and coupled energy-balance workflows.
|
|
42
|
+
|
|
43
|
+
## What It Is
|
|
44
|
+
|
|
45
|
+
`scope` is designed for users who need:
|
|
46
|
+
|
|
47
|
+
- asset-backed SCOPE physics in Python
|
|
48
|
+
- batched ROI/time execution on `xarray` datasets
|
|
49
|
+
- differentiable model components in PyTorch
|
|
50
|
+
- reproducible MATLAB parity checks in CI and local development
|
|
51
|
+
|
|
52
|
+
The current implementation supports:
|
|
53
|
+
|
|
54
|
+
- leaf optics through FLUSPECT
|
|
55
|
+
- canopy reflectance through 4SAIL-based transport
|
|
56
|
+
- layered fluorescence and thermal radiative transfer
|
|
57
|
+
- leaf biochemistry and coupled energy balance
|
|
58
|
+
- directional and vertical-profile outputs on the homogeneous canopy path
|
|
59
|
+
- ROI/time workflows with `xarray` input and output assembly
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
Published package name:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
python -m pip install SCOPE-RTM
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Import name:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
import scope
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 1. Clone the repository
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git clone <your-repo-url> scope
|
|
79
|
+
cd scope
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Fetch the pinned upstream SCOPE assets
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
python scripts/fetch_upstream_scope.py
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If you installed the package in an environment already, the same helper is available as:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
scope-fetch-upstream
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 3. Create an environment and install
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
python -m venv .venv
|
|
98
|
+
source .venv/bin/activate
|
|
99
|
+
python -m pip install --upgrade pip
|
|
100
|
+
python -m pip install -e ".[dev]"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 4. Verify the install
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
PYTHONPATH=src python examples/basic_scene_reflectance.py
|
|
107
|
+
PYTHONPATH=src python -m pytest -q tests/test_scope_benchmark_parity.py tests/test_scope_timeseries_benchmark_parity.py
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 5-Minute Quickstart
|
|
111
|
+
|
|
112
|
+
### Minimal scene reflectance run
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
PYTHONPATH=src python examples/basic_scene_reflectance.py
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Expected output:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"product": "reflectance",
|
|
123
|
+
"dims": {"y": 1, "x": 1, "time": 1, "wavelength": 2001},
|
|
124
|
+
"rsot_650nm": 0.047138178221010914,
|
|
125
|
+
"rsot_865nm": 0.4100649627325952,
|
|
126
|
+
"rsot_1600nm": 0.26994893328935227
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### High-level workflow run
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
PYTHONPATH=src python examples/scope_workflow_demo.py
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Expected output:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"product": "scope_workflow",
|
|
141
|
+
"components": [
|
|
142
|
+
"reflectance",
|
|
143
|
+
"reflectance_directional",
|
|
144
|
+
"reflectance_profile",
|
|
145
|
+
"fluorescence",
|
|
146
|
+
"fluorescence_directional",
|
|
147
|
+
"fluorescence_profile"
|
|
148
|
+
],
|
|
149
|
+
"rsot_650nm_t0": 0.04522854188089004,
|
|
150
|
+
"LoF_peak_t0": 1.985767010834904e-05,
|
|
151
|
+
"LoF_peak_wavelength_t0": 744.0
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Main Entry Points
|
|
156
|
+
|
|
157
|
+
For most users, the preferred entry points are:
|
|
158
|
+
|
|
159
|
+
- [`ScopeGridRunner.run_scope_dataset(...)`](src/scope/runners/grid.py)
|
|
160
|
+
High-level reflectance/fluorescence/thermal workflow dispatch from prepared `xarray` inputs.
|
|
161
|
+
- [`prepare_scope_input_dataset(...)`](src/scope/io/prepare.py)
|
|
162
|
+
Build a runner-ready dataset from weather, observation, and Sentinel-2 bio inputs.
|
|
163
|
+
- [`write_netcdf_dataset(...)`](src/scope/io/export.py)
|
|
164
|
+
Persist prepared or simulated outputs to NetCDF with safe backend selection and compression handling.
|
|
165
|
+
|
|
166
|
+
For direct lower-level use:
|
|
167
|
+
|
|
168
|
+
- [`FluspectModel`](src/scope/spectral/fluspect.py)
|
|
169
|
+
- [`CanopyReflectanceModel`](src/scope/canopy/reflectance.py)
|
|
170
|
+
- [`CanopyFluorescenceModel`](src/scope/canopy/fluorescence.py)
|
|
171
|
+
- [`CanopyThermalRadianceModel`](src/scope/canopy/thermal.py)
|
|
172
|
+
- [`CanopyEnergyBalanceModel`](src/scope/energy/balance.py)
|
|
173
|
+
|
|
174
|
+
## Documentation Map
|
|
175
|
+
|
|
176
|
+
- [Installation Guide](docs/installation.md)
|
|
177
|
+
- [Quickstart](docs/quickstart.md)
|
|
178
|
+
- [Model Mechanics](docs/model-mechanics.md)
|
|
179
|
+
- [Input / Output Reference](docs/input-output-reference.md)
|
|
180
|
+
- [Examples](docs/examples.md)
|
|
181
|
+
- [Production Notes](docs/production-notes.md)
|
|
182
|
+
- [Benchmark Policy](docs/benchmark-policy.md)
|
|
183
|
+
|
|
184
|
+
Build the docs locally with:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
python -m pip install -e ".[docs]"
|
|
188
|
+
mkdocs build --strict
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Production Notes
|
|
192
|
+
|
|
193
|
+
- Asset-backed constructors such as `from_scope_assets(...)` require an upstream SCOPE checkout. The recommended path is `scope-fetch-upstream`.
|
|
194
|
+
- The default CI suite runs parity tests in live-or-pregenerated mode. On machines without MATLAB, the tests compare against checked-in MATLAB fixtures.
|
|
195
|
+
- The self-hosted GPU and live-MATLAB lanes remain optional operational lanes; see [docs/benchmark-policy.md](docs/benchmark-policy.md).
|
|
196
|
+
- Documentation can be built locally with `mkdocs build --strict` and is deployed by the dedicated GitHub Pages workflow.
|
|
197
|
+
- Distribution artifacts can be built locally with `python -m build` and validated with `python -m twine check dist/*`.
|
|
198
|
+
|
|
199
|
+
## Testing
|
|
200
|
+
|
|
201
|
+
Run the default suite with:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
PYTHONPATH=src python -m pytest -q
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The strongest automated checks currently include:
|
|
208
|
+
|
|
209
|
+
- kernel parity and execution-mode regression tests
|
|
210
|
+
- ROI/time runner consistency tests
|
|
211
|
+
- committed scene and time-series benchmark summary regression tests
|
|
212
|
+
- live-or-pregenerated MATLAB parity tests for the single-scene and time-series benchmark gates
|
|
213
|
+
|
|
214
|
+
## Release Workflows
|
|
215
|
+
|
|
216
|
+
- `.github/workflows/release.yml`
|
|
217
|
+
Builds `sdist` and wheel artifacts for `SCOPE-RTM`, validates them with `twine check`, and auto-publishes to PyPI on version tags. Manual dispatch still supports TestPyPI or PyPI.
|
|
218
|
+
- `.github/workflows/docs.yml`
|
|
219
|
+
Builds the MkDocs site and deploys it to GitHub Pages.
|