ImperialCollegeLondon / ImperialCollegeLondon/virtual_ecosystem

simplify calculate_soil_carbon_updates() function

Open
#344 1 comment 0 reactions 1 assignee Claimed by @jacobcook1995 View on GitHub
Dominant language
Python
Stars
20
Forks
5
Avg merge
2d 1h
Merged PRs (30d)
34

Description

**Is your feature request related to a problem? Please describe.**
The function to calculate the updates for the soil carbon pool (`calculate_soil_carbon_updates`) is much too complex, it's 150 lines long and has 17 arguments.

**Describe the solution you'd like**
I should remember to simplify the function. There should hopefully be an obvious moment to do this at some point when I'm adding more stuff to the soil model.

@alexdewar also suggested the following as good generic approaches to this sort of problem:

> 1. If lots of the arguments to this function are just being passed through to one or two other functions, you could just pass in the _results_ of these functions instead and have the caller calculate them
> 2. If some of the arguments would naturally group together, consider bundling them together in a class/dataclass (provided that this function won't be the only user of it)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.