sarssm 1.0.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.
- sarssm-1.0.0/LICENSE +21 -0
- sarssm-1.0.0/PKG-INFO +77 -0
- sarssm-1.0.0/README.md +62 -0
- sarssm-1.0.0/pyproject.toml +30 -0
- sarssm-1.0.0/setup.cfg +4 -0
- sarssm-1.0.0/src/sarssm/__init__.py +9 -0
- sarssm-1.0.0/src/sarssm/common.py +23 -0
- sarssm-1.0.0/src/sarssm/conversion/__init__.py +0 -0
- sarssm-1.0.0/src/sarssm/conversion/hallikainen1985.py +85 -0
- sarssm-1.0.0/src/sarssm/conversion/topp1980.py +19 -0
- sarssm-1.0.0/src/sarssm/conversion/ulaby1987.py +30 -0
- sarssm-1.0.0/src/sarssm/conversion/ulaby1987_plots.py +36 -0
- sarssm-1.0.0/src/sarssm/decomposition/__init__.py +0 -0
- sarssm-1.0.0/src/sarssm/decomposition/cloude1996.py +39 -0
- sarssm-1.0.0/src/sarssm/insar/__init__.py +0 -0
- sarssm-1.0.0/src/sarssm/insar/dezan2014.py +183 -0
- sarssm-1.0.0/src/sarssm/insar/dezan2014inversion.py +132 -0
- sarssm-1.0.0/src/sarssm/polsar/__init__.py +0 -0
- sarssm-1.0.0/src/sarssm/polsar/hajnsek2003.py +148 -0
- sarssm-1.0.0/src/sarssm/polsar/hajnsek2003_plots.py +114 -0
- sarssm-1.0.0/src/sarssm.egg-info/PKG-INFO +77 -0
- sarssm-1.0.0/src/sarssm.egg-info/SOURCES.txt +23 -0
- sarssm-1.0.0/src/sarssm.egg-info/dependency_links.txt +1 -0
- sarssm-1.0.0/src/sarssm.egg-info/requires.txt +4 -0
- sarssm-1.0.0/src/sarssm.egg-info/top_level.txt +1 -0
sarssm-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Nikita Basargin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
sarssm-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sarssm
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Selected algorithms for surface soil moisture (SSM) estimation from SAR data
|
|
5
|
+
Author-email: Nikita Basargin <nikita.basargin@dlr.de>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy
|
|
11
|
+
Requires-Dist: torch
|
|
12
|
+
Requires-Dist: scipy
|
|
13
|
+
Requires-Dist: matplotlib
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# SAR SSM package
|
|
17
|
+
|
|
18
|
+
Selected algorithms for surface soil moisture (SSM) estimation from SAR data.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Installation (editable mode)
|
|
22
|
+
|
|
23
|
+
- clone this repository
|
|
24
|
+
- activate a virtual environment (e.g. conda)
|
|
25
|
+
- install this package (in editable mode) with `pip install -e ./sarssm/`
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## List of relevant papers
|
|
29
|
+
The code is based on the following papers.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Dielectrics to Moisture Conversion
|
|
33
|
+
```
|
|
34
|
+
M. T. Hallikainen, F. T. Ulaby, M. C. Dobson, M. A. El-rayes and L.-k. Wu
|
|
35
|
+
Microwave Dielectric Behavior of Wet Soil-Part 1: Empirical Models and Experimental Observations
|
|
36
|
+
IEEE Transactions on Geoscience and Remote Sensing, 1985
|
|
37
|
+
DOI: 10.1109/TGRS.1985.289497
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
G. C. Topp, J. L. Davis, A. P. Annan
|
|
42
|
+
Electromagnetic determination of soil water content: Measurements in coaxial transmission lines
|
|
43
|
+
Water Resources Research, 1980
|
|
44
|
+
DOI: 10.1029/WR016i003p00574
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Fawwaz T. Ulaby and Mohamed A. El-Rayes
|
|
49
|
+
Microwave Dielectric Spectrum of Vegetation Part II: Dual-Dispersion Model
|
|
50
|
+
IEEE Transactions on Geoscience and Remote Sensing, September 1987
|
|
51
|
+
DOI: 10.1109/TGRS.1987.289833
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### PolSAR
|
|
56
|
+
```
|
|
57
|
+
I. Hajnsek, E. Pottier and S. R. Cloude
|
|
58
|
+
Inversion of surface parameters from polarimetric SAR
|
|
59
|
+
IEEE Transactions on Geoscience and Remote Sensing, April 2003
|
|
60
|
+
DOI: 10.1109/TGRS.2003.810702
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
S. R. Cloude and E. Pottier
|
|
65
|
+
A review of target decomposition theorems in radar polarimetry
|
|
66
|
+
IEEE Transactions on Geoscience and Remote Sensing, 1996
|
|
67
|
+
DOI: 10.1109/36.485127
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### InSAR
|
|
72
|
+
```
|
|
73
|
+
F. De Zan, A. Parizzi, P. Prats-Iraola and P. López-Dekker
|
|
74
|
+
A SAR Interferometric Model for Soil Moisture
|
|
75
|
+
IEEE Transactions on Geoscience and Remote Sensing, Jan. 2014
|
|
76
|
+
DOI: 10.1109/TGRS.2013.2241069.
|
|
77
|
+
```
|
sarssm-1.0.0/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# SAR SSM package
|
|
2
|
+
|
|
3
|
+
Selected algorithms for surface soil moisture (SSM) estimation from SAR data.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Installation (editable mode)
|
|
7
|
+
|
|
8
|
+
- clone this repository
|
|
9
|
+
- activate a virtual environment (e.g. conda)
|
|
10
|
+
- install this package (in editable mode) with `pip install -e ./sarssm/`
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## List of relevant papers
|
|
14
|
+
The code is based on the following papers.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Dielectrics to Moisture Conversion
|
|
18
|
+
```
|
|
19
|
+
M. T. Hallikainen, F. T. Ulaby, M. C. Dobson, M. A. El-rayes and L.-k. Wu
|
|
20
|
+
Microwave Dielectric Behavior of Wet Soil-Part 1: Empirical Models and Experimental Observations
|
|
21
|
+
IEEE Transactions on Geoscience and Remote Sensing, 1985
|
|
22
|
+
DOI: 10.1109/TGRS.1985.289497
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
G. C. Topp, J. L. Davis, A. P. Annan
|
|
27
|
+
Electromagnetic determination of soil water content: Measurements in coaxial transmission lines
|
|
28
|
+
Water Resources Research, 1980
|
|
29
|
+
DOI: 10.1029/WR016i003p00574
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Fawwaz T. Ulaby and Mohamed A. El-Rayes
|
|
34
|
+
Microwave Dielectric Spectrum of Vegetation Part II: Dual-Dispersion Model
|
|
35
|
+
IEEE Transactions on Geoscience and Remote Sensing, September 1987
|
|
36
|
+
DOI: 10.1109/TGRS.1987.289833
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### PolSAR
|
|
41
|
+
```
|
|
42
|
+
I. Hajnsek, E. Pottier and S. R. Cloude
|
|
43
|
+
Inversion of surface parameters from polarimetric SAR
|
|
44
|
+
IEEE Transactions on Geoscience and Remote Sensing, April 2003
|
|
45
|
+
DOI: 10.1109/TGRS.2003.810702
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
S. R. Cloude and E. Pottier
|
|
50
|
+
A review of target decomposition theorems in radar polarimetry
|
|
51
|
+
IEEE Transactions on Geoscience and Remote Sensing, 1996
|
|
52
|
+
DOI: 10.1109/36.485127
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### InSAR
|
|
57
|
+
```
|
|
58
|
+
F. De Zan, A. Parizzi, P. Prats-Iraola and P. López-Dekker
|
|
59
|
+
A SAR Interferometric Model for Soil Moisture
|
|
60
|
+
IEEE Transactions on Geoscience and Remote Sensing, Jan. 2014
|
|
61
|
+
DOI: 10.1109/TGRS.2013.2241069.
|
|
62
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=42"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sarssm"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"numpy",
|
|
10
|
+
"torch",
|
|
11
|
+
"scipy",
|
|
12
|
+
"matplotlib",
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
|
|
16
|
+
license = {text = "MIT"}
|
|
17
|
+
description = "Selected algorithms for surface soil moisture (SSM) estimation from SAR data"
|
|
18
|
+
authors = [
|
|
19
|
+
{name = "Nikita Basargin", email = "nikita.basargin@dlr.de"},
|
|
20
|
+
]
|
|
21
|
+
readme = "README.md"
|
|
22
|
+
|
|
23
|
+
[tool.setuptools]
|
|
24
|
+
package-dir = {"" = "src"}
|
|
25
|
+
|
|
26
|
+
[tool.ruff]
|
|
27
|
+
line-length = 120
|
|
28
|
+
|
|
29
|
+
[tool.ruff.format]
|
|
30
|
+
line-ending = "lf"
|
sarssm-1.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Re-exporting internal functionality
|
|
2
|
+
from .decomposition.cloude1996 import h_a_alpha_decomposition
|
|
3
|
+
from .conversion.topp1980 import eps_to_moisture_topp
|
|
4
|
+
from .conversion.hallikainen1985 import moisture_to_eps_hallikainen
|
|
5
|
+
from .conversion.ulaby1987 import corn_moisture_to_eps_ulaby
|
|
6
|
+
from .polsar.hajnsek2003 import xbragg_model, coherency_matrix_to_xbragg_eps
|
|
7
|
+
from .insar.dezan2014 import Dezan2014InSARMoistureModel, moisture_to_insar_coherence, moisture_to_insar_phase_triplet
|
|
8
|
+
from .insar.dezan2014inversion import slc_to_insar_parameters, insar_parameters_to_moisture
|
|
9
|
+
from .common import complex_coherence
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Common functions, helpers, and utilities.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
from scipy.ndimage import uniform_filter
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _multilook(img, window_size):
|
|
10
|
+
return uniform_filter(img, window_size, mode="constant", cval=0)
|
|
11
|
+
|
|
12
|
+
def _abs_squared(img):
|
|
13
|
+
return img.real**2 + img.imag**2 # equivalent to np.abs(img) ** 2
|
|
14
|
+
|
|
15
|
+
def complex_coherence(img_1, img_2, window_size):
|
|
16
|
+
"""
|
|
17
|
+
Estimate the complex coherence of two complex images.
|
|
18
|
+
Window size can either be a single number or a tuple with two numbers.
|
|
19
|
+
"""
|
|
20
|
+
interferogram = _multilook(img_1 * np.conj(img_2), window_size)
|
|
21
|
+
abs_sqr_img_1 = _multilook(_abs_squared(img_1), window_size)
|
|
22
|
+
abs_sqr_img_2 = _multilook(_abs_squared(img_2), window_size)
|
|
23
|
+
return interferogram / np.sqrt(abs_sqr_img_1 * abs_sqr_img_2)
|
|
File without changes
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Conversion from the soil moisture to the complex-valued relative dielectric constant.
|
|
3
|
+
The soil texture (sand, silt, clay content) and the microwave frequency are taken into account.
|
|
4
|
+
|
|
5
|
+
M. T. Hallikainen, F. T. Ulaby, M. C. Dobson, M. A. El-rayes and L.-k. Wu
|
|
6
|
+
Microwave Dielectric Behavior of Wet Soil-Part 1: Empirical Models and Experimental Observations
|
|
7
|
+
IEEE Transactions on Geoscience and Remote Sensing, 1985
|
|
8
|
+
DOI: 10.1109/TGRS.1985.289497
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def moisture_to_eps_hallikainen(mv, sand, clay, frequency):
|
|
13
|
+
"""
|
|
14
|
+
Conversion from the soil moisture to the complex-valued relative dielectric constant.
|
|
15
|
+
The soil texture (sand, silt, clay content) and the microwave frequency are taken into account.
|
|
16
|
+
The empirical Hallikainen model provides conversion for specific microwave frequencies:
|
|
17
|
+
1.4 GHz (L-band), 4 GHz (S-band), 6 GHz (C-band), 8 GHz, 10 GHz (X-band), 12 GHz, 14 GHz, 16 GHz, and 18 GHz.
|
|
18
|
+
For the conversion, the closest available frequency is used.
|
|
19
|
+
Parameters:
|
|
20
|
+
mv - volumetric soil moisture (value range 0 to 1)
|
|
21
|
+
sand - sand textural component, in percent (value range 0 to 100)
|
|
22
|
+
clay - clay textural component, in percent (value range 0 to 100)
|
|
23
|
+
frequency - frequency in Hz, (allowed value range 1e9 to 20e9)
|
|
24
|
+
Returns:
|
|
25
|
+
complex-valued relative dielectric constant, the imaginary part is negative
|
|
26
|
+
"""
|
|
27
|
+
# find the closest available frequency
|
|
28
|
+
if 1_000_000_000 <= frequency < 2_700_000_000:
|
|
29
|
+
frequency = 1_400_000_000 # L-band - F-SAR: 1.325 GHz; ALOS PALSAR: 1.27 GHz
|
|
30
|
+
elif 2_700_000_000 <= frequency < 5_000_000_000:
|
|
31
|
+
frequency = 4_000_000_000 # S-band - F-SAR: 3.25 GHz;
|
|
32
|
+
elif 5_000_000_000 <= frequency < 7_000_000_000:
|
|
33
|
+
frequency = 6_000_000_000 # C-band - F-SAR: 5.3 GHz; Sentinel-1: 5.405 GHz
|
|
34
|
+
elif 7_000_000_000 <= frequency < 9_000_000_000:
|
|
35
|
+
frequency = 8_000_000_000
|
|
36
|
+
elif 9_000_000_000 <= frequency < 11_000_000_000:
|
|
37
|
+
frequency = 10_000_000_000 # X-band - F-SAR: 9.6 GHz; TerraSAR-X: 9.65 GHz
|
|
38
|
+
elif 11_000_000_000 <= frequency < 13_000_000_000:
|
|
39
|
+
frequency = 12_000_000_000
|
|
40
|
+
elif 13_000_000_000 <= frequency < 15_000_000_000:
|
|
41
|
+
frequency = 14_000_000_000
|
|
42
|
+
elif 15_000_000_000 <= frequency < 17_000_000_000:
|
|
43
|
+
frequency = 16_000_000_000
|
|
44
|
+
elif 17_000_000_000 <= frequency <= 20_000_000_000:
|
|
45
|
+
frequency = 18_000_000_000
|
|
46
|
+
else:
|
|
47
|
+
raise ValueError("Frequency must be between 1 and 20 GHz")
|
|
48
|
+
# real coefficients: (a_0, a_1, a_2, b_0, b_1, b_2, c_0, c_1, c_2)
|
|
49
|
+
real_coeff = {
|
|
50
|
+
1_400_000_000: (2.862, -0.012, 0.001, 3.803, 0.462, -0.341, 119.006, -0.500, 0.633),
|
|
51
|
+
4_000_000_000: (2.927, -0.012, -0.001, 5.505, 0.371, 0.062, 114.826, -0.389, -0.547),
|
|
52
|
+
6_000_000_000: (1.993, 0.002, 0.015, 38.086, -0.176, -0.633, 10.720, 1.256, 1.522),
|
|
53
|
+
8_000_000_000: (1.997, 0.002, 0.018, 25.579, -0.017, -0.412, 39.793, 0.723, 0.941),
|
|
54
|
+
10_000_000_000: (2.502, -0.003, -0.003, 10.101, 0.221, -0.004, 77.482, -0.061, -0.135),
|
|
55
|
+
12_000_000_000: (2.200, -0.001, 0.012, 26.473, 0.013, -0.523, 34.333, 0.284, 1.062),
|
|
56
|
+
14_000_000_000: (2.301, 0.001, 0.009, 17.918, 0.084, -0.282, 50.149, 0.012, 0.387),
|
|
57
|
+
16_000_000_000: (2.237, 0.002, 0.009, 15.505, 0.076, -0.217, 48.260, 0.168, 0.289),
|
|
58
|
+
18_000_000_000: (1.912, 0.007, 0.021, 29.123, -0.190, -0.545, 6.960, 0.822, 1.195),
|
|
59
|
+
}
|
|
60
|
+
# imag coefficients: (x_0, x_1, x_2, y_0, y_1, y_2, z_0, z_1, z_2)
|
|
61
|
+
imag_coeff = {
|
|
62
|
+
1_400_000_000: (0.356, -0.003, -0.008, 5.507, 0.044, -0.002, 17.753, -0.313, 0.206),
|
|
63
|
+
4_000_000_000: (0.004, 0.001, 0.002, 0.951, 0.005, -0.010, 16.759, 0.192, 0.290),
|
|
64
|
+
6_000_000_000: (-0.123, 0.002, 0.003, 7.502, -0.058, -0.116, 2.942, 0.452, 0.543),
|
|
65
|
+
8_000_000_000: (-0.201, 0.003, 0.003, 11.266, -0.085, -0.155, 0.194, 0.584, 0.581),
|
|
66
|
+
10_000_000_000: (-0.070, 0.000, 0.001, 6.620, 0.015, -0.081, 21.578, 0.293, 0.332),
|
|
67
|
+
12_000_000_000: (-0.142, 0.001, 0.003, 11.868, -0.059, -0.225, 7.817, 0.570, 0.801),
|
|
68
|
+
14_000_000_000: (-0.096, 0.001, 0.002, 8.583, -0.005, -0.153, 28.707, 0.297, 0.357),
|
|
69
|
+
16_000_000_000: (-0.027, -0.001, 0.003, 6.179, 0.074, -0.086, 34.126, 0.143, 0.206),
|
|
70
|
+
18_000_000_000: (-0.071, 0.000, 0.003, 6.938, 0.029, -0.128, 29.945, 0.275, 0.377),
|
|
71
|
+
}
|
|
72
|
+
# convert moisture to complex dielectrics
|
|
73
|
+
a_0, a_1, a_2, b_0, b_1, b_2, c_0, c_1, c_2 = real_coeff[frequency]
|
|
74
|
+
eps_real = (
|
|
75
|
+
(a_0 + a_1 * sand + a_2 * clay)
|
|
76
|
+
+ (b_0 + b_1 * sand + b_2 * clay) * mv
|
|
77
|
+
+ (c_0 + c_1 * sand + c_2 * clay) * (mv**2)
|
|
78
|
+
)
|
|
79
|
+
x_0, x_1, x_2, y_0, y_1, y_2, z_0, z_1, z_2 = imag_coeff[frequency]
|
|
80
|
+
eps_imag = (
|
|
81
|
+
(x_0 + x_1 * sand + x_2 * clay)
|
|
82
|
+
+ (y_0 + y_1 * sand + y_2 * clay) * mv
|
|
83
|
+
+ (z_0 + z_1 * sand + z_2 * clay) * (mv**2)
|
|
84
|
+
)
|
|
85
|
+
return eps_real - 1j * eps_imag
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Conversion from the relative dielectric constant to soil moisture.
|
|
3
|
+
|
|
4
|
+
G. C. Topp, J. L. Davis, A. P. Annan
|
|
5
|
+
Electromagnetic determination of soil water content: Measurements in coaxial transmission lines
|
|
6
|
+
Water Resources Research, 1980
|
|
7
|
+
DOI: 10.1029/WR016i003p00574
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def eps_to_moisture_topp(eps_r):
|
|
12
|
+
"""
|
|
13
|
+
Conversion from the relative dielectric constant to soil moisture.
|
|
14
|
+
Parameters:
|
|
15
|
+
eps_r: relative dielectric constant of the soil (typically the real part), valid values range from 2 to about 50
|
|
16
|
+
Returns:
|
|
17
|
+
volumetric soil moisture vith values ranging between 0 (0%) and 1 (100%).
|
|
18
|
+
"""
|
|
19
|
+
return -5.3e-2 + 2.92e-2 * eps_r - 5.5e-4 * eps_r**2 + 4.3e-6 * eps_r**3
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Conversion from the gravimetric moisture of corn leaves to the complex relative dielectric constant.
|
|
3
|
+
|
|
4
|
+
Fawwaz T. Ulaby and Mohamed A. El-Rayes
|
|
5
|
+
Microwave Dielectric Spectrum of Vegetation Part II: Dual-Dispersion Model
|
|
6
|
+
IEEE Transactions on Geoscience and Remote Sensing, September 1987
|
|
7
|
+
DOI: 10.1109/TGRS.1987.289833
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def corn_moisture_to_eps_ulaby(m_g, frequency):
|
|
12
|
+
"""
|
|
13
|
+
m_g: gravimetric moisture content of corn leaves, the model is valid for values in [0.05, 0.7]
|
|
14
|
+
frequency_ghz: frequency in Hz
|
|
15
|
+
"""
|
|
16
|
+
frequency_ghz = frequency * 1e-9
|
|
17
|
+
# equation (17): ionic conductivity of the aqueous solution (in siemens per meter)
|
|
18
|
+
sigma = 1.27
|
|
19
|
+
# equation (2): dielectric constant of free water, salinity below 0.01, room temperature (22°C)
|
|
20
|
+
eps_f = 4.9 + 75 / (1 + 1j * frequency_ghz / 18) - 1j * 18 * sigma / frequency_ghz
|
|
21
|
+
# equation (8): dielectric constant of the bulk vegetation-bound water mixture
|
|
22
|
+
eps_b = 2.9 + 55 / (1 + (1j * frequency_ghz / 0.18) ** 0.5)
|
|
23
|
+
# equation (14): nondispersive residual dielectrics
|
|
24
|
+
eps_r = 1.7 - 0.74 * m_g + 6.16 * m_g**2
|
|
25
|
+
# equation (15): volume fraction of free water
|
|
26
|
+
v_fw = m_g * (0.55 * m_g - 0.076)
|
|
27
|
+
# equation (16): volume fraction of the bulk vegetation-bound water mixture
|
|
28
|
+
v_b = 4.64 * m_g**2 / (1 + 7.36 * m_g**2)
|
|
29
|
+
# equation (9) / (10): plant dielectrics as sum of three components (residual + free water + bound water)
|
|
30
|
+
return eps_r + v_fw * eps_f + v_b * eps_b
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Additional plots for the Ulaby model (see ulaby1987.py).
|
|
3
|
+
|
|
4
|
+
Run with `python -m sarssm.conversion.ulaby1987_plots`.
|
|
5
|
+
Plots are saved to the `./sarssm_plots/ulaby1987_plots` folder,
|
|
6
|
+
in the current working directory, the folder is created if it does not exist.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
import pathlib
|
|
11
|
+
import matplotlib.pyplot as plt
|
|
12
|
+
from sarssm.conversion import ulaby1987
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def plot_corn_dielectrics_ulaby():
|
|
16
|
+
out_folder = pathlib.Path("./sarssm_plots/ulaby1987_plots")
|
|
17
|
+
out_folder.mkdir(parents=True, exist_ok=True)
|
|
18
|
+
m_g = np.linspace(0.05, 0.7, 100)
|
|
19
|
+
for band, frequency_hz in [("X", 9.6e9), ("C", 5.3e9), ("L", 1.325e9)]:
|
|
20
|
+
eps = ulaby1987.corn_moisture_to_eps_ulaby(m_g, frequency_hz)
|
|
21
|
+
fig, ax = plt.subplots(figsize=(5, 7))
|
|
22
|
+
ax.set_title(f"Corn leaf dielectrics, Ulaby model\n{band}-band, {frequency_hz * 1e-9:.3f} GHz")
|
|
23
|
+
ax.plot(m_g, eps.real, label="real")
|
|
24
|
+
ax.plot(m_g, np.abs(eps.imag), label="|imag|")
|
|
25
|
+
ax.set_xlabel("Gravimetric moisture")
|
|
26
|
+
ax.set_ylabel("Dielectric constant")
|
|
27
|
+
ax.set_xlim(0.05, 0.7)
|
|
28
|
+
ax.set_ylim(0, 35)
|
|
29
|
+
ax.legend()
|
|
30
|
+
ax.grid()
|
|
31
|
+
fig.savefig(out_folder / f"ulaby_corn_dielectrics_{band}_band.png", dpi=400)
|
|
32
|
+
plt.close("all")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
plot_corn_dielectrics_ulaby()
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Entropy/Anisotropy/Alpha (H/A/alpha) decomposition of a 3x3 polarimetric coherency matrix.
|
|
3
|
+
|
|
4
|
+
S. R. Cloude and E. Pottier
|
|
5
|
+
A review of target decomposition theorems in radar polarimetry
|
|
6
|
+
IEEE Transactions on Geoscience and Remote Sensing, 1996
|
|
7
|
+
DOI: 10.1109/36.485127
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import numpy as np
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def h_a_alpha_decomposition(coherency_matrix):
|
|
14
|
+
"""
|
|
15
|
+
Entropy/Anisotropy/Alpha (H/A/alpha) decomposition of a 3x3 polarimetric coherency matrix.
|
|
16
|
+
Parameters:
|
|
17
|
+
coherency_matrix - polarimetric coherency matrices as (*B, 3, 3) numpy array, where B are the batch dimensions
|
|
18
|
+
Returns:
|
|
19
|
+
A tuple of entropy, anisotropy, mean alpha angle, and dominant alpha angle.
|
|
20
|
+
In case an individual 3x3 matrix is decomposed, the tuple contains scalar values.
|
|
21
|
+
In the batched case, the tuple contains arrays that have the shape of the batch dimensions.
|
|
22
|
+
"""
|
|
23
|
+
t_eigval, t_eigvec = np.linalg.eigh(coherency_matrix)
|
|
24
|
+
pseudo_probs = t_eigval / np.sum(t_eigval, axis=-1, keepdims=True)
|
|
25
|
+
# alpha angles
|
|
26
|
+
alpha_i = np.arccos(np.abs(t_eigvec[..., 0, :])) # arccos of abs of first element of each eigenvector
|
|
27
|
+
alpha_mean = np.sum(pseudo_probs * alpha_i, axis=-1) # average alpha angle (weighted by eigenvalues)
|
|
28
|
+
alpha_dominant = alpha_i[..., 2] # alpha angle corresponding to the largest eigenvalue (at index 2)
|
|
29
|
+
# entropy
|
|
30
|
+
log_pseudo_probs = np.log(pseudo_probs, out=np.zeros_like(pseudo_probs), where=pseudo_probs > 1e-5)
|
|
31
|
+
entropy = -np.sum(pseudo_probs * log_pseudo_probs, axis=-1) / np.log(3) # log base 3
|
|
32
|
+
# anisotropy
|
|
33
|
+
t_eigval_2 = t_eigval[..., 1] # second (intermediate) eigenvalue has index 1
|
|
34
|
+
t_eigval_3 = t_eigval[..., 0] # third (smallest) has index 0 (ascending sorting)
|
|
35
|
+
t_eigval_sum = t_eigval_2 + t_eigval_3
|
|
36
|
+
anisotropy = np.divide(
|
|
37
|
+
t_eigval_2 - t_eigval_3, t_eigval_sum, out=np.zeros_like(t_eigval_sum), where=t_eigval_sum != 0
|
|
38
|
+
)
|
|
39
|
+
return entropy, anisotropy, alpha_mean, alpha_dominant
|
|
File without changes
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Interferometric soil moisture model for the coherence and phase triplets.
|
|
3
|
+
|
|
4
|
+
F. De Zan, A. Parizzi, P. Prats-Iraola and P. López-Dekker
|
|
5
|
+
A SAR Interferometric Model for Soil Moisture
|
|
6
|
+
IEEE Transactions on Geoscience and Remote Sensing, 2014
|
|
7
|
+
DOI: 10.1109/TGRS.2013.2241069
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import torch
|
|
11
|
+
from torch import nn
|
|
12
|
+
import sarssm
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Dezan2014InSARMoistureModel(nn.Module):
|
|
16
|
+
def __init__(self, initial_sm_dict: dict, incidence, sand, clay, frequency):
|
|
17
|
+
"""
|
|
18
|
+
Forward interferometric model for soil moisture implemented in PyTorch.
|
|
19
|
+
The model predicts the interferometric parameters (complex coherence and phase triplets) given the soil moisture.
|
|
20
|
+
The model works on a time series with N acquisitions, where each aquaition has its own id.
|
|
21
|
+
Each acquisition must have the same number of points (same batch shape B).
|
|
22
|
+
Model inversion can be performed by optimizing the soil moisture values to explain the observed interferometric parameters.
|
|
23
|
+
Arguments:
|
|
24
|
+
initial_sm - initial soil moisture, dict with N tensors of shape (*B,), dict keys are acquistion ids
|
|
25
|
+
incidence - incidence angle, torch tensor of shape (*B,) or a scalar
|
|
26
|
+
sand - soil sand content in percent (value from 0 to 100), torch tensor of shape (*B,) or a scalar
|
|
27
|
+
clay - soil clay content in percent (value from 0 to 100), torch tensor of shape (*B,) or a scalar
|
|
28
|
+
frequency - radar frequency in Hz, int or float
|
|
29
|
+
"""
|
|
30
|
+
super().__init__()
|
|
31
|
+
assert torch.is_tensor(incidence) and torch.is_tensor(sand) and torch.is_tensor(clay)
|
|
32
|
+
for initial_sm_item in initial_sm_dict.values():
|
|
33
|
+
assert torch.is_tensor(initial_sm_item)
|
|
34
|
+
self.aquisition_ids = list(initial_sm_dict.keys())
|
|
35
|
+
self.predicted_sm_dict = nn.ParameterDict(
|
|
36
|
+
{key: nn.Parameter(initial_sm_item) for key, initial_sm_item in initial_sm_dict.items()}
|
|
37
|
+
)
|
|
38
|
+
self.frequency = frequency
|
|
39
|
+
self.incidence = incidence
|
|
40
|
+
self.sand = sand
|
|
41
|
+
self.clay = clay
|
|
42
|
+
|
|
43
|
+
def sm_to_soil_kz(self, sm):
|
|
44
|
+
"""
|
|
45
|
+
Convert soil moisture to the vertical wavenumber in the soil (kz_soil) according to the model.
|
|
46
|
+
Internal inputs:
|
|
47
|
+
eps_r_soil - relative soil dielectrics, as predicted by Hallikainen model from the soil moisture
|
|
48
|
+
complex-valued, the imaginary part must be negative
|
|
49
|
+
wavelength - radar wavelength in m
|
|
50
|
+
incidence - incidence angle in radians
|
|
51
|
+
Equations:
|
|
52
|
+
kx^2 + kz_air^2 = omega^2 * mu_0 * eps_0 # Wave equation in air
|
|
53
|
+
kx^2 + kz_soil^2 = omega^2 * mu_0 * eps_total_soil # Wave equation in soil
|
|
54
|
+
eps_total_soil = eps_r_soil * eps_0 # total soil dielectric constant = relative soil dielectrics * vacuum dielectrics
|
|
55
|
+
f = c / wavelength # center frequency = light speed / wavelength
|
|
56
|
+
eps_0 = 1 / (mu_0 * c^2) # vacuum dielectric permittivity
|
|
57
|
+
mu_0 = 4 * pi * 10^-7 # vacuum magnetic permeability
|
|
58
|
+
omega = 2 * pi * f # angular frequency
|
|
59
|
+
kx = 2 * pi / wavelength * sin(incidence)
|
|
60
|
+
kz = 2 * pi / wavelength * cos(incidence)
|
|
61
|
+
Obtaining kz_soil:
|
|
62
|
+
kx^2 + kz_soil^2 = omega^2 * mu_0 * eps_total_soil # Wave equation in soil
|
|
63
|
+
kz_soil = sqrt( omega^2 * eps_total_soil * mu_0 - kx^2 )
|
|
64
|
+
kz_soil = sqrt( omega^2 * eps_r_soil * eps_0 * mu_0 - kx^2 )
|
|
65
|
+
kz_soil = sqrt( omega^2 * eps_r_soil * 1 / (mu_0 * c^2) * mu_0 - kx^2 )
|
|
66
|
+
kz_soil = sqrt( omega^2 * eps_r_soil / (c^2) - kx^2 )
|
|
67
|
+
kz_soil = sqrt( (2 * pi * f)^2 * eps_r_soil / (c^2) - kx^2 )
|
|
68
|
+
kz_soil = sqrt( (2 * pi * c / wavelength)^2 * eps_r_soil / (c^2) - kx^2 )
|
|
69
|
+
kz_soil = sqrt( (2 * pi / wavelength)^2 * eps_r_soil - kx^2 )
|
|
70
|
+
kz_soil = sqrt( (2 * pi / wavelength)^2 * eps_r_soil - (2 * pi / wavelength * sin(incidence))^2 )
|
|
71
|
+
kz_soil = sqrt( (2 * pi / wavelength)^2 * (eps_r_soil - sin^2(incidence)) )
|
|
72
|
+
kz_soil = (2 * pi / wavelength) * sqrt( eps_r_soil - sin^2(incidence) )
|
|
73
|
+
"""
|
|
74
|
+
light_speed = 299792458 # m/s
|
|
75
|
+
wavelength = light_speed / self.frequency
|
|
76
|
+
eps_r_soil = sarssm.moisture_to_eps_hallikainen(sm, sand=self.sand, clay=self.clay, frequency=self.frequency)
|
|
77
|
+
kz_soil = torch.pi * 2 / wavelength * torch.sqrt(eps_r_soil - torch.sin(self.incidence) ** 2)
|
|
78
|
+
# there are two solutions for sqrt, kz_soil with a negative imaginary part is physically correct
|
|
79
|
+
if not torch.all(torch.isnan(kz_soil) | (kz_soil.imag < 0)):
|
|
80
|
+
# imaginary part of kz_soil has the same sign as the imaginary part of eps_r_soil (which should be negative)
|
|
81
|
+
raise ValueError("The imaginary part of kz_soil and eps_r_soil should be negative!")
|
|
82
|
+
return kz_soil
|
|
83
|
+
|
|
84
|
+
def kz_to_inf_coherence(self, kz_soil_1, kz_soil_2):
|
|
85
|
+
"""
|
|
86
|
+
Conpute the expected interferometric coherence for two kz_soil values at different times.
|
|
87
|
+
"""
|
|
88
|
+
return 2j * torch.sqrt(kz_soil_2.imag * kz_soil_1.imag) / (torch.conj(kz_soil_2) - kz_soil_1)
|
|
89
|
+
|
|
90
|
+
def forward(self):
|
|
91
|
+
"""
|
|
92
|
+
Forward model evaluation: given the moisture, compute all coherence pairs and phase triplets.
|
|
93
|
+
Returns two dictionaries as a tuple: (coherence_dict, triplet_dict)
|
|
94
|
+
Dictionary keys are tuples with aquisition ids (same ids as in the initial soil moisture dict)
|
|
95
|
+
coherence_dict: contains the coherence for each pair of input soil moisture values
|
|
96
|
+
(aquisition_id_1, aquisition_id_2) -> complex coherence, torch tensor of shape (*B,)
|
|
97
|
+
for each pair, only one combination is included in the dict, e.g. (a, b) but not (b, a)
|
|
98
|
+
the reverse combination (b, a) can be obtanied by conjugating (a, b)
|
|
99
|
+
triplet_dict: contains the phase triplet (real number between -pi and pi) for each triplet of moisture values
|
|
100
|
+
(aquisition_id_1, aquisition_id_2, aquisition_id_3) -> phase, torch tensor of shape (*B,)
|
|
101
|
+
"""
|
|
102
|
+
num_aqusitions = len(self.aquisition_ids)
|
|
103
|
+
kz_soil_dict = {key: self.sm_to_soil_kz(sm) for key, sm in self.predicted_sm_dict.items()}
|
|
104
|
+
# compute all coherences
|
|
105
|
+
coherence_dict = {} # dict: tuple of aquisition_ids (id_i, id_j) -> coherence tensor
|
|
106
|
+
for i in range(num_aqusitions):
|
|
107
|
+
for j in range(i + 1, num_aqusitions):
|
|
108
|
+
id_i, id_j = self.aquisition_ids[i], self.aquisition_ids[j]
|
|
109
|
+
kz_soil_i, kz_soil_j = kz_soil_dict[id_i], kz_soil_dict[id_j]
|
|
110
|
+
coherence_dict[id_i, id_j] = self.kz_to_inf_coherence(kz_soil_i, kz_soil_j)
|
|
111
|
+
# compute all triplets
|
|
112
|
+
triplet_dict = {}
|
|
113
|
+
for i in range(num_aqusitions):
|
|
114
|
+
for j in range(i + 1, num_aqusitions):
|
|
115
|
+
for k in range(j + 1, num_aqusitions):
|
|
116
|
+
id_i, id_j, id_k = self.aquisition_ids[i], self.aquisition_ids[j], self.aquisition_ids[k]
|
|
117
|
+
coherence_ij = coherence_dict[(id_i, id_j)]
|
|
118
|
+
coherence_jk = coherence_dict[(id_j, id_k)]
|
|
119
|
+
coherence_ki = torch.conj(coherence_dict[(id_i, id_k)]) # (k, i) is like conj(i, k)
|
|
120
|
+
triplet_ijk = coherence_ij * coherence_jk * coherence_ki
|
|
121
|
+
triplet_dict[id_i, id_j, id_k] = torch.angle(triplet_ijk)
|
|
122
|
+
return coherence_dict, triplet_dict
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def moisture_to_insar_coherence(moisture_1, moisture_2, incidence, sand, clay, frequency):
|
|
126
|
+
"""
|
|
127
|
+
Predict the expected complex interferometric coherence given two soil moisture values at different times.
|
|
128
|
+
Numpy wrapper around the Dezan2014InSARMoistureModel. Use the model directly to compute coherence for
|
|
129
|
+
multiple moisture combinations at once.
|
|
130
|
+
Arguments:
|
|
131
|
+
moisture_1: first soil moisture value, numpy array of shape (*B,), where B are the batch dimensions
|
|
132
|
+
moisture_2: second moisture value, numpy array of shape (*B,)
|
|
133
|
+
incidence: incidence angle in radians, numpy array of shape (*B,) or a scalar
|
|
134
|
+
sand: soil sand content in percent (value from 0 to 100), numpy array of shape (*B,) or a scalar
|
|
135
|
+
clay: soil clay content in percent (value from 0 to 100), numpy array of shape (*B,) or a scalar
|
|
136
|
+
frequency: radar frequency in Hz, int or float
|
|
137
|
+
Returns:
|
|
138
|
+
complex_coherence between two acquisitions predicted by the model, complex-valued numpy array of shape (*B,)
|
|
139
|
+
"""
|
|
140
|
+
moisture_dict = {
|
|
141
|
+
"moisture_1": torch.tensor(moisture_1),
|
|
142
|
+
"moisture_2": torch.tensor(moisture_2),
|
|
143
|
+
}
|
|
144
|
+
incidence = torch.tensor(incidence)
|
|
145
|
+
sand = torch.tensor(sand)
|
|
146
|
+
clay = torch.tensor(clay)
|
|
147
|
+
model = Dezan2014InSARMoistureModel(
|
|
148
|
+
initial_sm_dict=moisture_dict, incidence=incidence, sand=sand, clay=clay, frequency=frequency
|
|
149
|
+
)
|
|
150
|
+
coherence_dict, triplet_dict = model.forward()
|
|
151
|
+
complex_coherence = coherence_dict[("moisture_1", "moisture_2")]
|
|
152
|
+
return complex_coherence.cpu().detach().numpy()
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def moisture_to_insar_phase_triplet(moisture_1, moisture_2, moisture_3, incidence, sand, clay, frequency):
|
|
156
|
+
"""
|
|
157
|
+
Predict the expected interferometric phase triplet given three soil moisture values at different times.
|
|
158
|
+
Numpy wrapper around the Dezan2014InSARMoistureModel. Use the model directly to compute multiple coherences at once.
|
|
159
|
+
Arguments:
|
|
160
|
+
moisture_1: first soil moisture value, numpy array of shape (*B,), where B are the batch dimensions
|
|
161
|
+
moisture_2: second moisture value, numpy array of shape (*B,)
|
|
162
|
+
moisture_3: third moisture value, numpy array of shape (*B,)
|
|
163
|
+
incidence: incidence angle in radians, numpy array of shape (*B,) or a scalar
|
|
164
|
+
sand: soil sand content in percent (value from 0 to 100), numpy array of shape (*B,) or a scalar
|
|
165
|
+
clay: soil clay content in percent (value from 0 to 100), numpy array of shape (*B,) or a scalar
|
|
166
|
+
frequency: radar frequency in Hz, int or float
|
|
167
|
+
Returns:
|
|
168
|
+
phase_triplet: phase in radians predicted by the model, real-valued numpy array of shape (*B,)
|
|
169
|
+
"""
|
|
170
|
+
moisture_dict = {
|
|
171
|
+
"moisture_1": torch.tensor(moisture_1),
|
|
172
|
+
"moisture_2": torch.tensor(moisture_2),
|
|
173
|
+
"moisture_3": torch.tensor(moisture_3),
|
|
174
|
+
}
|
|
175
|
+
incidence = torch.tensor(incidence)
|
|
176
|
+
sand = torch.tensor(sand)
|
|
177
|
+
clay = torch.tensor(clay)
|
|
178
|
+
model = Dezan2014InSARMoistureModel(
|
|
179
|
+
initial_sm_dict=moisture_dict, incidence=incidence, sand=sand, clay=clay, frequency=frequency
|
|
180
|
+
)
|
|
181
|
+
coherence_dict, triplet_dict = model.forward()
|
|
182
|
+
phase_triplet = triplet_dict[("moisture_1", "moisture_2", "moisture_3")]
|
|
183
|
+
return phase_triplet.cpu().detach().numpy()
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Model inversion for the interferometric soil moisture model.
|
|
3
|
+
|
|
4
|
+
F. De Zan, A. Parizzi, P. Prats-Iraola and P. López-Dekker
|
|
5
|
+
A SAR Interferometric Model for Soil Moisture
|
|
6
|
+
IEEE Transactions on Geoscience and Remote Sensing, 2014
|
|
7
|
+
DOI: 10.1109/TGRS.2013.2241069
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import numpy as np
|
|
11
|
+
import torch
|
|
12
|
+
import sarssm
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def slc_to_insar_parameters(slc_dict, window_size):
|
|
16
|
+
"""
|
|
17
|
+
SLCs to interferometric parameters (complex coherence and phase triplets).
|
|
18
|
+
Input:
|
|
19
|
+
slc_dict: dict with N SLC images of shape (Az, Rg), dict keys are acquistion ids
|
|
20
|
+
window_size: tuple (az_window, rg_window) to compute coherences and triplets
|
|
21
|
+
Returns two dictionaries as a tuple: (coherence_dict, triplet_dict)
|
|
22
|
+
coherence_dict: contains the complex coherence for each pair of input SLCs
|
|
23
|
+
(aquisition_id_1, aquisition_id_2) -> complex coherence, numpy array of shape (Az, Rg)
|
|
24
|
+
for each pair, only one combination is included in the dict, e.g. (a, b) but not (b, a)
|
|
25
|
+
the reverse combination (b, a) can be obtanied by conjugating (a, b)
|
|
26
|
+
triplet_dict: contains the phase triplet (real number between -pi and pi) for each triplet of SLCs
|
|
27
|
+
(aquisition_id_1, aquisition_id_2, aquisition_id_3) -> phase, numpy of shape (Az, Rg)
|
|
28
|
+
"""
|
|
29
|
+
aquisition_ids = list(slc_dict.keys())
|
|
30
|
+
num_aqusitions = len(aquisition_ids)
|
|
31
|
+
# coherences
|
|
32
|
+
coherence_dict = {} # dict: tuple of aquisition_ids (id_i, id_j) -> coherence array
|
|
33
|
+
for i in range(num_aqusitions):
|
|
34
|
+
for j in range(i + 1, num_aqusitions):
|
|
35
|
+
id_i, id_j = aquisition_ids[i], aquisition_ids[j]
|
|
36
|
+
slc_i, slc_j = slc_dict[id_i], slc_dict[id_j]
|
|
37
|
+
coherence_ij = sarssm.complex_coherence(slc_i, slc_j, window_size)
|
|
38
|
+
coherence_dict[id_i, id_j] = coherence_ij
|
|
39
|
+
# triplets
|
|
40
|
+
triplet_dict = {} # Map index tuple (i, j, k) to the triplet array
|
|
41
|
+
for i in range(num_aqusitions):
|
|
42
|
+
for j in range(i + 1, num_aqusitions):
|
|
43
|
+
for k in range(j + 1, num_aqusitions):
|
|
44
|
+
id_i, id_j, id_k = aquisition_ids[i], aquisition_ids[j], aquisition_ids[k]
|
|
45
|
+
coherence_ij = coherence_dict[id_i, id_j]
|
|
46
|
+
coherence_jk = coherence_dict[id_j, id_k]
|
|
47
|
+
coherence_ki = np.conj(coherence_dict[id_i, id_k]) # (k, i) is like conj(i, k)
|
|
48
|
+
triplet_ijk = coherence_ij * coherence_jk * coherence_ki
|
|
49
|
+
triplet_dict[id_i, id_j, id_k] = np.angle(triplet_ijk)
|
|
50
|
+
return coherence_dict, triplet_dict
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _np_dict_to_torch(np_dict):
|
|
54
|
+
"""
|
|
55
|
+
Dictionary with numpy arrays -> dictionary with torch tensors.
|
|
56
|
+
"""
|
|
57
|
+
return {key: torch.tensor(np_array) for key, np_array in np_dict.items()}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _abs_on_dict(torch_dict):
|
|
61
|
+
return {key: torch.abs(complex_data) for key, complex_data in torch_dict.items()}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def insar_parameters_to_moisture(
|
|
65
|
+
coherence_dict, triplet_dict, initial_sm_dict, known_sm_aquisition_id, incidence, sand, clay, frequency, iters=320
|
|
66
|
+
):
|
|
67
|
+
"""
|
|
68
|
+
Invert the De Zan soil moisture model and predict soil moisture from interferometric parameters (coherence and triplets).
|
|
69
|
+
The provided initial soil moisture values are iteratively adjusted until a combination is found that best explains the
|
|
70
|
+
observed interferometric parameters. In addition, one soil moisture value must be known.
|
|
71
|
+
The model works on a time series with N acquisitions, where each aquaition has its own id.
|
|
72
|
+
Each acquisition must have the same number of points (same batch shape B).
|
|
73
|
+
Input:
|
|
74
|
+
coherence_dict - dictionary that contains the observed complex coherence values
|
|
75
|
+
(aquisition_id_1, aquisition_id_2) -> complex coherence, numpy array of shape (*B,)
|
|
76
|
+
triplet_dict - dictionary that contains the observed triplet values (real numbers between -pi and pi)
|
|
77
|
+
(aquisition_id_1, aquisition_id_2, aquisition_id_3) -> phase, numpy of shape (*B,)
|
|
78
|
+
initial_sm_dict - dictionary that contains the initial soil moisture values (between 0 and 1) for each acquisition
|
|
79
|
+
aquisition_id -> initial soil moisture, numpy array of shape (*B,)
|
|
80
|
+
known_sm_aquisition_id - the acquisition id of the moisture values that are assumed to be known
|
|
81
|
+
those values are kept constant during the optimization
|
|
82
|
+
incidence - incidence angle, numpy array of shape (*B,) or a scalar
|
|
83
|
+
sand - soil sand content in percent (value from 0 to 100), numpy array of shape (*B,) or a scalar
|
|
84
|
+
clay - soil clay content in percent (value from 0 to 100), numpy array of shape (*B,) or a scalar
|
|
85
|
+
frequency - radar frequency in Hz, int or float
|
|
86
|
+
iters - number of model fitting iterations
|
|
87
|
+
Returns:
|
|
88
|
+
the fitted model
|
|
89
|
+
"""
|
|
90
|
+
# form torch tensors
|
|
91
|
+
obs_abs_coh_dict = _abs_on_dict(_np_dict_to_torch(coherence_dict))
|
|
92
|
+
obs_tri_dict = _np_dict_to_torch(triplet_dict)
|
|
93
|
+
initial_sm_dict = _np_dict_to_torch(initial_sm_dict)
|
|
94
|
+
incidence = torch.tensor(incidence, dtype=torch.float32)
|
|
95
|
+
sand = torch.tensor(sand, dtype=torch.float32)
|
|
96
|
+
clay = torch.tensor(clay, dtype=torch.float32)
|
|
97
|
+
# construct model and fix the known moisture value
|
|
98
|
+
model = sarssm.Dezan2014InSARMoistureModel(
|
|
99
|
+
initial_sm_dict=initial_sm_dict, incidence=incidence, sand=sand, clay=clay, frequency=frequency
|
|
100
|
+
)
|
|
101
|
+
model.predicted_sm_dict[known_sm_aquisition_id].requires_grad = False # known moisture, will not be updated
|
|
102
|
+
|
|
103
|
+
# the loss combines the deviation of all coherences and triplets
|
|
104
|
+
def _criterion(model_coh_dict: dict, model_tri_dict: dict, obs_coh_dict: dict, obs_tri_dict: dict):
|
|
105
|
+
triplet_weight = 1
|
|
106
|
+
coh_losses = torch.stack(
|
|
107
|
+
[torch.sum((model_coh_dict[key] - obs_coh_dict[key]) ** 2) for key in model_coh_dict.keys()]
|
|
108
|
+
)
|
|
109
|
+
# ignore phase wraps, triplet phase is often close to 0, wraps unlikely
|
|
110
|
+
tri_losses = torch.stack(
|
|
111
|
+
[torch.sum((model_tri_dict[key] - obs_tri_dict[key]) ** 2) for key in model_tri_dict.keys()]
|
|
112
|
+
)
|
|
113
|
+
return torch.sum(coh_losses) + triplet_weight * torch.sum(tri_losses)
|
|
114
|
+
|
|
115
|
+
betas = (0.975, 0.995)
|
|
116
|
+
lr = 0.05
|
|
117
|
+
optimizer = torch.optim.Adam([{"params": model.parameters(), "lr": lr}], betas=betas)
|
|
118
|
+
for iteration in range(iters):
|
|
119
|
+
optimizer.zero_grad()
|
|
120
|
+
model_coh_dict, model_tri_dict = model.forward()
|
|
121
|
+
model_abs_coh_dict = _abs_on_dict(model_coh_dict)
|
|
122
|
+
loss = _criterion(model_abs_coh_dict, model_tri_dict, obs_abs_coh_dict, obs_tri_dict)
|
|
123
|
+
loss.backward()
|
|
124
|
+
optimizer.step()
|
|
125
|
+
# clamp soil moisture
|
|
126
|
+
with torch.no_grad():
|
|
127
|
+
min_sm = 0.03
|
|
128
|
+
max_sm = 0.70
|
|
129
|
+
for predicted_sm in model.predicted_sm_dict.values():
|
|
130
|
+
predicted_sm[predicted_sm < min_sm] = min_sm
|
|
131
|
+
predicted_sm[predicted_sm > max_sm] = max_sm
|
|
132
|
+
return model
|
|
File without changes
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"""
|
|
2
|
+
X-Bragg model for soil moisture estimation from fully-polarimetric PolSAR data.
|
|
3
|
+
|
|
4
|
+
I. Hajnsek, E. Pottier and S. R. Cloude
|
|
5
|
+
Inversion of surface parameters from polarimetric SAR
|
|
6
|
+
IEEE Transactions on Geoscience and Remote Sensing, 2003
|
|
7
|
+
DOI: 10.1109/TGRS.2003.810702
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import numpy as np
|
|
11
|
+
import scipy
|
|
12
|
+
import sarssm
|
|
13
|
+
|
|
14
|
+
# Forward model
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def xbragg_model(theta, eps, delta):
|
|
18
|
+
"""
|
|
19
|
+
Create polarimetric coherency matrices T (Pauli basis) from parameters according to the X-Bragg model.
|
|
20
|
+
Input parameters are numpy arrays with the same shape (*B,).
|
|
21
|
+
Parameters:
|
|
22
|
+
theta - incidence angle, in radians
|
|
23
|
+
eps - surface dielectrics
|
|
24
|
+
delta - surface roughness distribution width, in radians
|
|
25
|
+
Returns:
|
|
26
|
+
X-Bragg T matrices, numpy array with shape (*B, 3, 3)
|
|
27
|
+
"""
|
|
28
|
+
cos_t = np.cos(theta)
|
|
29
|
+
sin2_t = np.sin(theta) ** 2
|
|
30
|
+
sqrt = np.sqrt(eps - sin2_t)
|
|
31
|
+
r_s = (cos_t - sqrt) / (cos_t + sqrt)
|
|
32
|
+
r_p = (eps - 1) * (sin2_t - eps * (1 + sin2_t)) / ((eps * cos_t + sqrt) ** 2)
|
|
33
|
+
c1 = np.abs(r_s + r_p) ** 2
|
|
34
|
+
c2 = (r_s + r_p) * np.conj(r_s - r_p)
|
|
35
|
+
c3 = 0.5 * np.abs(r_s - r_p) ** 2
|
|
36
|
+
sinc2 = np.sinc(2 * delta / np.pi)
|
|
37
|
+
sinc4 = np.sinc(4 * delta / np.pi)
|
|
38
|
+
zeros = np.zeros_like(theta)
|
|
39
|
+
t = np.array([[c1, c2 * sinc2, zeros], [c2 * sinc2, c3 * (1 + sinc4), zeros], [zeros, zeros, c3 * (1 - sinc4)]])
|
|
40
|
+
return np.moveaxis(t, [0, 1], [-2, -1]) # move first two axes (correspond to the matrix) to the end
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Model inversion with lookup tables
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _get_xbragg_parameter_grids(theta_bounds, eps_bounds, delta_bounds):
|
|
47
|
+
"""
|
|
48
|
+
Create a grid with parameters sampling the input space of the X-Bragg model.
|
|
49
|
+
"""
|
|
50
|
+
theta_min, theta_max = theta_bounds
|
|
51
|
+
eps_min, eps_max = eps_bounds
|
|
52
|
+
delta_min, delta_max = delta_bounds
|
|
53
|
+
theta_steps = int(np.rint(np.degrees(theta_max - theta_min) + 1))
|
|
54
|
+
theta = np.linspace(theta_min, theta_max, theta_steps, endpoint=True)
|
|
55
|
+
eps_steps = int(eps_max - eps_min + 1)
|
|
56
|
+
eps = np.exp(np.linspace(np.log(eps_min), np.log(eps_max), eps_steps, endpoint=True))
|
|
57
|
+
delta_steps = int(np.rint((np.degrees(delta_max - delta_min) + 1) / 2))
|
|
58
|
+
delta = np.linspace(delta_min, delta_max, delta_steps, endpoint=True)
|
|
59
|
+
theta_grid, eps_grid, delta_grid = np.meshgrid(theta, eps, delta, indexing="ij")
|
|
60
|
+
return theta_grid, eps_grid, delta_grid
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _entropy_alpha_param_lut(
|
|
64
|
+
entropy_coords, alpha_mean_coords, values, entropy_range=(0.0, 0.5), alpha_range=(0.0, np.radians(25.0)), steps=200
|
|
65
|
+
):
|
|
66
|
+
"""
|
|
67
|
+
Interpolate values assigned to points in the entropy-alpha space.
|
|
68
|
+
This effectively creates a lookup table where a parameter value can be retrieved from an entropy-alpha pair.
|
|
69
|
+
"""
|
|
70
|
+
h_min, h_max = entropy_range
|
|
71
|
+
a_min, a_max = alpha_range
|
|
72
|
+
grid_x, grid_y = np.mgrid[h_min : h_max : steps * 1j, a_min : a_max : steps * 1j]
|
|
73
|
+
value_coords = np.array([entropy_coords, alpha_mean_coords]).transpose((1, 0))
|
|
74
|
+
grid = scipy.interpolate.griddata(value_coords, values, (grid_x, grid_y), method="linear")
|
|
75
|
+
return grid
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _values_to_lut_indices(values, value_range, lut_slices):
|
|
79
|
+
"""
|
|
80
|
+
Convert values to lookup table indices based on the value range and the number of lookup table slices.
|
|
81
|
+
For values that would create invalid indices (e.g. values outside the value range),
|
|
82
|
+
the index is set to 0 and the corresponding element `index_is_invalid` is set to True.
|
|
83
|
+
"""
|
|
84
|
+
value_min, value_max = value_range
|
|
85
|
+
step = (value_max - value_min) / (lut_slices - 1)
|
|
86
|
+
indices_float = np.rint((values - value_min) / step)
|
|
87
|
+
indices_float[np.isnan(indices_float)] = -1 # use negative value for invalid, nan cannot be cast to an int
|
|
88
|
+
indices = indices_float.astype(np.int32)
|
|
89
|
+
index_is_invalid = np.logical_or(indices < 0, indices >= lut_slices)
|
|
90
|
+
indices[index_is_invalid] = 0
|
|
91
|
+
return indices, index_is_invalid
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _create_xbragg_eps_lut():
|
|
95
|
+
"""
|
|
96
|
+
Generate a lookup table that maps incidence_angle, entropy, and alpha triplets to the corresponding eps values.
|
|
97
|
+
Returns the lookup table and the value ranges for incidence_angle, entropy, and alpha that are covered by the table.
|
|
98
|
+
Invalid combinations of incidence_angle, entropy, and alpha (not covered by the X-Bragg model) result in eps = NaN.
|
|
99
|
+
"""
|
|
100
|
+
theta_bounds = (np.radians(10.0), np.radians(60.0))
|
|
101
|
+
eps_bounds = (2.0, 40.0)
|
|
102
|
+
delta_bounds = (np.radians(0.0), np.radians(90.0))
|
|
103
|
+
theta_grid, eps_grid, delta_grid = _get_xbragg_parameter_grids(theta_bounds, eps_bounds, delta_bounds)
|
|
104
|
+
t = xbragg_model(theta_grid, eps_grid, delta_grid)
|
|
105
|
+
entropy, anisotropy, alpha_mean, alpha_dominant = sarssm.h_a_alpha_decomposition(t)
|
|
106
|
+
# construct lookup tables for each incidence angle
|
|
107
|
+
entropy_bounds = (0.0, 0.8)
|
|
108
|
+
alpha_bounds = (0.0, np.radians(35.0))
|
|
109
|
+
incidence_slice_count = entropy.shape[0]
|
|
110
|
+
lut_list = []
|
|
111
|
+
for incidence_slice_index in range(incidence_slice_count):
|
|
112
|
+
entropy_coords = entropy[incidence_slice_index].flatten()
|
|
113
|
+
alpha_mean_coords = alpha_mean[incidence_slice_index].flatten()
|
|
114
|
+
eps_vals = eps_grid[incidence_slice_index].flatten()
|
|
115
|
+
eps_lut = _entropy_alpha_param_lut(
|
|
116
|
+
entropy_coords,
|
|
117
|
+
alpha_mean_coords,
|
|
118
|
+
eps_vals,
|
|
119
|
+
entropy_range=entropy_bounds,
|
|
120
|
+
alpha_range=alpha_bounds,
|
|
121
|
+
steps=256,
|
|
122
|
+
)
|
|
123
|
+
lut_list.append(eps_lut)
|
|
124
|
+
eps_luts = np.array(lut_list)
|
|
125
|
+
return eps_luts, theta_bounds, entropy_bounds, alpha_bounds
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def coherency_matrix_to_xbragg_eps(t3, theta):
|
|
129
|
+
"""
|
|
130
|
+
Estimate surface relative dielectrics from polarimetric coherency matrices using the inverted X-Bragg model.
|
|
131
|
+
For each pixel, entropy and alpha values are obtained from the coherency matrix.
|
|
132
|
+
Then, entropy, alpha, and the incidence angle (theta) are used to look up the corresponding eps.
|
|
133
|
+
Parameters:
|
|
134
|
+
t3 - coherency matrices, numpy array of shape (*B, 3, 3)
|
|
135
|
+
theta - corresponding incidence angle in radians, numpy array of shape (*B,)
|
|
136
|
+
Returns:
|
|
137
|
+
Estimated surface dielectric constant (eps), numpy array of shape (*B,)
|
|
138
|
+
"""
|
|
139
|
+
entropy, anisotropy, alpha, alpha_dominant = sarssm.h_a_alpha_decomposition(t3)
|
|
140
|
+
eps_luts, theta_bounds, entropy_bounds, alpha_bounds = _create_xbragg_eps_lut()
|
|
141
|
+
theta_num_slices, entropy_num_slices, alpha_num_slices = eps_luts.shape
|
|
142
|
+
theta_indices, theta_invalid = _values_to_lut_indices(theta, theta_bounds, theta_num_slices)
|
|
143
|
+
entropy_indices, entropy_invalid = _values_to_lut_indices(entropy, entropy_bounds, entropy_num_slices)
|
|
144
|
+
alpha_indices, alpha_invalid = _values_to_lut_indices(alpha, alpha_bounds, alpha_num_slices)
|
|
145
|
+
invalid = np.logical_or(np.logical_or(theta_invalid, entropy_invalid), alpha_invalid)
|
|
146
|
+
inverted_eps = eps_luts[theta_indices, entropy_indices, alpha_indices]
|
|
147
|
+
inverted_eps[invalid] = np.nan
|
|
148
|
+
return inverted_eps
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Additional plots for the X-Bragg model (see hajnsek2003.py).
|
|
3
|
+
|
|
4
|
+
Run with `python -m sarssm.polsar.hajnsek2003_plots`.
|
|
5
|
+
Plots are saved to the `./sarssm_plots/hajnsek2003_plots` folder,
|
|
6
|
+
in the current working directory, the folder is created if it does not exist.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import pathlib
|
|
10
|
+
import numpy as np
|
|
11
|
+
import matplotlib.pyplot as plt
|
|
12
|
+
import sarssm
|
|
13
|
+
from sarssm.polsar import hajnsek2003
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def plot_points(entropy_coords, alpha_mean_coords, eps_vals, title, save_to, cbar_label="eps"):
|
|
17
|
+
plt.figure()
|
|
18
|
+
plt.title(title)
|
|
19
|
+
plt.scatter(
|
|
20
|
+
entropy_coords, np.degrees(alpha_mean_coords), c=eps_vals, s=4, label="eps", vmin=0, vmax=40, cmap="viridis_r"
|
|
21
|
+
)
|
|
22
|
+
plt.xlabel("Entropy")
|
|
23
|
+
plt.ylabel("Mean Alpha [degrees]")
|
|
24
|
+
plt.xlim(0, 0.8)
|
|
25
|
+
plt.ylim(0, 35)
|
|
26
|
+
plt.colorbar(label=cbar_label)
|
|
27
|
+
plt.grid()
|
|
28
|
+
plt.savefig(save_to, dpi=200)
|
|
29
|
+
plt.close("all")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def plot_grid(eps_lut, entropy_range, alpha_range, title, save_to, cbar_label="eps"):
|
|
33
|
+
plt.figure()
|
|
34
|
+
plt.title(title)
|
|
35
|
+
plt.imshow(
|
|
36
|
+
eps_lut.T,
|
|
37
|
+
origin="lower",
|
|
38
|
+
extent=(*entropy_range, *np.degrees(alpha_range)),
|
|
39
|
+
aspect="auto",
|
|
40
|
+
vmin=0,
|
|
41
|
+
vmax=40,
|
|
42
|
+
cmap="viridis_r",
|
|
43
|
+
)
|
|
44
|
+
plt.xlabel("Entropy")
|
|
45
|
+
plt.ylabel("Mean Alpha [degrees]")
|
|
46
|
+
plt.xlim(0, 0.8)
|
|
47
|
+
plt.ylim(0, 35)
|
|
48
|
+
plt.colorbar(label=cbar_label)
|
|
49
|
+
plt.grid()
|
|
50
|
+
plt.savefig(save_to, dpi=200)
|
|
51
|
+
plt.close("all")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def plot_parameter_lookup_tables():
|
|
55
|
+
print("Hajnsek 2003 - plot parameter lookup tables")
|
|
56
|
+
out_folder = pathlib.Path("./sarssm_plots/hajnsek2003_plots")
|
|
57
|
+
out_folder.mkdir(parents=True, exist_ok=True)
|
|
58
|
+
theta_bounds = (np.radians(10.0), np.radians(60.0))
|
|
59
|
+
eps_bounds = (2.0, 40.0)
|
|
60
|
+
delta_bounds = (np.radians(0.0), np.radians(90.0))
|
|
61
|
+
theta_grid, eps_grid, delta_grid = hajnsek2003._get_xbragg_parameter_grids(theta_bounds, eps_bounds, delta_bounds)
|
|
62
|
+
t = hajnsek2003.xbragg_model(theta_grid, eps_grid, delta_grid)
|
|
63
|
+
entropy, anisotropy, alpha_mean, alpha_dominant = sarssm.h_a_alpha_decomposition(t)
|
|
64
|
+
for incidence_slice_index in range(0, 51, 10):
|
|
65
|
+
selected_incidence_deg = np.rint(np.degrees(theta_grid[incidence_slice_index, 0, 0])).astype(np.int32)
|
|
66
|
+
entropy_coords = entropy[incidence_slice_index].flatten()
|
|
67
|
+
alpha_mean_coords = alpha_mean[incidence_slice_index].flatten()
|
|
68
|
+
eps_vals = eps_grid[incidence_slice_index].flatten()
|
|
69
|
+
entropy_range = (0.0, 0.8)
|
|
70
|
+
alpha_range = (0.0, np.radians(35.0))
|
|
71
|
+
eps_lut = hajnsek2003._entropy_alpha_param_lut(
|
|
72
|
+
entropy_coords, alpha_mean_coords, eps_vals, entropy_range=entropy_range, alpha_range=alpha_range, steps=256
|
|
73
|
+
)
|
|
74
|
+
title = f"Eps in the entropy/alpha plane\nincidence = {selected_incidence_deg}°"
|
|
75
|
+
plot_points(
|
|
76
|
+
entropy_coords,
|
|
77
|
+
alpha_mean_coords,
|
|
78
|
+
eps_vals,
|
|
79
|
+
title,
|
|
80
|
+
save_to=out_folder / f"eps_points_incidence_{selected_incidence_deg}_deg.png",
|
|
81
|
+
cbar_label="eps",
|
|
82
|
+
)
|
|
83
|
+
plot_grid(
|
|
84
|
+
eps_lut,
|
|
85
|
+
entropy_range,
|
|
86
|
+
alpha_range,
|
|
87
|
+
title,
|
|
88
|
+
save_to=out_folder / f"eps_grid_incidence_{selected_incidence_deg}_deg.png",
|
|
89
|
+
cbar_label="eps",
|
|
90
|
+
)
|
|
91
|
+
# soil moisture
|
|
92
|
+
sm_vals = sarssm.eps_to_moisture_topp(eps_vals) * 100
|
|
93
|
+
sm_lut = sarssm.eps_to_moisture_topp(eps_lut) * 100
|
|
94
|
+
title = f"Moisture in the entropy/alpha plane\nincidence = {selected_incidence_deg}°"
|
|
95
|
+
plot_points(
|
|
96
|
+
entropy_coords,
|
|
97
|
+
alpha_mean_coords,
|
|
98
|
+
sm_vals,
|
|
99
|
+
title,
|
|
100
|
+
save_to=out_folder / f"sm_points_incidence_{selected_incidence_deg}_deg.png",
|
|
101
|
+
cbar_label="Soil Moisture in %",
|
|
102
|
+
)
|
|
103
|
+
plot_grid(
|
|
104
|
+
sm_lut,
|
|
105
|
+
entropy_range,
|
|
106
|
+
alpha_range,
|
|
107
|
+
title,
|
|
108
|
+
save_to=out_folder / f"sm_grid_incidence_{selected_incidence_deg}_deg.png",
|
|
109
|
+
cbar_label="Soil Moisture in %",
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
if __name__ == "__main__":
|
|
114
|
+
plot_parameter_lookup_tables()
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sarssm
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Selected algorithms for surface soil moisture (SSM) estimation from SAR data
|
|
5
|
+
Author-email: Nikita Basargin <nikita.basargin@dlr.de>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy
|
|
11
|
+
Requires-Dist: torch
|
|
12
|
+
Requires-Dist: scipy
|
|
13
|
+
Requires-Dist: matplotlib
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# SAR SSM package
|
|
17
|
+
|
|
18
|
+
Selected algorithms for surface soil moisture (SSM) estimation from SAR data.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Installation (editable mode)
|
|
22
|
+
|
|
23
|
+
- clone this repository
|
|
24
|
+
- activate a virtual environment (e.g. conda)
|
|
25
|
+
- install this package (in editable mode) with `pip install -e ./sarssm/`
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## List of relevant papers
|
|
29
|
+
The code is based on the following papers.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Dielectrics to Moisture Conversion
|
|
33
|
+
```
|
|
34
|
+
M. T. Hallikainen, F. T. Ulaby, M. C. Dobson, M. A. El-rayes and L.-k. Wu
|
|
35
|
+
Microwave Dielectric Behavior of Wet Soil-Part 1: Empirical Models and Experimental Observations
|
|
36
|
+
IEEE Transactions on Geoscience and Remote Sensing, 1985
|
|
37
|
+
DOI: 10.1109/TGRS.1985.289497
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
G. C. Topp, J. L. Davis, A. P. Annan
|
|
42
|
+
Electromagnetic determination of soil water content: Measurements in coaxial transmission lines
|
|
43
|
+
Water Resources Research, 1980
|
|
44
|
+
DOI: 10.1029/WR016i003p00574
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Fawwaz T. Ulaby and Mohamed A. El-Rayes
|
|
49
|
+
Microwave Dielectric Spectrum of Vegetation Part II: Dual-Dispersion Model
|
|
50
|
+
IEEE Transactions on Geoscience and Remote Sensing, September 1987
|
|
51
|
+
DOI: 10.1109/TGRS.1987.289833
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### PolSAR
|
|
56
|
+
```
|
|
57
|
+
I. Hajnsek, E. Pottier and S. R. Cloude
|
|
58
|
+
Inversion of surface parameters from polarimetric SAR
|
|
59
|
+
IEEE Transactions on Geoscience and Remote Sensing, April 2003
|
|
60
|
+
DOI: 10.1109/TGRS.2003.810702
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
S. R. Cloude and E. Pottier
|
|
65
|
+
A review of target decomposition theorems in radar polarimetry
|
|
66
|
+
IEEE Transactions on Geoscience and Remote Sensing, 1996
|
|
67
|
+
DOI: 10.1109/36.485127
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### InSAR
|
|
72
|
+
```
|
|
73
|
+
F. De Zan, A. Parizzi, P. Prats-Iraola and P. López-Dekker
|
|
74
|
+
A SAR Interferometric Model for Soil Moisture
|
|
75
|
+
IEEE Transactions on Geoscience and Remote Sensing, Jan. 2014
|
|
76
|
+
DOI: 10.1109/TGRS.2013.2241069.
|
|
77
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/sarssm/__init__.py
|
|
5
|
+
src/sarssm/common.py
|
|
6
|
+
src/sarssm.egg-info/PKG-INFO
|
|
7
|
+
src/sarssm.egg-info/SOURCES.txt
|
|
8
|
+
src/sarssm.egg-info/dependency_links.txt
|
|
9
|
+
src/sarssm.egg-info/requires.txt
|
|
10
|
+
src/sarssm.egg-info/top_level.txt
|
|
11
|
+
src/sarssm/conversion/__init__.py
|
|
12
|
+
src/sarssm/conversion/hallikainen1985.py
|
|
13
|
+
src/sarssm/conversion/topp1980.py
|
|
14
|
+
src/sarssm/conversion/ulaby1987.py
|
|
15
|
+
src/sarssm/conversion/ulaby1987_plots.py
|
|
16
|
+
src/sarssm/decomposition/__init__.py
|
|
17
|
+
src/sarssm/decomposition/cloude1996.py
|
|
18
|
+
src/sarssm/insar/__init__.py
|
|
19
|
+
src/sarssm/insar/dezan2014.py
|
|
20
|
+
src/sarssm/insar/dezan2014inversion.py
|
|
21
|
+
src/sarssm/polsar/__init__.py
|
|
22
|
+
src/sarssm/polsar/hajnsek2003.py
|
|
23
|
+
src/sarssm/polsar/hajnsek2003_plots.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sarssm
|