Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions modules/data.land/inst/generate_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ if (DESIGN_POINTS) {
}

ca_fields <- ca_field_attributes |>
dplyr::select(site_id, pft, crop) |>
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?

dplyr::group_by(site_id) |>
dplyr::mutate(first_year = min(year)) |>
dplyr::ungroup()
Expand Down
Loading