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

simplify calculate_soil_carbon_updates() function #344

Open
jacobcook1995 opened this issue Nov 30, 2023 · 1 comment
Open

simplify calculate_soil_carbon_updates() function #344

jacobcook1995 opened this issue Nov 30, 2023 · 1 comment
Assignees

Comments

@jacobcook1995
Copy link
Collaborator

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)
@jacobcook1995
Copy link
Collaborator Author

@davidorme had some a helpful suggestions here, which I should bear in mind for the next time I need to simplify this function

@davidorme davidorme added this to the Soil model milestones milestone Sep 24, 2024
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

No branches or pull requests

2 participants