Skip to content

Conversation

@douglatornell
Copy link
Member

Overview

This pull request introduces the _salinity_match() function to enable matching of model field values to observations based on salinity. It also includes comprehensive unit tests for the function to ensure its reliability across varying scenarios.

Changes

  • Added _salinity_match() function for model-to-observation comparisons, matching observed salinity with nearest model-calculated salinity.
  • Implemented unit tests for _salinity_match() to handle cases such as missing variables, successful matches, or no matches. Mock objects are employed to simulate datasets.

Checklist

  • Ensured code follows the project's style guidelines.
  • Checked that existing and new tests pass.
  • Included documentation updates, if applicable.

Introduced a new `_salinity_match()` function to find model field values that
match observations by matching the observed salinity with the nearest salinity
value calculated by the model. The code is based on the `_salinityMatch()`
function that Karyn developed for use in notebooks like
`analysis-karyn/notebooks/Evaluations
/OA_PugetSound_CarbonateChemModelvsObsMatches20072024_v202111_qualcontrol_MatchbySalinity.ipynb`.
Introduced tests for the `_salinity_match()` function to verify its behaviour in
various scenarios, ensuring its robustness. Added cases for missing salinity
variables, successful matches, and no matching salinity, incorporating mock
objects for dataset simulation.
@douglatornell douglatornell added enhancement New feature or request SalishSeaTools labels Sep 17, 2025
@github-actions github-actions bot added this to the v25.1 milestone Sep 17, 2025
@codecov
Copy link

codecov bot commented Sep 17, 2025

Codecov Report

❌ Patch coverage is 96.45390% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.50%. Comparing base (4ac5168) to head (3211383).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
SalishSeaTools/salishsea_tools/evaltools.py 92.85% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #159      +/-   ##
==========================================
+ Coverage   47.16%   48.50%   +1.34%     
==========================================
  Files          35       36       +1     
  Lines        5025     5166     +141     
==========================================
+ Hits         2370     2506     +136     
- Misses       2655     2660       +5     
Flag Coverage Δ
unittests 48.50% <96.45%> (+1.34%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@douglatornell douglatornell marked this pull request as draft September 17, 2025 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request SalishSeaTools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants