Skip to content

Various bug fixes to allow vr_run to work with soil and abiotic_simple models#236

Merged
vgro merged 23 commits intodevelopfrom
bugfix/vr_run_problems
Jun 14, 2023
Merged

Various bug fixes to allow vr_run to work with soil and abiotic_simple models#236
vgro merged 23 commits intodevelopfrom
bugfix/vr_run_problems

Conversation

@jacobcook1995
Copy link
Copy Markdown
Collaborator

Description

This pull request is mainly small bug fixes to make the vr_run function runable for the abiotic_simple and soil models (using data stored on RDS).

The most substantive change is moving the definition of layer roles from the abiotic_simple model into the core utilities. This was necessary as the soil model also needed to make use of these layers roles (to find the index associated with the top soil layer).

This PR also updates the documentation to explain to users how to access the data (if they are part of the VR project), and updates the simulation flow documentation to reflect recent changes to the flow.

Fixes #235

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

@jacobcook1995
Copy link
Copy Markdown
Collaborator Author

Adding @vgro as a reviewer as I'm not sure of best practice when a pull request is cowritten

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 7, 2023

Codecov Report

Merging #236 (6ce98b8) into develop (299e39b) will increase coverage by 0.10%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop     #236      +/-   ##
===========================================
+ Coverage    95.23%   95.33%   +0.10%     
===========================================
  Files           36       40       +4     
  Lines         1553     1715     +162     
===========================================
+ Hits          1479     1635     +156     
- Misses          74       80       +6     
Impacted Files Coverage Δ
virtual_rainforest/core/data.py 88.60% <ø> (ø)
virtual_rainforest/core/utils.py 97.56% <100.00%> (+2.32%) ⬆️
...rest/models/abiotic_simple/abiotic_simple_model.py 100.00% <100.00%> (ø)
...nforest/models/abiotic_simple/simple_regression.py 100.00% <100.00%> (ø)
virtual_rainforest/models/soil/soil_model.py 100.00% <100.00%> (ø)

... and 8 files with indirect coverage changes

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

Copy link
Copy Markdown
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

Copy link
Copy Markdown
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 - minor comment on using admonitions.

I think we should structure the main simulation document a bit more (and introduce all of the defined steps, even if they are currently lightly used). I was going to make suggestions, but instead I'm going to commit a suggested update. I've updated the Sphinx conf to include a mermaid diagram. I think that is useful here and it is probably something we'll want to use more of.

Comment on lines +197 to +201
**NOTE**: At the moment,
`core.data.variable` tags cannot be used across multiple toml config files without
causing `ConfigurationError: Duplicated entries in config files: core.data.variable` to
be raised. This means that all variables need to be combined in one `config` file.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it is worth explicitly using warning admonitions here. Partly that is that they look nice and call more attention to the warning, but it is then also easier to search for and review these kinds of messages.

Suggested change
**NOTE**: At the moment,
`core.data.variable` tags cannot be used across multiple toml config files without
causing `ConfigurationError: Duplicated entries in config files: core.data.variable` to
be raised. This means that all variables need to be combined in one `config` file.
```{warning}
At the moment,
`core.data.variable` tags cannot be used across multiple toml config files without
causing `ConfigurationError: Duplicated entries in config files: core.data.variable` to
be raised. This means that all variables need to be combined in one `config` file.
```

On another note - Myst has relatively recently gone to version 1.0.0 and there are some stabilised syntax things like using colon-fence notation. We should probably go through and update docs to use the recommended 1.0.0 syntax.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Actually it looks like we're currently pinned to myst-parser <1.0.0 by some myst-nb and sphinx version pins ( see executablebooks/MyST-NB#513). As and when that is resolved we should review our MyST content and syntax.

that setting is not found in the configuration, but if no default is set then the
validation will fail. Further details can be found in the [configuration
documentation](./core/config.md).
* [`AbioticModel`](../api/abiotic.md),
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think this probably should be abiotic_simple.md as that's the version we are using at the moment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good point - I've included both links since I think they will both be here to stay.

procedures to ensure that the loaded data can be mapped onto the spatial grid and also
other core dimensions for the configured simulation. Further details can be found in the
[data system](./core/data.md) and [core axes](./core/axes.md) documentation.
The core configuration will include the configuration details for each individual
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These details won't be in the core configuration

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah - clumsily phrased.

@vgro
Copy link
Copy Markdown
Collaborator

vgro commented Jun 13, 2023

LGTM - minor comment on using admonitions.

I think we should structure the main simulation document a bit more (and introduce all of the defined steps, even if they are currently lightly used). I was going to make suggestions, but instead I'm going to commit a suggested update. I've updated the Sphinx conf to include a mermaid diagram. I think that is useful here and it is probably something we'll want to use more of.

I like the idea of using the diagrams, however, they don't come out very nicely at the moment (e.g. the lines go over the text).

@davidorme
Copy link
Copy Markdown
Collaborator

Yeah - it definitely isn't as I'd like and I am normally really fussy about figures. That is mostly the tool: mermaid doesn't really do fine controls - or at least not without lots of tweaking of things. It does produce diagrams quickly though! We could replace this with a hand crafted image that we're happier with when things are stable, but this is quick to edit and update for now?

@vgro vgro merged commit c60e6cb into develop Jun 14, 2023
@vgro vgro deleted the bugfix/vr_run_problems branch June 14, 2023 08:21
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.

Move number of soil and canopy layers to core config

4 participants