Skip to content

Fix precalc cleanup script#363

Merged
twelch merged 1 commit intodevfrom
precalcClean
Nov 7, 2024
Merged

Fix precalc cleanup script#363
twelch merged 1 commit intodevfrom
precalcClean

Conversation

@avmey
Copy link
Copy Markdown
Contributor

@avmey avmey commented Oct 17, 2024

Previously, any precalc metric that didn't end in -total was removed in cleanup. This discarded vector datasources with classes benthic-coral and categorical rasters kelpPersist-1 precalc metrics incorrectly.

Tested with gp 7.0.0-experimental-precalcClean.2 and working as expected in california-reports

@avmey avmey requested a review from twelch October 17, 2024 17:59
}
const datasourceId = m.classId.replace("-total", "");
// precalc metrics should have the format: "datasourceId-class"
if (!m.classId.includes("-")) return false;
Copy link
Copy Markdown
Contributor

@twelch twelch Oct 24, 2024

Choose a reason for hiding this comment

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

Thanks @avmey. I thought the -total prefix was a special thing added to all precalc metrics for the precalc process. Why in your benthicCoral and kelpPersist1 example do they not have it? Apologies if I misunderstand, I haven't been deep in this code for a while.

Is there any concern that testing only for a dash (-) will somehow start to include/keep metrics it shouldn't and didn't before? That there may not be test coverage for?

Copy link
Copy Markdown
Contributor Author

@avmey avmey Oct 29, 2024

Choose a reason for hiding this comment

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

If there's no subclass then -total is added instead of -class. It's a default or total value. Categorical rasters will precalc as kelp-1, kelp-2, kelp-3 etc. Vector datasources with classkeys will do the same: benthic-coral, benthic-seagrass, benthic-sand, etc. Since we're still checking for a matching datasourceId below, I don't expect any issues with it keeping incorrect metrics.

@twelch twelch merged commit 3424af6 into dev Nov 7, 2024
@twelch twelch deleted the precalcClean branch November 7, 2024 18:48
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.

2 participants