[InputManager][Inputs] Implement null input blobs#3098
Conversation
|
Current Coverage: 99% Mypy errors on null-input-blobs branch: 1144 |
|
🚨 Unauthorized changes detected in protected files. Please remove these changes if they are not intended. |
| om = OutputManager() | ||
| info_map = { | ||
| "class": FieldManager.__class__.__name__, | ||
| "function": FieldManager._setup_fertilizer_events.__name__, | ||
| } | ||
| om.add_error("No fertilizer data", "Field data provided with empty fertilizer data.", info_map) | ||
| raise ValueError("No fertilizer data") |
There was a problem hiding this comment.
I removed these checks to make these required since that doesn't align with simulations where we have field but aren't using fertilizer/manure/tillage scheduling and the new logic to not add data to the pool if the user has specified they aren't using this part of the model. I think when we get the C&S inputs overhauled/updated, the place to require this data accurately and coherently is alongside the other input files in the REQUIRED_METADATA_BLOBS check in IM.
| for metadata_property in metadata_properties.keys(): | ||
| if metadata_property == "data_collection_app_compatible": | ||
| continue | ||
| validation_properties = [key for key in metadata_properties if key != "data_collection_app_compatible"] |
There was a problem hiding this comment.
Did this to keep function under complexity limit.
|
Current Coverage: 99% Mypy errors on null-input-blobs branch: 1220 |
|
🚨 Unauthorized changes detected in protected files. Please remove these changes if they are not intended. |
matthew7838
left a comment
There was a problem hiding this comment.
LGTM, minor cleanups required. Great work, Niko.
allisterakun
left a comment
There was a problem hiding this comment.
LGTM! Just two very minor comments
|
Current Coverage: 99% Mypy errors on null-input-blobs branch: 1220 |
|
🚨 Unauthorized changes detected in protected files. Please remove these changes if they are not intended. |
|
Current Coverage: 99% Mypy errors on null-input-blobs branch: 1138 |
|
🚨 Unauthorized changes detected in protected files. Please remove these changes if they are not intended. |
|
Current Coverage: 99% Mypy errors on null-input-blobs branch: 1138 |
|
🚨 Unauthorized changes detected in protected files. Please remove these changes if they are not intended. |
Context
Issue(s) closed by this pull request: closes #3036
What
exclude_from_poolbool.FieldManagerfor fertilizer/manure/tillage schedule data being required.requiredoptional bool arg toIM.get_data()to accommodate the current setup in the C&S module where we're looking up schedule data that might not be there given the new functionality of this PR where data not needed for a simulation will not be added to the IM pool in any way.Why
This prevents defaults from silently overriding the nulled inputs and adding the data to the pool.
How
Added helper function to IM to check for this new input
exclude_from_pooland to skip the data validation process and not add anything to the pool if it's present and true.Test plan
Switch to one of the simulation types that uses the nulled input blobs (
field_only,field_and_feed,animals_only) and add aget_data()call somewhere down the line for one of the inputs that has a default but is from a nulled input blob.Input Changes
Output Changes
Filter