Skip to content

Address sea-level review feedback in land-mask generation - #86

Merged
dramanica merged 5 commits into
sealevelfrom
copilot/fix-code-for-comments
Jun 19, 2026
Merged

dramanica merged 5 commits into
sealevelfrom
copilot/fix-code-for-comments

Conversation

Copilot AI commented Jun 18, 2026 •

Copy link
Copy Markdown

This updates the sea-level handling introduced in the PR to match the linked review thread. It restores backward-compatible NULL behavior in make_land_mask(), documents supported sea_level inputs more clearly, and hardens get_sea_level() around invalid time ranges and malformed baseline data.

  • make_land_mask() compatibility and docs

    • Treat sea_level = NULL as Spratt2016 to preserve prior caller behavior.
    • Clarify that sea_level may be:
      • "Spratt2016"
      • "Clark2025"
      • a numeric vector with the same length as time_bp
  • get_sea_level() validation

    • Reject future times (time_bp > 0) explicitly instead of relying on interpolation failure.
    • Keep the existing lower-bound checks while making them tolerant of NA values in the range test.
  • Baseline rescaling safety

    • Require the internal sea-level dataset to contain exactly one time_bp == 0 row before rescaling to present-day sea level.
    • Fail fast on malformed baseline data instead of returning ambiguous results.
  • Focused regression coverage

    • Add coverage for sea_level = NULL behaving as Spratt2016.
    • Add coverage for present vs future time_bp.
    • Add coverage for malformed baseline datasets.

Example:

# preserved backward-compatible behavior
mask <- make_land_mask(relief_rast, time_bp = c(-1000, -10000), sea_level = NULL)

# explicit validation for future times
get_sea_level(1000)
# Error: time_bp should be in the past

Copilot AI changed the title [WIP] Fix code based on review comments Address sea-level review feedback in land-mask generation Jun 18, 2026
Copilot AI requested a review from dramanica June 18, 2026 15:40
@dramanica
dramanica marked this pull request as ready for review June 19, 2026 09:33
@dramanica
dramanica merged commit 33d18be into sealevel Jun 19, 2026
1 check passed
@dramanica
dramanica deleted the copilot/fix-code-for-comments branch June 19, 2026 09:34
dramanica added a commit that referenced this pull request Jun 19, 2026
* sea level functions

* Add Clark 2025 sea level

* minor fixes

* Address sea-level review feedback in land-mask generation (#86)

* Initial plan

* fix review thread feedback for sea level handling

* refine review-fix tests

* polish sea level tests

* some comments

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Andrea Manica <am315@cam.ac.uk>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
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