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

Draft high level function to setup and run simulation #112

Merged
merged 33 commits into from
Nov 17, 2022

Conversation

jacobcook1995
Copy link
Collaborator

@jacobcook1995 jacobcook1995 commented Nov 14, 2022

Description

I've written a draft of the high level function to setup and run the virtual_rainforest model. Most of this function is just a set of TODOs at the moment, but config validation and model configuration is currently performed. This involved defining functions to extract the models to be configured from the config object, and to actually configure a set of models which can then be used downstream.

While doing this I also changed error handling a bit to ensure that the user is provided with the maximum amount of useful information, e.g. report all models that fail to configure before ending the process, and reporting all schema validation errors rather than just the first.

Fixes #98
Fixes #100

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

Copy link
Collaborator

@davidorme davidorme left a comment

Choose a reason for hiding this comment

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

The main structure looks good - some thoughts about where errors get raised and a minor point about string formatting in logging

virtual_rainforest/main.py Outdated Show resolved Hide resolved
virtual_rainforest/main.py Outdated Show resolved Hide resolved
virtual_rainforest/main.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Nov 14, 2022

Codecov Report

Merging #112 (d3ab96e) into develop (5567582) will increase coverage by 0.48%.
The diff coverage is 94.02%.

@@             Coverage Diff             @@
##           develop     #112      +/-   ##
===========================================
+ Coverage    95.90%   96.38%   +0.48%     
===========================================
  Files            9       10       +1     
  Lines          366      415      +49     
===========================================
+ Hits           351      400      +49     
  Misses          15       15              
Impacted Files Coverage Δ
virtual_rainforest/main.py 90.32% <90.32%> (ø)
virtual_rainforest/soil/model.py 94.87% <93.75%> (+6.30%) ⬆️
virtual_rainforest/__init__.py 100.00% <100.00%> (ø)
virtual_rainforest/core/config.py 98.17% <100.00%> (+0.80%) ⬆️
virtual_rainforest/core/model.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

As usual, I've reviewed the new code and will work on the tests once this is sorted out.

Good first attempt as having something that runs!!

virtual_rainforest/core/config.py Outdated Show resolved Hide resolved
virtual_rainforest/core/model.py Outdated Show resolved Hide resolved
virtual_rainforest/main.py Outdated Show resolved Hide resolved
virtual_rainforest/main.py Outdated Show resolved Hide resolved
virtual_rainforest/main.py Outdated Show resolved Hide resolved
virtual_rainforest/main.py Outdated Show resolved Hide resolved
virtual_rainforest/soil/model.py Outdated Show resolved Hide resolved
virtual_rainforest/soil/model.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

Very nice! Nothing more to add!

Copy link
Collaborator

@davidorme davidorme left a comment

Choose a reason for hiding this comment

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

LGTM.

@jacobcook1995 jacobcook1995 merged commit 4abb60f into develop Nov 17, 2022
@jacobcook1995 jacobcook1995 deleted the feature/vr_run branch November 17, 2022 09:17
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.

High level run_vr function Function to initialise set of models
5 participants