Describe the bug
I've been going over the Variables PR #431 to try and push it along now that @vgro has broken the back of the update.
- I've updated all the variable descriptions
- I've updated all the model required vars sections.
- I'm going through the example log (which very helpfully prints out what data gets checked and set at each step - aren't we clever!) to validate all of the sections.
But as part of going through the log, I noticed a difference between the PlantsModel.from_config() and everything else. The other models do this (for example):
|
LOGGER.info( |
|
"Information required to initialise the litter model successfully " |
|
"extracted." |
|
) |
|
return cls( |
|
data=data, |
|
core_components=core_components, |
|
model_constants=model_constants, |
|
) |
Plants does this:
|
# Try and create the instance - safeguard against exceptions from __init__ |
|
try: |
|
inst = cls( |
|
data=data, |
|
core_components=core_components, |
|
flora=flora, |
|
model_constants=model_constants, |
|
) |
|
except Exception as excep: |
|
LOGGER.critical( |
|
f"Error creating plants model from configuration: {excep!s}" |
|
) |
|
raise excep |
|
|
|
LOGGER.info("Plants model instance generated from configuration.") |
|
return inst |
Okay - so that is a little paranoid but there is a practical difference in the logging output. With plants, there is a message after all the init logging indicating model success. The other models report an intermediate step - they only claim to have extracted the information needed - but the messages read a bit like the __init__ has completed and then are followed by all the logging messages.
I think we should shift to using a Plants like setup for all model - it makes the logs clearer - but we should be consistent either way.
To Reproduce
Run ve_example and look at the log.
Describe the bug
I've been going over the Variables PR #431 to try and push it along now that @vgro has broken the back of the update.
But as part of going through the log, I noticed a difference between the PlantsModel.from_config() and everything else. The other models do this (for example):
virtual_ecosystem/virtual_ecosystem/models/litter/litter_model.py
Lines 171 to 179 in a27518a
Plants does this:
virtual_ecosystem/virtual_ecosystem/models/plants/plants_model.py
Lines 154 to 169 in a27518a
Okay - so that is a little paranoid but there is a practical difference in the logging output. With plants, there is a message after all the init logging indicating model success. The other models report an intermediate step - they only claim to have extracted the information needed - but the messages read a bit like the
__init__has completed and then are followed by all the logging messages.I think we should shift to using a Plants like setup for all model - it makes the logs clearer - but we should be consistent either way.
To Reproduce
Run
ve_exampleand look at the log.