Skip to content

Comments

Update jmodel: model cards, invalid value masking#48

Merged
iulusoy merged 16 commits intomainfrom
update-jmodel
Jan 15, 2026
Merged

Update jmodel: model cards, invalid value masking#48
iulusoy merged 16 commits intomainfrom
update-jmodel

Conversation

@iulusoy
Copy link
Member

@iulusoy iulusoy commented Jan 12, 2026

This closes #32
This addresses #22 #20

  • update pre-commit hooks to use ruff
  • apply zero value to masked values for J-model
    • here we need two different masks: one for nan -> should result in empty values
    • one mask for negative temperatures: should result in zero values
  • do not use random values in array for testing run_model for J-model
  • test that masked values get set to the correct values for R0
  • add model cards and model readme

Also: fix some Jmodel tests, plus we need to see if we do need the geometry cropping (see discussion on file).

@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.89%. Comparing base (11bf4c8) to head (475fe60).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #48      +/-   ##
==========================================
+ Coverage   94.46%   94.89%   +0.42%     
==========================================
  Files          10       10              
  Lines         705      686      -19     
  Branches       78       73       -5     
==========================================
- Hits          666      651      -15     
+ Misses         24       22       -2     
+ Partials       15       13       -2     

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the J-model implementation to improve handling of invalid temperature values and adds comprehensive model card documentation for the HeiPlanet modeling suite. The PR also modernizes the pre-commit hooks to use ruff instead of black and flake8.

Changes:

  • Implemented distinct masking for NaN (water areas) vs. out-of-range temperatures in J-model R0 calculation
  • Updated pre-commit hooks from black/flake8 to ruff for linting and formatting
  • Added model cards (YAML and Markdown) for WNV-R0 and Aedes albopictus population models

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
.pre-commit-config.yaml Replaced black and flake8 with ruff for linting and formatting
src/heiplanet_models/Jmodel.py Modified _interpolate_r0 to handle NaN and out-of-range temperatures differently; commented out geometry clipping
src/heiplanet_models/utils.py Reformatted lambda function parameters across multiple lines
test/test_JModel.py Updated tests to verify masking behavior and corrected coordinate assertions
test/test_utils.py Reformatted lambda function parameters across multiple lines
test/conftest.py Changed test data from random to deterministic with deliberate NaN insertion
test/Pmodel/test_Pmodel_initial.py Added noqa comments to lambda functions
docs/sources/model_jmodel_python.ipynb Minor formatting changes and kernel version update
model_cards/WNV-R0_model_card.yaml New comprehensive model card for WNV-R0 model
model_cards/WNV-R0_model_card.md New markdown version of WNV-R0 model card
model_cards/Aedes_albopictus_population_model_card.md New model card for Aedes albopictus population model
model_cards/README.md New overview README for the model card suite
model_cards/HeiPlanet_model_comparison.yaml New file comparing the two models
model_cards/HeiPlanet_harmonized_model_cards.yaml New harmonized model card schema

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@iulusoy iulusoy requested a review from MaHaWo January 12, 2026 17:00
@iulusoy
Copy link
Member Author

iulusoy commented Jan 12, 2026

@MaHaWo please review and make changes as you seem fit, I can also do the refactor of the geometry issues if needed.

Copy link
Collaborator

@MaHaWo MaHaWo left a comment

Choose a reason for hiding this comment

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

looks good, thank you! the only comment I have is about the -10/ 0.0 values for the masking, which is an implemenation detail though and no game breaker. I can implement the changes mentioned, but pls add your comments to existing discussions first as you see fit.

@iulusoy
Copy link
Member Author

iulusoy commented Jan 13, 2026

looks good, thank you! the only comment I have is about the -10/ 0.0 values for the masking, which is an implemenation detail though and no game breaker. I can implement the changes mentioned, but pls add your comments to existing discussions first as you see fit.

So, there are two more changes for this PR:

  • change the -10 to NaN, and the tests accordingly
  • remove the geometry checks and NUTS region functionality

I've added the comments above. Also Copilot was highlighting some more issues, which I did not check in detail.

@MaHaWo
Copy link
Collaborator

MaHaWo commented Jan 15, 2026

  • implemented changes mentioned
    • changed missing values indicator
    • adjusted tests
    • additional refactoring done for issues I noticed during this pass: correct some things with read_data, add explicit error handling
    • added explicit tests for failure modes
  • copilot comments where not particularly useful. all closed.

do you want to have another look @iulusoy ?

@iulusoy
Copy link
Member Author

iulusoy commented Jan 15, 2026

do you want to have another look @iulusoy ?

Thank you @MaHaWo , I will look at this later!

@sonarqubecloud
Copy link

@iulusoy iulusoy merged commit 926afe1 into main Jan 15, 2026
10 checks passed
@iulusoy iulusoy deleted the update-jmodel branch January 15, 2026 17:32
@MaHaWo MaHaWo mentioned this pull request Feb 16, 2026
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.

J-Model: Set negative temperatures to 0

2 participants