Skip to content

SFMS Refactor#5200

Draft
brettedw wants to merge 34 commits intomainfrom
task/sfms-daily-refactor
Draft

SFMS Refactor#5200
brettedw wants to merge 34 commits intomainfrom
task/sfms-daily-refactor

Conversation

@brettedw
Copy link
Collaborator

@brettedw brettedw commented Mar 9, 2026

  • shared raster setup lives in one place in grid.py
  • station data to array transformation lives in one place in fields.py
  • processors focus on parameter specific math
  • the daily actuals job builds raster jobs and runs them through one shared execution path in sfms_daily_actuals.py

Test Links:

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: other modules are singular, perhaps we could rename this field.py

def _build_lapse_rate_field(
actuals: List[SFMSDailyActual], attribute: str, lapse_rate: float, label: str
) -> ScalarField:
lats = np.array([a.lat for a in actuals], dtype=np.float32)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should probably do the _VALID_SFMS_ATTRIBUTES check here too.



def build_wind_vector_field(actuals: List[SFMSDailyActual]) -> WindVectorField:
valid = [s for s in actuals if s.wind_speed is not None and s.wind_direction is not None]
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should probably do the _VALID_SFMS_ATTRIBUTES check here too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can remove this file and all the sources since the methods have been pulled out to the build_* functions.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

y_size = ref_ds.ds.RasterYSize

with WPSDataset(mask_path) as mask_ds:
valid_mask = ref_ds.apply_mask(mask_ds.warp_to_match(ref_ds))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the mask_ds always need to be reprojected?

@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.91%. Comparing base (69eae2f) to head (84b55e7).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5200      +/-   ##
==========================================
+ Coverage   68.90%   68.91%   +0.01%     
==========================================
  Files         392      392              
  Lines       16373    16382       +9     
  Branches     1846     1848       +2     
==========================================
+ Hits        11281    11290       +9     
  Misses       4508     4508              
  Partials      584      584              

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants