Skip to content

[Crop and Soil] Enable crop and soil only simulation run#2932

Open
matthew7838 wants to merge 34 commits intodevfrom
separate-feed-run
Open

[Crop and Soil] Enable crop and soil only simulation run#2932
matthew7838 wants to merge 34 commits intodevfrom
separate-feed-run

Conversation

@matthew7838
Copy link
Copy Markdown
Collaborator

@matthew7838 matthew7838 commented Apr 3, 2026

Isolate the crop and soil module from the feed module simulation run.

Context

Issue(s) closed by this pull request: closes #2765

What

  • Added a function called _execute_daily_field_only_operations that focuses solely on the operations of the Field module, without any usage of the Feed module, including storage operations.
  • Renamed _execute_daily_field__operations to _execute_daily_field_with_storage_operations. Works the same, but utilizes the extracted _execute_daily_field_only_operations.
  • Added _execute_field_only_simulation, which will not run any harvest storage operations.
  • Added _execute_field_with_storage_simulation, which will run the Field module with storage operations, but will skip feed and ration planning.
  • Added two new simulation types, FIELD_ONLY and FIELD_WITH_STORAGE.

Why

The Crop and Soil module should be isolable from the rest of RUFAS. This is necessary for evaluating and testing crop and soil features and would provide new simulation options for research and decision-making workflows.

How

This PR further subdivided the responsibility of each simulation type.

Test plan

  • SME review.
  • Updated unit tests.

Input Changes

Output Changes

  • N/A

Filter

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Current Coverage: 99%

Mypy errors on separate-feed-run branch: 1198
Mypy errors on dev branch: 1198
No difference in error counts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🚨 Please update the changelog. This PR cannot be merged until changelog.md is updated.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Current Coverage: 99%

Mypy errors on separate-feed-run branch: 1198
Mypy errors on dev branch: 1198
No difference in error counts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

🚨 Please update the changelog. This PR cannot be merged until changelog.md is updated.

@matthew7838 matthew7838 changed the base branch from dev to wiki-links April 4, 2026 10:17
@matthew7838 matthew7838 changed the base branch from wiki-links to dev April 4, 2026 10:17
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Current Coverage: %

Mypy errors on separate-feed-run branch: 1198
Mypy errors on dev branch: 1198
No difference in error counts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

🚨 Please update the changelog. This PR cannot be merged until changelog.md is updated.
🚨 Some tests have failed.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Current Coverage: 99%

Mypy errors on separate-feed-run branch: 1198
Mypy errors on dev branch: 1198
No difference in error counts

@matthew7838 matthew7838 marked this pull request as ready for review April 4, 2026 11:45
@matthew7838 matthew7838 requested a review from morrowcj April 4, 2026 11:45
@matthew7838 matthew7838 requested a review from ew3361zh April 6, 2026 14:45
Comment thread tests/test_simulation_engine.py Outdated
Copy link
Copy Markdown
Collaborator

@morrowcj morrowcj left a comment

Choose a reason for hiding this comment

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

This looks correct to me. Well done.

I ran the model with both "example_field_only_tasks.json" and "example_field_with_storage_task.json". Those and pytest ran with no issues.

"random_seed": 42,
"set_seed": true,
"simulation_type": "field_only",
"nutrient_standard": "NASEM",
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.

As we discussed, nutrient_standard is one of the many parameters not strictly required by "field_only" (and possibly "field_and_storage"). I think this is covered by #2894, but wanted to mention it here to keep it on the radar.

Comment thread input/task_manager_metadata.json Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

Current Coverage: %

Mypy errors on separate-feed-run branch: 1205
Mypy errors on dev branch: 1205
No difference in error counts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

🚨 Flake8 linting errors were found. Please fix the linting issues.
🚨 Some tests have failed.

@matthew7838 matthew7838 requested a review from ew3361zh April 7, 2026 08:34
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Current Coverage: 99%

Mypy errors on separate-feed-run branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Current Coverage: 99%

Mypy errors on separate-feed-run branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Current Coverage: 99%

Mypy errors on separate-feed-run branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

@ew3361zh
Copy link
Copy Markdown
Collaborator

ew3361zh commented Apr 7, 2026

How are you handling manure applications on a farm without a manure module?


self._advance_time()

def _execute_field_with_storage_simulation(self) -> None:
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.

How does this differ from the FIELD_AND_FEED simulation in scientific outcomes/intent?

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.

The intent was to have an option where ration formulation was not performed, requiring no animal or nutritiion inputs

self._simulation_type_to_daily_simulation_function = {
SimulationType.FULL_FARM: self._execute_full_farm_daily_simulation,
SimulationType.FIELD_AND_FEED: self._execute_field_and_feed_daily_simulation,
simulation_type.FIELD_ONLY: self._execute_field_only_simulation,
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 for these simulations where we're isolating single parts of the model we want to be sure they can run without any other parts of the model being initialized.

FIELD_ONLY still depends on a Manure module. I know we'd talked about how to get manure applications out of the Manure module potentially - did you look into that at all?

I'm working on something that was initially separating out feed management from ration planning but has grown into initializing only modules that should be required for the simulation being run by the user. Maybe we can take a look at it and see how it can fit together with this.

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.

Isolate Crop and Soil

3 participants