r4atlantis / atlantisom

Atlantis operating model. Generates data sets from Atlantis scenarios.
https://r4atlantis.github.io/atlantisom
7 stars 6 forks source link

function calc_stage2length #4

Closed ghost closed 8 years ago

ghost commented 8 years ago

calc_stage2length is currently written, but needs to be edited to:

gavinfay commented 8 years ago

I have revised calc_age2length to play better with others. I do not believe this needs to be specialized to deal with stage data as that is being done by another function and should happen before the call to calc_age2length.

Function outputs numbers at length by age, box, time, etc. Figured this was easier and that aggregation can be done by functions later in the process. The data frame containing the numbers at length (lenout$natlength) has two additional columns to our 'normal' data frames to capture the length bin structure. This is needed I think. Function is still assuming one CV for length at age among species, which is an argument to the function. Function works with test SETAS data. Loop to calculate mean length at age is slow and should be improved on (current code is only doing a few lines of the data frames) - the issue is that nums only contains elements where numbers are >0 whereas structn and reserven contain all combinations of box, age, etc.

gavinfay commented 8 years ago

Above loop now vectorized.

kellijohnson-NOAA commented 8 years ago

excellent work, i am closing this issue