zsplit 1.0.0__tar.gz → 1.0.2__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.
zsplit-1.0.2/PKG-INFO ADDED
@@ -0,0 +1,240 @@
1
+ Metadata-Version: 2.4
2
+ Name: zsplit
3
+ Version: 1.0.2
4
+ Summary: Z-Split Normalization: Zero-Preserving Split Normalization for bipolar spectral indices
5
+ Author-email: Abdulrhman Almoadi <aalmoadi@kacst.edu.sa>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Abdulrhman Almoadi
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/aalmoadi/endwi
29
+ Project-URL: Repository, https://github.com/aalmoadi/endwi
30
+ Project-URL: Documentation, https://github.com/aalmoadi/endwi/tree/main/Z-Split_Normalization
31
+ Project-URL: Bug Tracker, https://github.com/aalmoadi/endwi/issues
32
+ Project-URL: DOI, https://doi.org/10.5281/zenodo.20602710
33
+ Project-URL: Paper, https://doi.org/10.5194/egusphere-2026-672
34
+ Keywords: normalization,remote-sensing,flood-detection,spectral-index,ENDWI,NDWI,bipolar,zero-preserving,Otsu,GIS,GeoAI,machine-learning,deep-learning,SAR,Sentinel-2
35
+ Classifier: Development Status :: 5 - Production/Stable
36
+ Classifier: Intended Audience :: Science/Research
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.8
40
+ Classifier: Programming Language :: Python :: 3.9
41
+ Classifier: Programming Language :: Python :: 3.10
42
+ Classifier: Programming Language :: Python :: 3.11
43
+ Classifier: Programming Language :: Python :: 3.12
44
+ Classifier: Topic :: Scientific/Engineering :: GIS
45
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
46
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
47
+ Requires-Python: >=3.8
48
+ Description-Content-Type: text/markdown
49
+ License-File: LICENSE
50
+ Requires-Dist: numpy>=1.20
51
+ Provides-Extra: raster
52
+ Requires-Dist: rasterio>=1.2; extra == "raster"
53
+ Provides-Extra: dev
54
+ Requires-Dist: pytest; extra == "dev"
55
+ Requires-Dist: rasterio>=1.2; extra == "dev"
56
+ Requires-Dist: matplotlib; extra == "dev"
57
+ Dynamic: license-file
58
+
59
+ # Z-Split Normalization (Zero-Preserving Split Normalization)
60
+
61
+ **Version:** 1.0.1
62
+ **License:** MIT
63
+
64
+ ---
65
+
66
+ ## What is Z-Split?
67
+
68
+ Z-Split **preserves zero as a fixed physical boundary** while **expanding narrow distributions clustered around zero** into the full [−1, 1] range — normalizing and expanding in a single operation. This prevents the low-contrast output common with near-zero indices and creates a well-formed distribution suitable for Otsu thresholding and multi-temporal analysis.
69
+
70
+ ---
71
+
72
+ ## Core Idea and Motivation
73
+
74
+ Spectral indices and remote sensing operations often produce values clustered tightly around zero due to radiometric constraints, surface reflectance properties, or normalized difference formulations. Standard normalization compresses these values further, producing low-contrast images and unstable thresholds.
75
+
76
+ Z-Split expands each side of zero independently into [−1, 0] and [0, 1], simultaneously normalizing and stretching narrow distributions. This preserves distributional contrast for reliable thresholding, maintains the zero boundary across scenes for stable multi-temporal comparison, and broadens the practical utility of spectral indices in analytical workflows where near-zero clustering would otherwise limit accuracy.
77
+
78
+ ---
79
+
80
+ ## The Problem
81
+
82
+ Bipolar remote sensing indices share one property: **zero is a physical class boundary** (water/non-water, uplift/subsidence). Standard methods destroy it: Min-Max shifts zero into [0, 1]; Z-Score centers on the mean and produces an unbounded range. Both fail when values cluster near zero, making thresholding unreliable, multi-temporal comparisons artifact-driven, and in the worst case producing entirely empty, white, or black images due to values compressed around zero.
83
+
84
+ ---
85
+
86
+ ## The Solution — Z-Split
87
+
88
+ Z-Split normalizes each side of zero **independently**, stretching the full negative range to [−1, 0] and the full positive range to [0, 1].
89
+
90
+ ### Formula
91
+
92
+ $$
93
+ Z\text{-}Split(x) =
94
+ \begin{cases}
95
+ x \;/\; \max(X^+) & \text{if } x > 0 \\
96
+ 0 & \text{if } x = 0 \\
97
+ x \;/\; |\min(X^-)| & \text{if } x < 0
98
+ \end{cases}
99
+ $$
100
+
101
+ where $X^+$ is the set of positive values and $X^-$ is the set of negative values.
102
+ **Output range:** [−1, 1] with zero strictly preserved.
103
+
104
+ ---
105
+
106
+ ## Why Z-Split?
107
+
108
+ | Property | Min-Max | Z-Score | Z-Split |
109
+ |----------|:-------:|:-------:|:-------:|
110
+ | Preserves zero as class boundary | ❌ | ❌ | ✅ |
111
+ | Expands narrow near-zero distributions | ❌ | ⚠️ | ✅ |
112
+ | Stable on skewed distributions | ❌ | ⚠️ | ✅ |
113
+ | Suitable for Otsu thresholding | ❌ | ⚠️ | ✅ |
114
+ | Multi-temporal direction preserved | ❌ | ❌ | ✅ |
115
+ | Output range | [0, 1] | Unbounded | [−1, 1] |
116
+
117
+ ---
118
+
119
+ ## Installation
120
+
121
+ ```bash
122
+ pip install zsplit
123
+ ```
124
+
125
+ ## Quick Start
126
+
127
+ ```python
128
+ from zsplit import normalize
129
+
130
+ result = normalize(your_bipolar_index)
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Practical Applications in Remote Sensing
136
+
137
+ Z-Split addresses a critical problem in any workflow involving bipolar indices across time or sensors:
138
+
139
+ **1. Change Detection**
140
+ Applying Min-Max before change detection introduces artificial trends that appear as land cover change but reflect only normalization artifacts. A report showing "15% vegetation decline" may be entirely attributable to normalization, not reality.
141
+
142
+ **2. Time Series Analysis**
143
+ Studies tracking floods, drought, or urban expansion over time require a clean temporal signal. Min-Max corrupts this signal by rescaling each scene independently to [0, 1], making year-to-year comparisons unreliable.
144
+
145
+ **3. Multi-temporal Machine Learning**
146
+ Models trained on Min-Max normalized multi-year data learn spurious patterns introduced by normalization rather than real spectral change. Z-Split ensures the training signal reflects actual surface conditions.
147
+
148
+ **4. InSAR and Displacement Monitoring**
149
+ In LOS displacement data, zero means no movement. Shifting zero through Min-Max misclassifies stable pixels as deforming, directly corrupting subsidence or uplift maps.
150
+
151
+ ---
152
+
153
+ ## Validation
154
+
155
+ ### 1. NDWI — Optical Remote Sensing
156
+
157
+ Tested on Sentinel-2 NDWI data. Z-Split successfully expanded near-zero clustered values while preserving the original image structure, producing contrast-enhanced output suitable for thresholding and multi-temporal comparison.
158
+
159
+ ### 2. Multi-Temporal Change Analysis — NDVI, Riyadh 2018–2024
160
+
161
+ Validated on four Sentinel-2 NDVI scenes (March–April, 2018–2020–2022–2024) over Riyadh, Saudi Arabia (scale: 10 m, 5603 × 5129 pixels per scene) across 11,424 spatial patches.
162
+
163
+ #### A. Normalization Artifact Analysis
164
+
165
+ The figure below shows the deviation of each normalization method from the raw temporal signal. Min-Max introduces large artificial trends across the entire scene (colored map). Z-Split introduces virtually no deviation (near-white map).
166
+
167
+ ![Deviation Analysis](https://raw.githubusercontent.com/aalmoadi/endwi/main/Figures/deviation_analysis.png)
168
+
169
+ | Method | Mean Absolute Deviation | Std |
170
+ |--------|:-----------------------:|:---:|
171
+ | Min-Max | 0.1858 | 0.2091 |
172
+ | **Z-Split** | **0.0013** | **0.0017** |
173
+
174
+ Z-Split preserves the temporal signal with **143× greater fidelity** than Min-Max.
175
+
176
+ #### B. Linear Trend (Slope per pixel, 2018–2024)
177
+
178
+ | Method | Mean Slope | Std | Correlation with Raw |
179
+ |--------|:----------:|:---:|:--------------------:|
180
+ | Raw (no normalization) | 0.000894 | 0.0165 | — |
181
+ | Min-Max | 0.027454 | 0.2170 | r = 0.511 |
182
+ | **Z-Split** | **−0.000120** | **0.0167** | **r = 0.995** |
183
+
184
+ #### C. Multi-Temporal Change Maps
185
+
186
+ The figure below compares Linear Trend, Anomaly, and Coefficient of Variation maps across all three methods. Z-Split maps are visually and statistically consistent with raw data; Min-Max maps show spatially inverted anomaly patterns and 5.5× inflated variability.
187
+
188
+ ![Change Analysis](https://raw.githubusercontent.com/aalmoadi/endwi/main/Figures/change_analysis.png)
189
+
190
+ | Method | Mean CV |
191
+ |--------|:-------:|
192
+ | Raw | 0.150 |
193
+ | **Z-Split** | **0.173** |
194
+ | Min-Max | 0.832 |
195
+
196
+ #### D. Threshold Stability (Otsu across 11,424 patches)
197
+
198
+ | Method | Threshold Std |
199
+ |--------|:-------------:|
200
+ | Min-Max | 0.0882 |
201
+ | Z-Split | 0.2220 |
202
+ | Z-Score | 1.2012 |
203
+
204
+ > **Note:** For strongly unipolar NDVI in arid urban areas, Min-Max threshold stability is comparable to Z-Split. Z-Split's primary advantage is in bipolar indices with narrow near-zero distributions (NDWI, InSAR LOS), consistent with its design objective.
205
+
206
+ ---
207
+
208
+ ## Application Scope
209
+
210
+ Most effective when:
211
+ - Values cluster near zero (NDWI in arid regions, InSAR LOS over stable terrain)
212
+ - Multi-temporal consistency is required (change detection, time series analysis)
213
+ - Otsu or zero-based thresholding is applied
214
+ - Cross-scene or cross-sensor comparisons are performed
215
+
216
+ ---
217
+
218
+ ## Files
219
+
220
+ | File | Description |
221
+ |------|-------------|
222
+ | `zsplit_normalization.ipynb` | Jupyter Notebook with visual demonstration |
223
+ | `zsplit_arcpy.py` | ArcGIS Pro implementation |
224
+ | `Z-Split_Normalization/Validation/` | Multi-temporal NDVI change analysis |
225
+ | `Validation/01_Optical_ENDWI/` | Optical NDWI validation |
226
+
227
+ ---
228
+
229
+ ## Author
230
+
231
+ **Abdulrhman Almoadi**
232
+ King Abdulaziz City for Science and Technology (KACST)
233
+
234
+ ---
235
+
236
+ ## Citation
237
+
238
+ If you use Z-Split, please cite:
239
+
240
+ > Almoadi, A.: Reducing False Alarms in Urban Flood Detection: An Enhanced NDWI (ENDWI) with Hybrid Max Fusion on Sentinel-2 Data, EGUsphere [preprint], https://doi.org/10.5194/egusphere-2026-672, 2026.
zsplit-1.0.2/README.md ADDED
@@ -0,0 +1,182 @@
1
+ # Z-Split Normalization (Zero-Preserving Split Normalization)
2
+
3
+ **Version:** 1.0.1
4
+ **License:** MIT
5
+
6
+ ---
7
+
8
+ ## What is Z-Split?
9
+
10
+ Z-Split **preserves zero as a fixed physical boundary** while **expanding narrow distributions clustered around zero** into the full [−1, 1] range — normalizing and expanding in a single operation. This prevents the low-contrast output common with near-zero indices and creates a well-formed distribution suitable for Otsu thresholding and multi-temporal analysis.
11
+
12
+ ---
13
+
14
+ ## Core Idea and Motivation
15
+
16
+ Spectral indices and remote sensing operations often produce values clustered tightly around zero due to radiometric constraints, surface reflectance properties, or normalized difference formulations. Standard normalization compresses these values further, producing low-contrast images and unstable thresholds.
17
+
18
+ Z-Split expands each side of zero independently into [−1, 0] and [0, 1], simultaneously normalizing and stretching narrow distributions. This preserves distributional contrast for reliable thresholding, maintains the zero boundary across scenes for stable multi-temporal comparison, and broadens the practical utility of spectral indices in analytical workflows where near-zero clustering would otherwise limit accuracy.
19
+
20
+ ---
21
+
22
+ ## The Problem
23
+
24
+ Bipolar remote sensing indices share one property: **zero is a physical class boundary** (water/non-water, uplift/subsidence). Standard methods destroy it: Min-Max shifts zero into [0, 1]; Z-Score centers on the mean and produces an unbounded range. Both fail when values cluster near zero, making thresholding unreliable, multi-temporal comparisons artifact-driven, and in the worst case producing entirely empty, white, or black images due to values compressed around zero.
25
+
26
+ ---
27
+
28
+ ## The Solution — Z-Split
29
+
30
+ Z-Split normalizes each side of zero **independently**, stretching the full negative range to [−1, 0] and the full positive range to [0, 1].
31
+
32
+ ### Formula
33
+
34
+ $$
35
+ Z\text{-}Split(x) =
36
+ \begin{cases}
37
+ x \;/\; \max(X^+) & \text{if } x > 0 \\
38
+ 0 & \text{if } x = 0 \\
39
+ x \;/\; |\min(X^-)| & \text{if } x < 0
40
+ \end{cases}
41
+ $$
42
+
43
+ where $X^+$ is the set of positive values and $X^-$ is the set of negative values.
44
+ **Output range:** [−1, 1] with zero strictly preserved.
45
+
46
+ ---
47
+
48
+ ## Why Z-Split?
49
+
50
+ | Property | Min-Max | Z-Score | Z-Split |
51
+ |----------|:-------:|:-------:|:-------:|
52
+ | Preserves zero as class boundary | ❌ | ❌ | ✅ |
53
+ | Expands narrow near-zero distributions | ❌ | ⚠️ | ✅ |
54
+ | Stable on skewed distributions | ❌ | ⚠️ | ✅ |
55
+ | Suitable for Otsu thresholding | ❌ | ⚠️ | ✅ |
56
+ | Multi-temporal direction preserved | ❌ | ❌ | ✅ |
57
+ | Output range | [0, 1] | Unbounded | [−1, 1] |
58
+
59
+ ---
60
+
61
+ ## Installation
62
+
63
+ ```bash
64
+ pip install zsplit
65
+ ```
66
+
67
+ ## Quick Start
68
+
69
+ ```python
70
+ from zsplit import normalize
71
+
72
+ result = normalize(your_bipolar_index)
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Practical Applications in Remote Sensing
78
+
79
+ Z-Split addresses a critical problem in any workflow involving bipolar indices across time or sensors:
80
+
81
+ **1. Change Detection**
82
+ Applying Min-Max before change detection introduces artificial trends that appear as land cover change but reflect only normalization artifacts. A report showing "15% vegetation decline" may be entirely attributable to normalization, not reality.
83
+
84
+ **2. Time Series Analysis**
85
+ Studies tracking floods, drought, or urban expansion over time require a clean temporal signal. Min-Max corrupts this signal by rescaling each scene independently to [0, 1], making year-to-year comparisons unreliable.
86
+
87
+ **3. Multi-temporal Machine Learning**
88
+ Models trained on Min-Max normalized multi-year data learn spurious patterns introduced by normalization rather than real spectral change. Z-Split ensures the training signal reflects actual surface conditions.
89
+
90
+ **4. InSAR and Displacement Monitoring**
91
+ In LOS displacement data, zero means no movement. Shifting zero through Min-Max misclassifies stable pixels as deforming, directly corrupting subsidence or uplift maps.
92
+
93
+ ---
94
+
95
+ ## Validation
96
+
97
+ ### 1. NDWI — Optical Remote Sensing
98
+
99
+ Tested on Sentinel-2 NDWI data. Z-Split successfully expanded near-zero clustered values while preserving the original image structure, producing contrast-enhanced output suitable for thresholding and multi-temporal comparison.
100
+
101
+ ### 2. Multi-Temporal Change Analysis — NDVI, Riyadh 2018–2024
102
+
103
+ Validated on four Sentinel-2 NDVI scenes (March–April, 2018–2020–2022–2024) over Riyadh, Saudi Arabia (scale: 10 m, 5603 × 5129 pixels per scene) across 11,424 spatial patches.
104
+
105
+ #### A. Normalization Artifact Analysis
106
+
107
+ The figure below shows the deviation of each normalization method from the raw temporal signal. Min-Max introduces large artificial trends across the entire scene (colored map). Z-Split introduces virtually no deviation (near-white map).
108
+
109
+ ![Deviation Analysis](https://raw.githubusercontent.com/aalmoadi/endwi/main/Figures/deviation_analysis.png)
110
+
111
+ | Method | Mean Absolute Deviation | Std |
112
+ |--------|:-----------------------:|:---:|
113
+ | Min-Max | 0.1858 | 0.2091 |
114
+ | **Z-Split** | **0.0013** | **0.0017** |
115
+
116
+ Z-Split preserves the temporal signal with **143× greater fidelity** than Min-Max.
117
+
118
+ #### B. Linear Trend (Slope per pixel, 2018–2024)
119
+
120
+ | Method | Mean Slope | Std | Correlation with Raw |
121
+ |--------|:----------:|:---:|:--------------------:|
122
+ | Raw (no normalization) | 0.000894 | 0.0165 | — |
123
+ | Min-Max | 0.027454 | 0.2170 | r = 0.511 |
124
+ | **Z-Split** | **−0.000120** | **0.0167** | **r = 0.995** |
125
+
126
+ #### C. Multi-Temporal Change Maps
127
+
128
+ The figure below compares Linear Trend, Anomaly, and Coefficient of Variation maps across all three methods. Z-Split maps are visually and statistically consistent with raw data; Min-Max maps show spatially inverted anomaly patterns and 5.5× inflated variability.
129
+
130
+ ![Change Analysis](https://raw.githubusercontent.com/aalmoadi/endwi/main/Figures/change_analysis.png)
131
+
132
+ | Method | Mean CV |
133
+ |--------|:-------:|
134
+ | Raw | 0.150 |
135
+ | **Z-Split** | **0.173** |
136
+ | Min-Max | 0.832 |
137
+
138
+ #### D. Threshold Stability (Otsu across 11,424 patches)
139
+
140
+ | Method | Threshold Std |
141
+ |--------|:-------------:|
142
+ | Min-Max | 0.0882 |
143
+ | Z-Split | 0.2220 |
144
+ | Z-Score | 1.2012 |
145
+
146
+ > **Note:** For strongly unipolar NDVI in arid urban areas, Min-Max threshold stability is comparable to Z-Split. Z-Split's primary advantage is in bipolar indices with narrow near-zero distributions (NDWI, InSAR LOS), consistent with its design objective.
147
+
148
+ ---
149
+
150
+ ## Application Scope
151
+
152
+ Most effective when:
153
+ - Values cluster near zero (NDWI in arid regions, InSAR LOS over stable terrain)
154
+ - Multi-temporal consistency is required (change detection, time series analysis)
155
+ - Otsu or zero-based thresholding is applied
156
+ - Cross-scene or cross-sensor comparisons are performed
157
+
158
+ ---
159
+
160
+ ## Files
161
+
162
+ | File | Description |
163
+ |------|-------------|
164
+ | `zsplit_normalization.ipynb` | Jupyter Notebook with visual demonstration |
165
+ | `zsplit_arcpy.py` | ArcGIS Pro implementation |
166
+ | `Z-Split_Normalization/Validation/` | Multi-temporal NDVI change analysis |
167
+ | `Validation/01_Optical_ENDWI/` | Optical NDWI validation |
168
+
169
+ ---
170
+
171
+ ## Author
172
+
173
+ **Abdulrhman Almoadi**
174
+ King Abdulaziz City for Science and Technology (KACST)
175
+
176
+ ---
177
+
178
+ ## Citation
179
+
180
+ If you use Z-Split, please cite:
181
+
182
+ > Almoadi, A.: Reducing False Alarms in Urban Flood Detection: An Enhanced NDWI (ENDWI) with Hybrid Max Fusion on Sentinel-2 Data, EGUsphere [preprint], https://doi.org/10.5194/egusphere-2026-672, 2026.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "zsplit"
7
- version = "1.0.0"
7
+ version = "1.0.2"
8
8
  description = "Z-Split Normalization: Zero-Preserving Split Normalization for bipolar spectral indices"
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -0,0 +1,240 @@
1
+ Metadata-Version: 2.4
2
+ Name: zsplit
3
+ Version: 1.0.2
4
+ Summary: Z-Split Normalization: Zero-Preserving Split Normalization for bipolar spectral indices
5
+ Author-email: Abdulrhman Almoadi <aalmoadi@kacst.edu.sa>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Abdulrhman Almoadi
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/aalmoadi/endwi
29
+ Project-URL: Repository, https://github.com/aalmoadi/endwi
30
+ Project-URL: Documentation, https://github.com/aalmoadi/endwi/tree/main/Z-Split_Normalization
31
+ Project-URL: Bug Tracker, https://github.com/aalmoadi/endwi/issues
32
+ Project-URL: DOI, https://doi.org/10.5281/zenodo.20602710
33
+ Project-URL: Paper, https://doi.org/10.5194/egusphere-2026-672
34
+ Keywords: normalization,remote-sensing,flood-detection,spectral-index,ENDWI,NDWI,bipolar,zero-preserving,Otsu,GIS,GeoAI,machine-learning,deep-learning,SAR,Sentinel-2
35
+ Classifier: Development Status :: 5 - Production/Stable
36
+ Classifier: Intended Audience :: Science/Research
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.8
40
+ Classifier: Programming Language :: Python :: 3.9
41
+ Classifier: Programming Language :: Python :: 3.10
42
+ Classifier: Programming Language :: Python :: 3.11
43
+ Classifier: Programming Language :: Python :: 3.12
44
+ Classifier: Topic :: Scientific/Engineering :: GIS
45
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
46
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
47
+ Requires-Python: >=3.8
48
+ Description-Content-Type: text/markdown
49
+ License-File: LICENSE
50
+ Requires-Dist: numpy>=1.20
51
+ Provides-Extra: raster
52
+ Requires-Dist: rasterio>=1.2; extra == "raster"
53
+ Provides-Extra: dev
54
+ Requires-Dist: pytest; extra == "dev"
55
+ Requires-Dist: rasterio>=1.2; extra == "dev"
56
+ Requires-Dist: matplotlib; extra == "dev"
57
+ Dynamic: license-file
58
+
59
+ # Z-Split Normalization (Zero-Preserving Split Normalization)
60
+
61
+ **Version:** 1.0.1
62
+ **License:** MIT
63
+
64
+ ---
65
+
66
+ ## What is Z-Split?
67
+
68
+ Z-Split **preserves zero as a fixed physical boundary** while **expanding narrow distributions clustered around zero** into the full [−1, 1] range — normalizing and expanding in a single operation. This prevents the low-contrast output common with near-zero indices and creates a well-formed distribution suitable for Otsu thresholding and multi-temporal analysis.
69
+
70
+ ---
71
+
72
+ ## Core Idea and Motivation
73
+
74
+ Spectral indices and remote sensing operations often produce values clustered tightly around zero due to radiometric constraints, surface reflectance properties, or normalized difference formulations. Standard normalization compresses these values further, producing low-contrast images and unstable thresholds.
75
+
76
+ Z-Split expands each side of zero independently into [−1, 0] and [0, 1], simultaneously normalizing and stretching narrow distributions. This preserves distributional contrast for reliable thresholding, maintains the zero boundary across scenes for stable multi-temporal comparison, and broadens the practical utility of spectral indices in analytical workflows where near-zero clustering would otherwise limit accuracy.
77
+
78
+ ---
79
+
80
+ ## The Problem
81
+
82
+ Bipolar remote sensing indices share one property: **zero is a physical class boundary** (water/non-water, uplift/subsidence). Standard methods destroy it: Min-Max shifts zero into [0, 1]; Z-Score centers on the mean and produces an unbounded range. Both fail when values cluster near zero, making thresholding unreliable, multi-temporal comparisons artifact-driven, and in the worst case producing entirely empty, white, or black images due to values compressed around zero.
83
+
84
+ ---
85
+
86
+ ## The Solution — Z-Split
87
+
88
+ Z-Split normalizes each side of zero **independently**, stretching the full negative range to [−1, 0] and the full positive range to [0, 1].
89
+
90
+ ### Formula
91
+
92
+ $$
93
+ Z\text{-}Split(x) =
94
+ \begin{cases}
95
+ x \;/\; \max(X^+) & \text{if } x > 0 \\
96
+ 0 & \text{if } x = 0 \\
97
+ x \;/\; |\min(X^-)| & \text{if } x < 0
98
+ \end{cases}
99
+ $$
100
+
101
+ where $X^+$ is the set of positive values and $X^-$ is the set of negative values.
102
+ **Output range:** [−1, 1] with zero strictly preserved.
103
+
104
+ ---
105
+
106
+ ## Why Z-Split?
107
+
108
+ | Property | Min-Max | Z-Score | Z-Split |
109
+ |----------|:-------:|:-------:|:-------:|
110
+ | Preserves zero as class boundary | ❌ | ❌ | ✅ |
111
+ | Expands narrow near-zero distributions | ❌ | ⚠️ | ✅ |
112
+ | Stable on skewed distributions | ❌ | ⚠️ | ✅ |
113
+ | Suitable for Otsu thresholding | ❌ | ⚠️ | ✅ |
114
+ | Multi-temporal direction preserved | ❌ | ❌ | ✅ |
115
+ | Output range | [0, 1] | Unbounded | [−1, 1] |
116
+
117
+ ---
118
+
119
+ ## Installation
120
+
121
+ ```bash
122
+ pip install zsplit
123
+ ```
124
+
125
+ ## Quick Start
126
+
127
+ ```python
128
+ from zsplit import normalize
129
+
130
+ result = normalize(your_bipolar_index)
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Practical Applications in Remote Sensing
136
+
137
+ Z-Split addresses a critical problem in any workflow involving bipolar indices across time or sensors:
138
+
139
+ **1. Change Detection**
140
+ Applying Min-Max before change detection introduces artificial trends that appear as land cover change but reflect only normalization artifacts. A report showing "15% vegetation decline" may be entirely attributable to normalization, not reality.
141
+
142
+ **2. Time Series Analysis**
143
+ Studies tracking floods, drought, or urban expansion over time require a clean temporal signal. Min-Max corrupts this signal by rescaling each scene independently to [0, 1], making year-to-year comparisons unreliable.
144
+
145
+ **3. Multi-temporal Machine Learning**
146
+ Models trained on Min-Max normalized multi-year data learn spurious patterns introduced by normalization rather than real spectral change. Z-Split ensures the training signal reflects actual surface conditions.
147
+
148
+ **4. InSAR and Displacement Monitoring**
149
+ In LOS displacement data, zero means no movement. Shifting zero through Min-Max misclassifies stable pixels as deforming, directly corrupting subsidence or uplift maps.
150
+
151
+ ---
152
+
153
+ ## Validation
154
+
155
+ ### 1. NDWI — Optical Remote Sensing
156
+
157
+ Tested on Sentinel-2 NDWI data. Z-Split successfully expanded near-zero clustered values while preserving the original image structure, producing contrast-enhanced output suitable for thresholding and multi-temporal comparison.
158
+
159
+ ### 2. Multi-Temporal Change Analysis — NDVI, Riyadh 2018–2024
160
+
161
+ Validated on four Sentinel-2 NDVI scenes (March–April, 2018–2020–2022–2024) over Riyadh, Saudi Arabia (scale: 10 m, 5603 × 5129 pixels per scene) across 11,424 spatial patches.
162
+
163
+ #### A. Normalization Artifact Analysis
164
+
165
+ The figure below shows the deviation of each normalization method from the raw temporal signal. Min-Max introduces large artificial trends across the entire scene (colored map). Z-Split introduces virtually no deviation (near-white map).
166
+
167
+ ![Deviation Analysis](https://raw.githubusercontent.com/aalmoadi/endwi/main/Figures/deviation_analysis.png)
168
+
169
+ | Method | Mean Absolute Deviation | Std |
170
+ |--------|:-----------------------:|:---:|
171
+ | Min-Max | 0.1858 | 0.2091 |
172
+ | **Z-Split** | **0.0013** | **0.0017** |
173
+
174
+ Z-Split preserves the temporal signal with **143× greater fidelity** than Min-Max.
175
+
176
+ #### B. Linear Trend (Slope per pixel, 2018–2024)
177
+
178
+ | Method | Mean Slope | Std | Correlation with Raw |
179
+ |--------|:----------:|:---:|:--------------------:|
180
+ | Raw (no normalization) | 0.000894 | 0.0165 | — |
181
+ | Min-Max | 0.027454 | 0.2170 | r = 0.511 |
182
+ | **Z-Split** | **−0.000120** | **0.0167** | **r = 0.995** |
183
+
184
+ #### C. Multi-Temporal Change Maps
185
+
186
+ The figure below compares Linear Trend, Anomaly, and Coefficient of Variation maps across all three methods. Z-Split maps are visually and statistically consistent with raw data; Min-Max maps show spatially inverted anomaly patterns and 5.5× inflated variability.
187
+
188
+ ![Change Analysis](https://raw.githubusercontent.com/aalmoadi/endwi/main/Figures/change_analysis.png)
189
+
190
+ | Method | Mean CV |
191
+ |--------|:-------:|
192
+ | Raw | 0.150 |
193
+ | **Z-Split** | **0.173** |
194
+ | Min-Max | 0.832 |
195
+
196
+ #### D. Threshold Stability (Otsu across 11,424 patches)
197
+
198
+ | Method | Threshold Std |
199
+ |--------|:-------------:|
200
+ | Min-Max | 0.0882 |
201
+ | Z-Split | 0.2220 |
202
+ | Z-Score | 1.2012 |
203
+
204
+ > **Note:** For strongly unipolar NDVI in arid urban areas, Min-Max threshold stability is comparable to Z-Split. Z-Split's primary advantage is in bipolar indices with narrow near-zero distributions (NDWI, InSAR LOS), consistent with its design objective.
205
+
206
+ ---
207
+
208
+ ## Application Scope
209
+
210
+ Most effective when:
211
+ - Values cluster near zero (NDWI in arid regions, InSAR LOS over stable terrain)
212
+ - Multi-temporal consistency is required (change detection, time series analysis)
213
+ - Otsu or zero-based thresholding is applied
214
+ - Cross-scene or cross-sensor comparisons are performed
215
+
216
+ ---
217
+
218
+ ## Files
219
+
220
+ | File | Description |
221
+ |------|-------------|
222
+ | `zsplit_normalization.ipynb` | Jupyter Notebook with visual demonstration |
223
+ | `zsplit_arcpy.py` | ArcGIS Pro implementation |
224
+ | `Z-Split_Normalization/Validation/` | Multi-temporal NDVI change analysis |
225
+ | `Validation/01_Optical_ENDWI/` | Optical NDWI validation |
226
+
227
+ ---
228
+
229
+ ## Author
230
+
231
+ **Abdulrhman Almoadi**
232
+ King Abdulaziz City for Science and Technology (KACST)
233
+
234
+ ---
235
+
236
+ ## Citation
237
+
238
+ If you use Z-Split, please cite:
239
+
240
+ > Almoadi, A.: Reducing False Alarms in Urban Flood Detection: An Enhanced NDWI (ENDWI) with Hybrid Max Fusion on Sentinel-2 Data, EGUsphere [preprint], https://doi.org/10.5194/egusphere-2026-672, 2026.
zsplit-1.0.0/PKG-INFO DELETED
@@ -1,135 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: zsplit
3
- Version: 1.0.0
4
- Summary: Z-Split Normalization: Zero-Preserving Split Normalization for bipolar spectral indices
5
- Author-email: Abdulrhman Almoadi <aalmoadi@kacst.edu.sa>
6
- License: MIT License
7
-
8
- Copyright (c) 2026 Abdulrhman Almoadi
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
28
- Project-URL: Homepage, https://github.com/aalmoadi/endwi
29
- Project-URL: Repository, https://github.com/aalmoadi/endwi
30
- Project-URL: Documentation, https://github.com/aalmoadi/endwi/tree/main/Z-Split_Normalization
31
- Project-URL: Bug Tracker, https://github.com/aalmoadi/endwi/issues
32
- Project-URL: DOI, https://doi.org/10.5281/zenodo.20602710
33
- Project-URL: Paper, https://doi.org/10.5194/egusphere-2026-672
34
- Keywords: normalization,remote-sensing,flood-detection,spectral-index,ENDWI,NDWI,bipolar,zero-preserving,Otsu,GIS,GeoAI,machine-learning,deep-learning,SAR,Sentinel-2
35
- Classifier: Development Status :: 5 - Production/Stable
36
- Classifier: Intended Audience :: Science/Research
37
- Classifier: License :: OSI Approved :: MIT License
38
- Classifier: Programming Language :: Python :: 3
39
- Classifier: Programming Language :: Python :: 3.8
40
- Classifier: Programming Language :: Python :: 3.9
41
- Classifier: Programming Language :: Python :: 3.10
42
- Classifier: Programming Language :: Python :: 3.11
43
- Classifier: Programming Language :: Python :: 3.12
44
- Classifier: Topic :: Scientific/Engineering :: GIS
45
- Classifier: Topic :: Scientific/Engineering :: Image Processing
46
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
47
- Requires-Python: >=3.8
48
- Description-Content-Type: text/markdown
49
- License-File: LICENSE
50
- Requires-Dist: numpy>=1.20
51
- Provides-Extra: raster
52
- Requires-Dist: rasterio>=1.2; extra == "raster"
53
- Provides-Extra: dev
54
- Requires-Dist: pytest; extra == "dev"
55
- Requires-Dist: rasterio>=1.2; extra == "dev"
56
- Requires-Dist: matplotlib; extra == "dev"
57
- Dynamic: license-file
58
-
59
- # zsplit — Zero-Preserving Split Normalization
60
-
61
- [![PyPI version](https://badge.fury.io/py/zsplit.svg)](https://pypi.org/project/zsplit/)
62
- [![DOI](https://zenodo.org/badge/1037018439.svg)](https://doi.org/10.5281/zenodo.20602709)
63
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
64
-
65
- A normalization technique for **bipolar spectral indices** where **zero carries physical meaning as a class boundary** (e.g., water vs. non-water in flood detection).
66
-
67
- ## Installation
68
-
69
- ```bash
70
- pip install zsplit
71
- ```
72
-
73
- With raster support:
74
-
75
- ```bash
76
- pip install zsplit[raster]
77
- ```
78
-
79
- ## Quick Start
80
-
81
- ```python
82
- import numpy as np
83
- from zsplit import normalize
84
-
85
- # Simulated raw ENDWI values (DN scale — extremely narrow range)
86
- arr = np.array([-0.00041, -0.00020, 0.0, 0.00008, 0.00015])
87
-
88
- result = normalize(arr)
89
- print(result)
90
- # [-1. -0.488 0. 0.533 1. ]
91
- ```
92
-
93
- ## Raster Support
94
-
95
- ```python
96
- from zsplit import normalize_raster
97
-
98
- normalize_raster('ENDWI_raw.tif', 'ENDWI_zsplit.tif')
99
- ```
100
-
101
- ## Formula
102
-
103
- ```
104
- ⎧ x / max(X⁺) if x > 0 → [0, 1]
105
- Z(x) = ⎨ 0 if x = 0 → 0 (preserved)
106
- ⎩ x / |min(X⁻)| if x < 0 → [-1, 0]
107
- ```
108
-
109
- ## Why Z-Split?
110
-
111
- | Property | Min-Max | Z-Score | **Z-Split** |
112
- |---|---|---|---|
113
- | Preserves zero as class boundary | ❌ | ❌ | ✅ |
114
- | Stable on narrow near-zero ranges | ❌ | ⚠️ | ✅ |
115
- | Suitable for Otsu thresholding | ❌ | ⚠️ | ✅ |
116
- | Handles skewed distributions | ❌ | ⚠️ | ✅ |
117
- | Multi-temporal direction preserved | ❌ | ❌ | ✅ |
118
- | Output range | [0, 1] | Unbounded | **[−1, 1]** |
119
-
120
- ## Citation
121
-
122
- ```bibtex
123
- @article{almoadi2026endwi,
124
- author = {Almoadi, Abdulrhman},
125
- title = {Reducing False Alarms in Urban Flood Detection: An Enhanced NDWI (ENDWI)
126
- with Hybrid Max Fusion on Sentinel-2 Data},
127
- journal = {EGUsphere [preprint]},
128
- year = {2026},
129
- doi = {10.5194/egusphere-2026-672}
130
- }
131
- ```
132
-
133
- ## License
134
-
135
- MIT License
zsplit-1.0.0/README.md DELETED
@@ -1,77 +0,0 @@
1
- # zsplit — Zero-Preserving Split Normalization
2
-
3
- [![PyPI version](https://badge.fury.io/py/zsplit.svg)](https://pypi.org/project/zsplit/)
4
- [![DOI](https://zenodo.org/badge/1037018439.svg)](https://doi.org/10.5281/zenodo.20602709)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
-
7
- A normalization technique for **bipolar spectral indices** where **zero carries physical meaning as a class boundary** (e.g., water vs. non-water in flood detection).
8
-
9
- ## Installation
10
-
11
- ```bash
12
- pip install zsplit
13
- ```
14
-
15
- With raster support:
16
-
17
- ```bash
18
- pip install zsplit[raster]
19
- ```
20
-
21
- ## Quick Start
22
-
23
- ```python
24
- import numpy as np
25
- from zsplit import normalize
26
-
27
- # Simulated raw ENDWI values (DN scale — extremely narrow range)
28
- arr = np.array([-0.00041, -0.00020, 0.0, 0.00008, 0.00015])
29
-
30
- result = normalize(arr)
31
- print(result)
32
- # [-1. -0.488 0. 0.533 1. ]
33
- ```
34
-
35
- ## Raster Support
36
-
37
- ```python
38
- from zsplit import normalize_raster
39
-
40
- normalize_raster('ENDWI_raw.tif', 'ENDWI_zsplit.tif')
41
- ```
42
-
43
- ## Formula
44
-
45
- ```
46
- ⎧ x / max(X⁺) if x > 0 → [0, 1]
47
- Z(x) = ⎨ 0 if x = 0 → 0 (preserved)
48
- ⎩ x / |min(X⁻)| if x < 0 → [-1, 0]
49
- ```
50
-
51
- ## Why Z-Split?
52
-
53
- | Property | Min-Max | Z-Score | **Z-Split** |
54
- |---|---|---|---|
55
- | Preserves zero as class boundary | ❌ | ❌ | ✅ |
56
- | Stable on narrow near-zero ranges | ❌ | ⚠️ | ✅ |
57
- | Suitable for Otsu thresholding | ❌ | ⚠️ | ✅ |
58
- | Handles skewed distributions | ❌ | ⚠️ | ✅ |
59
- | Multi-temporal direction preserved | ❌ | ❌ | ✅ |
60
- | Output range | [0, 1] | Unbounded | **[−1, 1]** |
61
-
62
- ## Citation
63
-
64
- ```bibtex
65
- @article{almoadi2026endwi,
66
- author = {Almoadi, Abdulrhman},
67
- title = {Reducing False Alarms in Urban Flood Detection: An Enhanced NDWI (ENDWI)
68
- with Hybrid Max Fusion on Sentinel-2 Data},
69
- journal = {EGUsphere [preprint]},
70
- year = {2026},
71
- doi = {10.5194/egusphere-2026-672}
72
- }
73
- ```
74
-
75
- ## License
76
-
77
- MIT License
@@ -1,135 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: zsplit
3
- Version: 1.0.0
4
- Summary: Z-Split Normalization: Zero-Preserving Split Normalization for bipolar spectral indices
5
- Author-email: Abdulrhman Almoadi <aalmoadi@kacst.edu.sa>
6
- License: MIT License
7
-
8
- Copyright (c) 2026 Abdulrhman Almoadi
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
28
- Project-URL: Homepage, https://github.com/aalmoadi/endwi
29
- Project-URL: Repository, https://github.com/aalmoadi/endwi
30
- Project-URL: Documentation, https://github.com/aalmoadi/endwi/tree/main/Z-Split_Normalization
31
- Project-URL: Bug Tracker, https://github.com/aalmoadi/endwi/issues
32
- Project-URL: DOI, https://doi.org/10.5281/zenodo.20602710
33
- Project-URL: Paper, https://doi.org/10.5194/egusphere-2026-672
34
- Keywords: normalization,remote-sensing,flood-detection,spectral-index,ENDWI,NDWI,bipolar,zero-preserving,Otsu,GIS,GeoAI,machine-learning,deep-learning,SAR,Sentinel-2
35
- Classifier: Development Status :: 5 - Production/Stable
36
- Classifier: Intended Audience :: Science/Research
37
- Classifier: License :: OSI Approved :: MIT License
38
- Classifier: Programming Language :: Python :: 3
39
- Classifier: Programming Language :: Python :: 3.8
40
- Classifier: Programming Language :: Python :: 3.9
41
- Classifier: Programming Language :: Python :: 3.10
42
- Classifier: Programming Language :: Python :: 3.11
43
- Classifier: Programming Language :: Python :: 3.12
44
- Classifier: Topic :: Scientific/Engineering :: GIS
45
- Classifier: Topic :: Scientific/Engineering :: Image Processing
46
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
47
- Requires-Python: >=3.8
48
- Description-Content-Type: text/markdown
49
- License-File: LICENSE
50
- Requires-Dist: numpy>=1.20
51
- Provides-Extra: raster
52
- Requires-Dist: rasterio>=1.2; extra == "raster"
53
- Provides-Extra: dev
54
- Requires-Dist: pytest; extra == "dev"
55
- Requires-Dist: rasterio>=1.2; extra == "dev"
56
- Requires-Dist: matplotlib; extra == "dev"
57
- Dynamic: license-file
58
-
59
- # zsplit — Zero-Preserving Split Normalization
60
-
61
- [![PyPI version](https://badge.fury.io/py/zsplit.svg)](https://pypi.org/project/zsplit/)
62
- [![DOI](https://zenodo.org/badge/1037018439.svg)](https://doi.org/10.5281/zenodo.20602709)
63
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
64
-
65
- A normalization technique for **bipolar spectral indices** where **zero carries physical meaning as a class boundary** (e.g., water vs. non-water in flood detection).
66
-
67
- ## Installation
68
-
69
- ```bash
70
- pip install zsplit
71
- ```
72
-
73
- With raster support:
74
-
75
- ```bash
76
- pip install zsplit[raster]
77
- ```
78
-
79
- ## Quick Start
80
-
81
- ```python
82
- import numpy as np
83
- from zsplit import normalize
84
-
85
- # Simulated raw ENDWI values (DN scale — extremely narrow range)
86
- arr = np.array([-0.00041, -0.00020, 0.0, 0.00008, 0.00015])
87
-
88
- result = normalize(arr)
89
- print(result)
90
- # [-1. -0.488 0. 0.533 1. ]
91
- ```
92
-
93
- ## Raster Support
94
-
95
- ```python
96
- from zsplit import normalize_raster
97
-
98
- normalize_raster('ENDWI_raw.tif', 'ENDWI_zsplit.tif')
99
- ```
100
-
101
- ## Formula
102
-
103
- ```
104
- ⎧ x / max(X⁺) if x > 0 → [0, 1]
105
- Z(x) = ⎨ 0 if x = 0 → 0 (preserved)
106
- ⎩ x / |min(X⁻)| if x < 0 → [-1, 0]
107
- ```
108
-
109
- ## Why Z-Split?
110
-
111
- | Property | Min-Max | Z-Score | **Z-Split** |
112
- |---|---|---|---|
113
- | Preserves zero as class boundary | ❌ | ❌ | ✅ |
114
- | Stable on narrow near-zero ranges | ❌ | ⚠️ | ✅ |
115
- | Suitable for Otsu thresholding | ❌ | ⚠️ | ✅ |
116
- | Handles skewed distributions | ❌ | ⚠️ | ✅ |
117
- | Multi-temporal direction preserved | ❌ | ❌ | ✅ |
118
- | Output range | [0, 1] | Unbounded | **[−1, 1]** |
119
-
120
- ## Citation
121
-
122
- ```bibtex
123
- @article{almoadi2026endwi,
124
- author = {Almoadi, Abdulrhman},
125
- title = {Reducing False Alarms in Urban Flood Detection: An Enhanced NDWI (ENDWI)
126
- with Hybrid Max Fusion on Sentinel-2 Data},
127
- journal = {EGUsphere [preprint]},
128
- year = {2026},
129
- doi = {10.5194/egusphere-2026-672}
130
- }
131
- ```
132
-
133
- ## License
134
-
135
- MIT License
File without changes
File without changes
File without changes
File without changes