Skip to content

Conversation

@conbrad
Copy link
Collaborator

@conbrad conbrad commented Dec 12, 2025

Adds new SFMS Insights page with interactive map visualization of fire weather raster data (GeoTIFF) from BC government object store.

Features:

  • 6 Fire Weather Indices: FWI, DMC, DC, FFMC, BUI, ISI with proper color ramps and class breaks
  • Dynamic Visualization: Hover tooltips showing pixel values, auto-updating legend per raster type
  • Date Picker: ASA-style date picker for historical and forecast data
  • Snow Layer: PMTiles-based snow coverage overlay
  • Loading/Error States: Visual feedback during raster tile loading
  • wps_tools.generate_sfms_cog script and launch config to selectively generate COGs for the frontend (currently ran for June 27, 2025)

Technical Implementation:

  • Backend: FastAPI proxy endpoint for streaming S3 GeoTIFF files (bypasses CORS, supports Range requests, requires auth)
  • Frontend: WebGLTile layers with dynamic color expressions, requesting cogs from object store proxy
  • NoData Handling: Dual approach (GeoTIFF source parameter + color expression thresholds)
  • Config-Driven: Centralized RASTER_CONFIG for labels and color breaks across all raster types

Closes #4169
Closes #4170
Closes #4182
Closes #4161
Closes #4171
Closes #4183
Closes #4959

Test Links:

Landing Page
MoreCast
Percentile Calculator
C-Haines
FireCalc
FireCalc bookmark
Auto Spatial Advisory (ASA)
HFI Calculator
SFMS Insights
Fire Watch

@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

❌ Patch coverage is 87.37864% with 117 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.31%. Comparing base (214636e) to head (4c71cd5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...es/sfmsInsights/components/map/layerDefinitions.ts 40.00% 23 Missing and 4 partials ⚠️
...atures/sfmsInsights/components/map/layerManager.ts 82.75% 3 Missing and 12 partials ⚠️
...c/features/sfmsInsights/components/map/SFMSMap.tsx 67.50% 6 Missing and 7 partials ⚠️
...fmsInsights/components/map/rasterTooltipHandler.ts 68.42% 7 Missing and 5 partials ⚠️
...shared/src/wps_shared/tests/geospatial/test_cog.py 92.80% 6 Missing and 3 partials ⚠️
...api/src/app/tests/utils/test_object_store_proxy.py 96.58% 7 Missing and 1 partial ⚠️
...nsights/components/map/RasterErrorNotification.tsx 80.00% 4 Missing and 3 partials ⚠️
...ckages/wps-shared/src/wps_shared/geospatial/cog.py 70.00% 3 Missing and 3 partials ⚠️
...nsights/components/map/rasterTooltipInteraction.ts 83.33% 0 Missing and 5 partials ⚠️
...ures/sfmsInsights/components/map/RasterTooltip.tsx 63.63% 3 Missing and 1 partial ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4949      +/-   ##
==========================================
+ Coverage   74.86%   75.31%   +0.45%     
==========================================
  Files         587      599      +12     
  Lines       27610    28515     +905     
  Branches     2045     2129      +84     
==========================================
+ Hits        20671    21477     +806     
- Misses       6360     6408      +48     
- Partials      579      630      +51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}

// Backward compatibility
export const fwiColourExpression = () => getFireWeatherColourExpression('fwi')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is used anywhere

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in: a732899

@conbrad conbrad requested review from brettedw and dgboss January 5, 2026 22:36
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 5, 2026

Comment on lines +48 to +69
warped = gdal.Warp(
"", # Empty string creates in-memory dataset
src_ds,
format="MEM",
dstSRS=target_srs,
resampleAlg=resample_alg.value,
)

if warped is None:
raise RuntimeError(f"Failed to warp raster to {target_srs}")

# Translate to COG format with auto-generated overviews
result = gdal.Translate(
output_path,
warped,
format="COG",
creationOptions=[
f"COMPRESS={compression}",
"BIGTIFF=IF_SAFER",
"OVERVIEWS=IGNORE_EXISTING", # Always create new overviews
],
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this: https://gdal.org/en/stable/drivers/raster/cog.html#reprojection-related-creation-options, I'm not sure we actually need the step of Warping first, it might all be able to be done in the COG creation options. Either way is fine I think, it would just remove a step potentially. Otherwise I think the creation and batch creation scripts look good!

Copy link
Collaborator

@brettedw brettedw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, great work!
My only thought is that we should follow it up soon with an 'About this data' button or something similar, since the rasters we're showing here are different from the ones in WF1. It would reduce confusion for anyone checking it out

Copy link
Collaborator

@dgboss dgboss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work and test coverage!

@conbrad conbrad deployed to production January 6, 2026 00:28 Active
@conbrad conbrad merged commit 244960e into main Jan 6, 2026
33 checks passed
@conbrad conbrad deleted the task/sfms-render-tifs branch January 6, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants