Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt extended LayerStructure functionality #459

Merged
merged 28 commits into from
Jul 2, 2024

Conversation

davidorme
Copy link
Collaborator

@davidorme davidorme commented Jun 27, 2024

Description

This PR is taking the code in develop and applying the new API for the LayerStructure from #452, which has been merged down into this.

The main changes are:

  • In the models, replacing locally calculated vertical indices with the core LayerStructure indices.
  • Replacing the LayerStructure.role_indices['canopy'] approach from the first pass in Amending vertical layer structure #441, which has been deprecated in favour of explicit per role attributes (LayerStructure.index_canopy).
  • In the tests, updating tests to accept the central fixture_core_components and then systematically using the from_template and index attributes to generate expected and test values, replacing hard coded integer layer indices with layer specific indices from the fixture_core_components.LayerStructure instance.

Fixes #451 and #458

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works
  • Relevant documentation reviewed and updated

@davidorme davidorme linked an issue Jun 27, 2024 that may be closed by this pull request
@davidorme davidorme marked this pull request as ready for review June 28, 2024 15:52
@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 97.56098% with 4 lines in your changes missing coverage. Please review.

Project coverage is 94.95%. Comparing base (94e29ca) to head (998e0ac).

Files Patch % Lines
virtual_ecosystem/core/core_components.py 96.72% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #459      +/-   ##
===========================================
- Coverage    94.96%   94.95%   -0.01%     
===========================================
  Files           70       70              
  Lines         3792     3869      +77     
===========================================
+ Hits          3601     3674      +73     
- Misses         191      195       +4     

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

Copy link
Collaborator

@jacobcook1995 jacobcook1995 left a comment

Choose a reason for hiding this comment

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

LGTM (though I only looked at the soil related stuff)!

tests/conftest.py Show resolved Hide resolved
virtual_ecosystem/core/core_components.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@vgro vgro left a comment

Choose a reason for hiding this comment

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

LGTM, a few comments that are probably for another PR.

@davidorme davidorme merged commit 92de3ee into develop Jul 2, 2024
12 checks passed
@davidorme davidorme deleted the 458-adopt-extended-layerstructure-functionality branch July 2, 2024 14:05
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.

Adopt extended LayerStructure functionality Add dynamic filled canopy index to LayerStructure.
4 participants