Adding two new indices (NDWI and VCI) - #22
Closed
astroAycha wants to merge 2 commits into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
Adds two additional vegetation/water-related indices (NDWI, VCI) to the existing spectral-index extraction pipeline and exposes them in the Dash dashboard, so AOI time-series visualizations can incorporate more wildfire-relevant signals derived from Sentinel-2/HLS bands.
Changes:
- Added NDWI and VCI computations to
SpectralIndices. - Extended the data download/extraction pipeline to compute/store NDWI and VCI in the time-series parquet output.
- Updated the Dash app to load and render NDWI/VCI charts alongside existing indices.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/spec_indices.py | Adds calc_ndwi and calc_vci spectral index helpers. |
| scripts/data_download.py | Computes NDWI/VCI time series and writes them into the AOI parquet outputs; updates logging summary. |
| app.py | Adds NDWI/VCI metadata, reads NDWI/VCI columns from parquet, and renders two additional charts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+141
to
+143
| print("Calculating Normalized Difference Water Index (NDWI)...") | ||
| denominator = nir + swir1 | ||
| return xr.where(denominator != 0, (nir - swir1) / denominator, np.nan) |
Comment on lines
+81
to
85
| tbl = pq.read_table( | ||
| buf, | ||
| columns=["time", "ndvi", "bsi", "ndmi", "nbr", "ndwi", "vci", "aoi_name"], | ||
| ) | ||
| dfs.append(tbl.to_pandas()) |
Comment on lines
+253
to
+255
| vci = SpectralIndices.calc_vci(ndvi_mean_ts) | ||
| vci_mean_ts = vci.groupby("time.week").mean(dim=['x', 'y']).interp(method='nearest') | ||
| spec_indices_ts.append(vci_mean_ts) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding two new indices (NDWI and VCI). These two are calculated from Sentinel-2 bands. They are better indices for tracking conditions that could lead to wildfires.