-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create function to predicted biomass against DBH, by species #73
Comments
Thanks!
How would you cut the dhb range for each species? Here are some alternatives: dbh_species1 <- c(11.1, 11.3, 15, 25.8, 25.9, 27, 30.1, 33)
ggplot2::cut_number(dbh_species1, 3)
#> [1] [11.1,18.6] [11.1,18.6] [11.1,18.6] (18.6,26.6] (18.6,26.6] (26.6,33]
#> [7] (26.6,33] (26.6,33]
#> Levels: [11.1,18.6] (18.6,26.6] (26.6,33]
ggplot2::cut_width(dbh_species1, 3)
#> [1] [10.5,13.5] [10.5,13.5] (13.5,16.5] (25.5,28.5] (25.5,28.5] (25.5,28.5]
#> [7] (28.5,31.5] (31.5,34.5]
#> 8 Levels: [10.5,13.5] (13.5,16.5] (16.5,19.5] (19.5,22.5] ... (31.5,34.5]
ggplot2::cut_interval(dbh_species1, 3)
#> [1] [11.1,18.4] [11.1,18.4] [11.1,18.4] (25.7,33] (25.7,33] (25.7,33]
#> [7] (25.7,33] (25.7,33]
#> Levels: [11.1,18.4] (18.4,25.7] (25.7,33] Created on 2019-03-12 by the reprex package (v0.2.1) |
We don't want to bin sizes-- just display a continuous linear function of biomass as a function of DBH. It could be a scatter plot or a line plot of the equation. I'm including an example of how I'd expect this to look for SCBI, with the modification that I'd like a separate color for each species + legend. |
I'm tagging this as high priority because it's a good way to engage reviewers, which is crucial in the development process. |
I'd actually like to have both. The first is valuable for picking out anomolies, the second for seeing what's going on with each species. |
Another note on this— option 1 should be the first one that users would see. Option 2 is if they want to dig in more.
|
@teixeirak and @gonzalezeb, Here is an article exploring https://github.com/forestgeo/fgeo.biomass/blob/master/.buildignore/dbh-vs-biomass.md Notice that we still lack some features that should produce better results. For example, For each row in a census dataset, the code currently sums the biomass for all equaitons associated to it (based on site and species). This should be correct except when the mulitple equations refer not to different parts of a tree but refer to trees of different diameter. We still don't handle dbh-specific equations. Also, some species have no value and I'll be exploring why. |
BTW,
|
To clarify, by |
@gonzalezeb, assuming my interpretation there is correct, it appears that our equations for Platanus occidentalis and Nyssa sylvatica are off. Can you please check? |
Yes,
|
Okay, I take it your example plot (# 1 below; from the link Mauro sent) would look more like the example I sent (# 2 below; made by Valentine based on Erika's compilation of equations) when you include larger diameters (but exclude Nyssa sylvatica and Platanus occidentalis)? |
Regarding review of these equations, I do not see that as the role for an intern. @maurolepore, you've already produced code to generate these plots. @gonzalezeb and I (to a lesser extent) should be the ones reviewing these plots to make sure output looks reasonable. In the longer term, issue #16 calls for code to flag equations that give unreasonable output. Right now/ to start (and maybe this is all we'll ever want), it may be worth writing a very simple script where each equation will be evaluated at ~3 dbh values (e.g., 1 cm, 50 cm, 100 cm; counting only those within range of the equation's DBH limits) and equations flagged if they don't fall within a range that we consider reasonable for that size (@gonzalezeb could provide guidance on those threshholds). |
Good point. Here I added a reference to tell those species appart. |
Good idea. I'll follow up at forestgeo/fgeo.biomass#22 |
I see the problems in the equations for Platanus, Nyssa and two others.. I am fixing it.. you are just to fast for me! |
Thanks for the plot, @maurolepore! From this, its mainly the hickories and Tilia that are low. This doesn't make much sense, as their wood density tends to be on the high end. @gonzalezeb, what do you think? |
How about creating that reasonable range from the deviation from the curve fit to Althought the preexisting |
We can try that as a rough first approximation.
|
FYI, in this update, the The most important accomplishment of today is that I can now explain all missing |
Regarding Lliriodendron tulipifera, I wonder if the issue may be one of units. That may explain such a difference -- where the resulting |
Incorrect units could definitely cause this kind of problem, but I believe @gonzalezeb already checked that. |
Interestingly, I did n't change that equation in my recent fixes so not sure why those large biomass biomass values didn't show before. |
It wouldn't have shown up bad before if it was being applied only within the specified DBH range. |
Thanks @gonzalezeb, it's now looking much better. It will continue to improve as we support the more features. |
We now support dbh-specific equations. There is a new update at http://bit.ly/demo-dbh-vs-biomass but please see also forestgeo/fgeo.biomass#27 |
Wonderful! At a first pass, this looks much more like what I expected. At a first pass, I don't see any problems. |
We still don't support generic equations. On one branch of the project I temporarily removed generic equations completely (discussion at #72). Removing generic equations should produce more accurate Compare (@teixeirak):
|
There are a lot of species that rely on generic equations. What do we need to be able to handle them? Please let me know if there are any barriers you face in order to incorporate them (other than just time to work on this). |
Notice that trees which species is given as Genus sp. can't find a matching species on allodb. We need to support that feature (forestgeo/fgeo.biomass#30). allo_find(census_species)
#> Assuming `dbh` in [mm] (required to find dbh-specific equations).
#> * Matching equations by site and species.
#> * Refining equations according to dbh.
#> * Using generic equations where expert equations can't be found.
#> Warning: Can't find equations matching these species:
#> acer sp, carya sp, crataegus sp, fraxinus sp, juniperus virginiana, quercus prinus, quercus sp, ulmus sp, unidentified unk
#> Warning: Can't find equations for 17132 rows (inserting `NA`).
|
Great!
There may be cases where “Genus sp.” would have a site-specific equation. That would be something for Erika to comment on / deal with. For now it will be fine for them to fall back on generic equations for any site (which of course remain to be entered, and I’d be happy to enter some examples if needed).
|
I see some examples of this already. library(tidyverse)
library(allodb)
master() %>%
select(site, species, equation_group) %>%
filter(equation_group == "Generic") %>%
filter(str_detect(species, " sp.$")) %>%
distinct()
#> Joining `equations` and `sitespecies` by 'equation_id'; then `sites_info` by 'site'.
#> # A tibble: 15 x 3
#> site species equation_group
#> <chr> <chr> <chr>
#> 1 serc Ligustrum sp. Generic
#> 2 lilly dicky Crataegus sp. Generic
#> 3 serc Vaccinium sp. Generic
#> 4 tyson Crataegus sp. Generic
#> 5 umbc Crataegus sp. Generic
#> 6 harvard forest Crataegus sp. Generic
#> 7 serc Quercus sp. Generic
#> 8 yosemite Salix sp. Generic
#> 9 wind river Abies sp. Generic
#> 10 yosemite Abies sp. Generic
#> 11 lilly dicky Carya sp. Generic
#> 12 scbi Carya sp. Generic
#> 13 serc Carya sp. Generic
#> 14 tyson Carya sp. Generic
#> 15 umbc Carya sp. Generic
Okay, with two examples I should have enogh to build the logic. |
I will provide a couple examples soon. |
Should I put the examples in this table? That is, do edits go to the .csv files in raw data, as opposed to the R tables? (Note that I just fixed a typo in that file, assuming that will make it into R tables.) |
If by "example" we mean a mock, then you may simpliy give me the name of a couple of allometries and tell me which sites and taxa they should match. I can create a toy dataset to build some code around. If instead by "example" we mean something that is production ready (i.e. not a toy but something that can be really used), then certainly the files you want to edit live in the directory data-raw/csv_database/ (https://github.com/forestgeo/allodb/blob/master/data-raw/csv_database/). In this case you'll need to enter new rows in the RE
That's right. The census tables are given by the users, and--after some wranging--matched with allodbh tables by the values in the columns "species", "site". library(allodb)
library(tidyverse)
list(equations = equations, sitespecies = sitespecies) %>%
map(~ select(.x, matches("^site|^species|^equation|allometry$")))
#> $equations
#> # A tibble: 175 x 3
#> equation_id equation_allometry equation_form
#> <chr> <chr> <chr>
#> 1 2060ea 10^(1.1891+1.419*(log10(dbh^2))) 10^(a+b*(log10(dbh^c)))
#> 2 a4d879 10^(1.2315+1.6376*(log10(dbh^2))) 10^(a+b*(log10(dbh^c)))
#> 3 c59e03 exp(7.217+1.514*log(dbh)) exp(a+b*log(dbh))
#> 4 96c0af 10^(2.5368+1.3197*(log10(dbh))) 10^(a+b*(log10(dbh)))
#> 5 529234 10^(2.0865+0.9449*(log10(dbh))) 10^(a+b*(log10(dbh)))
#> 6 ae65ed exp(-2.48+2.4835*log(dbh)) exp(a+b*log(dbh))
#> 7 9c4cc9 10^(-1.326+2.762*(log10(dbh))) 10^(a+b*(log10(dbh)))
#> 8 7f7777 exp(-2.5095+2.5437*log(dbh)) exp(a+b*log(dbh))
#> 9 cf733d exp(5.67+1.97*log(dbh)) exp(a+b*log(dbh))
#> 10 f08fff exp(-2.2118+2.4133*log(dbh)) exp(a+b*log(dbh))
#> # ... with 165 more rows
#>
#> $sitespecies
#> # A tibble: 772 x 6
#> site species species_code equation_group equation_id equation_taxa
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 Lilly ~ Acer rubr~ 316 Expert 7c72ed Acer rubrum
#> 2 Lilly ~ Acer rubr~ 316 Expert 2060ea Acer rubrum
#> 3 Lilly ~ Acer sacc~ 318 Expert a4d879 Acer sacchar~
#> 4 Lilly ~ Amelanchi~ 356 Expert c59e03 Amelanchier
#> 5 Lilly ~ Amelanchi~ 356 Expert 96c0af Amelanchier
#> 6 Lilly ~ Amelanchi~ 356 Expert 529234 Amelanchier
#> 7 Lilly ~ Asimina t~ 367 Generic ae65ed Mixed hardwo~
#> 8 Lilly ~ Carpinus ~ 391 Generic ae65ed Mixed hardwo~
#> 9 Lilly ~ Carya alba 409 Expert 9c4cc9 Carya
#> 10 Lilly ~ Carya cor~ 402 Expert 9c4cc9 Carya
#> # ... with 762 more rows Created on 2019-03-26 by the reprex package (v0.2.1) |
I added some (real) generic equation entries to the sitespecies table (this commit). These were equations that were already in the database, not totally new equations. For reasons relating to issue #85, I haven't checked whether they would represent the range of scenarios you may encounter, or even ever be called upon with the current set of ForestGEO sites. You can start with that and let me know if you need others. |
Your commit is now tagged -- meaning that it's easy to find and revert I'll follow up on this at #72 |
We now support shrubs. You can see the updated biomass analysis at http://bit.ly/demo-dbh-vs-biomass After you comments I should be able to soon close #41 |
@teixeirak, and @gonzalezeb, FYI:
|
This issue is handle by the functions get_biomass and illustrate_allodb. |
@maurolepore,
In order to check current calculations, and for future users to be able to visualize what allodb is giving in terms of predicted biomass, we'll want to make the following plot type:
x-axis: DBH (cm)
y-axis: biomass (kg)
one colored line or series of points for each species at a site, spanning the range of sizes observed at the site
The text was updated successfully, but these errors were encountered: