Skip to content

Fix EVALID filtering for all tables with PLT_CN column#77

Merged
mihiarc merged 2 commits intomainfrom
fix/evalid-filter-all-plt-cn-tables
Mar 14, 2026
Merged

Fix EVALID filtering for all tables with PLT_CN column#77
mihiarc merged 2 commits intomainfrom
fix/evalid-filter-all-plt-cn-tables

Conversation

@mihiarc
Copy link
Copy Markdown
Owner

@mihiarc mihiarc commented Mar 14, 2026

Summary

  • load_table() hardcoded EVALID filtering to only TREE and COND tables, causing tables like TREE_GRM_COMPONENT to load unfiltered — stale records from older evaluation cycles could leak through
  • Replaced the table name allowlist with schema introspection: any table with a PLT_CN column now gets EVALID-filtered at load time
  • Similarly, state_filter now applies to any table with a STATECD column instead of only PLOT, COND, TREE

Test plan

  • 718 unit tests pass
  • GRM validation tests pass with exact EVALIDator matches (growth, mortality, removals)
  • ruff + mypy clean

Closes #76

mihiarc added 2 commits March 14, 2026 10:01
load_table() previously hardcoded EVALID filtering to only TREE and COND
tables. Tables like TREE_GRM_COMPONENT were loaded unfiltered, allowing
stale records from older evaluation cycles to leak through.

Replace the table name allowlist with schema introspection: any table
with a PLT_CN column now gets EVALID-filtered at load time. Similarly,
state_filter now applies to any table with a STATECD column.

Closes #76
Extend the schema introspection approach to _apply_spatial_filter(),
which had the same hardcoded ["TREE", "COND"] allowlist. Now any table
with a PLT_CN column gets spatial filtering when clip_by_polygon is active.

Add unit tests verifying EVALID, state, and spatial filtering applies based
on column presence rather than table name.
@mihiarc mihiarc merged commit 4dd5222 into main Mar 14, 2026
3 checks passed
@mihiarc mihiarc deleted the fix/evalid-filter-all-plt-cn-tables branch March 14, 2026 14:13
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.

TREE_GRM_COMPONENT not filtered by EVALID in load_table()

1 participant