don't renumber years in speciesEcoregion #80
Draft
+24
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the start of
Biomass_core, there is a chunk of code that renumbers the years inspeciesEcoregionso that they start at 0. This chunk has two components. The first checks whether there are any years <=successionTimestepand takes the last available. The it binds traits for this year with any traits for years >successionTimestepand renumbers all years asyear - min(year):I believe this can be problematic when the user/another module provides a table of trait values for different years for several reasons:
Assuming that
speciesEcoregionstarts with trait values for every year of the simulation:start(sim)andend(sim)are both <=successionTimestep, then only the last year of trait values will be used.start(sim)andend(sim)are both >successionTimestep, years inspeciesEcoregionwill be renumbered from 0 toend(sim)-start(sim)and later on, no trait values will be found attime(sim)start(sim)is <=successionTimestepandend(sim)>successionTimestep, the trait values used atstart(sim)will correspond to whatever year closest tosuccessionTimestepin the range [start(sim),successionTimestep) and the remaining years inspeciesEcoregionwill be subtracted this year, meaning that the trait values used at each year will be shifted "backwards"According to the LANDIS-II documentation,
speciesEcoregionshould have values for year 0 , which is presumably why this "year rescaling" is happening -- although I couldn't find a place where we usespeciesEcoregion[, year == 0](but I may have missed it). So I propose that, instead of renumbering the years in this table, we check for trait values atyear == 0and if they don't exist we take the trait values atmin(year)and "duplicate them" foryear == 0.Could others please have a look and see if I missed anything?