VincyaneBadouard / TreeData_broken

Harmonization and correction forest data tool.
https://vincyanebadouard.github.io/TreeData/
0 stars 1 forks source link

ToDo list for RecruitmentCorrection() #50

Closed VincyaneBadouard closed 1 year ago

VincyaneBadouard commented 2 years ago
ValentineHerr commented 1 year ago

@VincyaneBadouard, I am working on the RecruitCorrection function and I see the definition of PositiveGrowthThreshold parameter as: A tree widening by more than x cm/year is considered abnormal (numeric, 1 value) but in the code it looks like it is only used to assign the growth of a tree when there is only one DBH value:

# Growth criteria
    if(length(cresc) > 0){ # if there are a growth
      Growth <- cresc[1] # 1st growth value
    }else{Growth <- PositiveGrowthThreshold} # if only 1 DBH value (no cresc)

Also, I am not following all of the logic. You are saying that there was a missed recruits looking if the tree is "abnomally big for a first time measurement", based on 'Growth':

   # Detection
    #### If the 1st DBH is larger than it would have been if at the previous census it was at the minimum DBH
    if (FirstDBH > (MinDBH + (RecruitYear - PrevCens) * Growth)){ 

      DataTree <- GenerateComment(DataTree,
                                  condition = DataTree[, Year]  %in% RecruitYear,
                                  comment = "This DBH is/was the 1st recorded for this tree,
                                  according to its annual growth and the census done for this plot,
                                  it should have been recruited earlier according to your protocol (MinDBH).")
[...]

but then later you do a linear regression to fill the DBH of the missed recruits.

Why not using the linear regression to see if the DBH at the previous census was >MinDBH and if yes, add the row (or, if DetectOnly, add the comment on the first time the tree was measured to say that it was probably missed in the previous census)?

ValentineHerr commented 1 year ago

I haven't looked at the DiameterCorrection function yet but I am wondering if it would be better to add a parameter in that one to to ask if user wants to add missed recruits, and get rif of RecruitCorrection... So we can leverage the growth rates calculated on various taxo levels... What do you think @VincyaneBadouard and @cpiponiot ?

cpiponiot commented 1 year ago

That sounds like a good idea!