Closed ValentineHerr closed 4 years ago
Thanks for putting this issue Valentine, as suspected the problem comes from a mixup in the attribution of weights to different equations, but I haven't yet identified the exact moment where it happens in the get_biomass function. I'm thinking of reorganizing the function a little anyway (because it can't handle very large data frames as written now), and I'll make sure that equation IDs are used all the time to avoid inconsistent weight allocation. I'll write to you when I've finished and we can try it again with the tree ring data.
Thanks Camille! I hope it is not too complexe of a problem... let me know when you need me to test the changes.
Don't worry, it's great that you spotted that, it could have gone unnoticed and it's actually a big problem, but (hopefully) relatively easy to fix
I just committed some changes to the get_biomass function that should make sure that the weights correspond to the right equation; I still have to update the taxonomic weight, but the function should work and not give negative values anymore
@cpiponiot , I just tried the new function and I am getting this error:
Okay, I think I know where it comes from, I'll try to fix it this afternoon
I tried something but when using it from the package it's still not working, I'll try something new tomorrow
Hi @cpiponiot, Just checking in about this. Have you been abke to work on it? I just tried the function again (after re-installing the package) and I am getting the same error message about function ".".
@ValentineHerr yes I thought that particular issue was solved, and when I use get_biomass from the allodb package (after downloading it from github) it works with the example in the function description (with coordinates either as vector with 2 values or as matrix with 2 columns, and for several sites). Can you send me the codes for which it doesn't work so I can try?
@cpiponiot, I restarted my session and that error went away... (my bad) but, now I am getting memory limit issues... I'll try to see if I can deal with that on my own by doing some parallelization but I thought you'd like to know. Something is eating more than it did before! :-)
Yes I've noticed it does that for very large data sets, it's the weight matrix that's super large but I haven't found a way around it yet... I'll try breaking the AGB/weight calculation down inside the function, but I'm afraid it's going to increase the total running time
Hi @cpiponiot, is it normal that the function does not work anymore for only one tree at a time?
> get_biomass(dbh = 1.99, genus = "Acer", species = "rubrum", coords = c(-72.1755 , 42.5388 ))
Error in rowSums(weight, na.rm = TRUE) :
'x' must be an array of at least two dimensions
the problem of inconsistent results is solved but I still get negative values. Let me know if you are planning to fix that or if I should just give agb<0 a value of 0 or something.
Hi @cpiponiot, is it normal that the function does not work anymore for only one tree at a time?
I'll go check what happens when we only have 1 stem
the problem of inconsistent results is solved but I still get negative values. Let me know if you are planning to fix that or if I should just give agb<0 a value of 0 or something.
I plan to fix that but haven't had time to do it yet, so if you need to use the function you can put 0 to negative agb values (normally this only happens for small dbhs), and I'll notify you when the problem is fixed
sounds good, thanks!