Skip to content

Anchor replicate folder and raster label parsing - #15

Merged
achubaty merged 4 commits into
developmentfrom
fix-replicate-label-parsing
Nov 26, 2026
Merged

achubaty merged 4 commits into
developmentfrom
fix-replicate-label-parsing

Conversation

@achubaty

@achubaty achubaty commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes two parsing defects in the replicate output helpers. No new dependencies; purrr is dropped from Imports.

  • findOldSimFiles(): fs matches dir_ls(regexp =) against the whole path, and the pattern rep([0-9])+ was unanchored, so any folder with rep and a digit anywhere in its path was searched (every folder, when the output path itself contained one). The pattern now matches only a folder named rep plus digits.
  • rasterListByPoly(): labels <repXX>.<prefix>_year<YYYY>_<polyName> were split on . and _, so a polygon name containing either was cut short, and filter was applied as a regular expression. Each label is now parsed with one anchored pattern (as in nrvtools' .parse_metric_labels()), and a label that does not match is an error. filter is no longer used; it stays in the signature. The returned attributes (reps, times, polyNames) keep their types.
  • The deprecated, unexported landmine_burn() called a bare transpose() that resolved through the purrr import; it now calls data.table::transpose(), as landmine_burn1() does. R/landmine.R is air-formatted in its own commit (parse-identical) so that one-line change stands alone.

Tests: new test-simfiles.R (an output path and a sibling folder that contain rep1, beside rep01/rep10; absolute and relative paths) and test-rasterListByPoly.R (polygon name Unit_A.1; a file name without a year). Both fail on the old code. Locally on the rebased branch: full suite 332 tests, 1767 expectations, none failed or skipped; R CMD check 0 errors, 0 warnings, 0 notes.

Version 1.1.0.9003 (rebased on #14, which took 9002).

🤖 Generated with Claude Code

achubaty and others added 2 commits November 25, 2026 21:19
findOldSimFiles() searched any folder with rep<digits> in its path, and
rasterListByPoly() cut polygon names at '.' or '_'. Drops purrr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
usethis::use_version("dev") after the replicate label parsing fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@achubaty
achubaty force-pushed the fix-replicate-label-parsing branch from 3916106 to e2871fb Compare November 26, 2026 03:22
achubaty and others added 2 commits November 25, 2026 21:58
Formatting only, so the next commit's one-line change stands alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bare call resolved to purrr's transpose(), whose import is now gone;
landmine_burn1() already uses data.table's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@achubaty
achubaty merged commit 5f9f4df into development Nov 26, 2026
12 checks passed
@achubaty
achubaty deleted the fix-replicate-label-parsing branch November 26, 2026 04:18
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.

1 participant