Open cboisvenue opened 4 years ago
IMPORTANT: as it stands overmaturedecline matrices take carbon from row 1 exclusively and but it in cols 12:15.
overmatDT[value != 1,]
# row col value name
#1: 1 14 0.002914955 841
#2: 1 15 0.002914955 841
#3: 1 12 0.084506420 841
#4: 1 13 0.084506420 841
That has to be wrong. row #1 is input, i.e., the atmosphere. So at best, that should be change to row 2:6 is softwood or 7:11 is hardwood. Going to rows 12:15 which are "AboveGroundVeryFastSoil", "BelowGroundVeryFastSoil", "AboveGroundFastSoil", "BelowGroundFastSoil" seems ok. Again, all these matrices are calculated in the c++ scripts, in the function ComputeGrowthAndDeclineMatrices2(). A temporary work around would be to change the overmature decline matrices is to change the values for the rows...not sure if it is worth the effort since the fact that this is applied to a very young pixelGroup means it is wrong anyway. Conclusion: I am not going to work on this until we (@achubaty ) can look and possibly fix the c++ function.
Adding to this issue: we need to figure out what happens to the increments once the pixel age goes beyond the maximum ages on the growth curves provided. Do they continue with the same increments? No -
fireReturnSims <- spadesCBMout
fireReturnSims$cbmPools[simYear == 2540 & ages>400,]
# pixel group 1 is 531 years old
fireReturnSims$cbmPools[1:5,]
# pixelGroup ==1 is in the 1st position in the $allProcesses$Growth1 list
fireReturnSims$allProcesses$Growth1[[1]]
row col value
[1,] 1 11 0.113738318
[2,] 1 10 0.006197548
[3,] 1 1 1.000000000
[4,] 2 2 1.000000000
[5,] 3 3 1.000000000
[6,] 4 4 1.000000000
[7,] 5 5 1.000000000
[8,] 6 6 1.000000000
[9,] 7 7 1.000000000
[10,] 8 8 1.000000000
[11,] 9 9 1.000000000
[12,] 10 10 1.000000000
[13,] 11 11 1.000000000
[14,] 12 12 1.000000000
[15,] 13 13 1.000000000
[16,] 14 14 1.000000000
[17,] 15 15 1.000000000
[18,] 16 16 1.000000000
[19,] 17 17 1.000000000
[20,] 18 18 1.000000000
[21,] 19 19 1.000000000
[22,] 20 20 1.000000000
[23,] 21 21 1.000000000
[24,] 22 22 1.000000000
[25,] 23 23 1.000000000
[26,] 24 24 1.000000000
[27,] 25 25 1.000000000
[28,] 26 26 1.000000000```
while the growth curve at the max(age) is this:
```# trying to find the right gcid - fireReturnsSims$growth_increments have id
# column going from 1 to 310. These are factor levels created from fireReturnSims$curveID
# [1] "growth_curve_component_id" "ecozones". Need to figure out which is matching pixelGroup 1
curveID <- fireReturnSims$curveID
gcidsLevels <- levels(fireReturnSims$level3DT$gcids)
# ecozone and growth_curve_component_id for pixelGroup 1
fireReturnSims$pixelGroupC[pixelGroup == 1,]
# find those
which(gcidsLevels == "4001001_4")
pg1gc <- as.data.table(fireReturnSims$growth_increments[
fireReturnSims$growth_increments[,1] == which(gcidsLevels == "4001001_4"),])
pg1gc[age == max(age),]
id age swmerch swfol swother hwmerch hwfol hwother
1: 120 299 0 0 0 -0.07414916 -0.0006227542 -0.01446324```
this has to do with overmature decline
In the process of making checking functions for the c transactions, I saw that, in the case of the sims I was looking for only one pixelGroup has a matrix that was not all 1s. That pixelGroup was 2 years old...Some checking of how these are assgined in the c++ function is required.