Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix precalc cleanup script #363

Merged
merged 1 commit into from
Nov 7, 2024
Merged

Fix precalc cleanup script #363

merged 1 commit into from
Nov 7, 2024

Conversation

avmey
Copy link
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
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
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
4 checks passed
@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