Skip to content

Conversation

@AritraDey-Dev
Copy link
Member

Description

Fix generate_events to use year-specific crop data instead of repeating 2016 crop data across all years

Motivation and Context

Fixes #3636

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • My name is in the list of CITATION.cff
  • I agree that PEcAn Project may distribute my contribution under any or all of
    • the same license as the existing code,
    • and/or the BSD 3-clause license.
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

dplyr::distinct() |>
tidyr::crossing(year = 2016:2024) |>
dplyr::select(site_id, year, pft, crop) |>
dplyr::filter(year >= 2016 & year <= 2024) |>
Copy link
Member

Choose a reason for hiding this comment

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

@AritraDey-Dev this looks right once we have data from multiple years in hand, but do note that the ca_field_attributes I know about currently only contains rows for 2016. Have you tested this patch with a multi-year field listing?

Copy link
Member Author

Choose a reason for hiding this comment

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

@infotroph I didn't test it separately with a multi-year field listing, given your comment on the issue that ca_field_attributes currently only contains rows for 2016, I've implemented a fix based on the issue you raised regarding the crop being repeated for every year until 2024.

Copy link
Member

Choose a reason for hiding this comment

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

Tagging @dlebauer as the main user of this script so far -- your call whether we should to make this change now (and therefore have output be 2016-only until the field attributes file contains other years), or keep crossing(2016:2024) until we have an updated attribute file in hand?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generate_events: use mapped from from each year

2 participants