Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 16, 2025

Currently addSpecies() aborts if newly-added species have zero growth rates anywhere before reaching maximum size, preventing interactive parameter tuning. This should only error if species cannot reach maturity.

Changes

  • R/steadySingleSpecies.R: Modified growth check to distinguish between pre-maturity (error) and post-maturity (warning) zero growth

    • Find first index where growth becomes zero
    • Error only if first_zero_idx < w_mat_idx
    • Warning if first_zero_idx >= w_mat_idx
  • tests/testthat/test-steadySingleSpecies.R: Added test coverage for both error and warning cases

Example

# Previously would error - now issues warning and succeeds
params <- newTraitParams()
species_params <- data.frame(
    species = "species_with_high_metabolism",
    w_max = 100,
    w_mat = 50,
    ks = 10  # High metabolic rate causes zero growth after maturity
)
params <- addSpecies(params, species_params)
# Warning: species_with_high_metabolism has zero growth rate after maturity size

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cloud.r-project.org
    • Triggering command: /usr/local/lib/R/bin/exec/R --no-save --no-restore --no-echo --no-restore -e install.packages(&#34;remotes&#34;,~&#43;~repos=&#34;REDACTED&#34;) (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>In addSpecies() only issue warning if feeding level drops below critical level</issue_title>
<issue_description>Currently, if one of the newly-added species has predation parameters that lead to a feeding level that drops below the critical feeding level, the function aborts with an error message: "Can not compute steady state due to zero growth rates for ...". This should be changed so that an error is issued only if the growth rate becomes zero already before the species reaches maturity size. If the species does make it to maturity before growth stops then only a warning should be issued. That will make it easier for the user to make adjustments to the new species interactively with tuneParams().</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update addSpecies function to issue warning on feeding level Allow addSpecies() to proceed with warning when growth stops after maturity Nov 16, 2025
Copilot AI requested a review from gustavdelius November 16, 2025 12:38
@gustavdelius gustavdelius marked this pull request as ready for review November 16, 2025 12:54
@gustavdelius gustavdelius merged commit c611b32 into master Nov 16, 2025
4 of 5 checks passed
@gustavdelius gustavdelius deleted the copilot/update-addspecies-warning-logic branch November 16, 2025 12:54
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.

In addSpecies() only issue warning if feeding level drops below critical level

2 participants