Git Product home page Git Product logo

Comments (3)

maurolepore avatar maurolepore commented on June 26, 2024

ropensci/allodb#42 (comment)

image

from fgeo.biomass.

maurolepore avatar maurolepore commented on June 26, 2024

This was low priority but needed something doable in a short time.

from fgeo.biomass.

maurolepore avatar maurolepore commented on June 26, 2024
library(tidyverse)
library(fgeo.biomass)
set.seed(1)

census <- dplyr::sample_n(fgeo.biomass::scbi_tree1, 100)
species <- fgeo.biomass::scbi_species
census_species <- add_species(
  census, species,
  site = "scbi"
)
#> Adding `site`.
#> Overwriting `sp`; it now stores Latin species names.
#> Adding `rowid`.

# Guesses
suppressWarnings(
  allo_find(census_species)
)
#>   Guessing `dbh` in [mm] (required to find dbh-specific equations).
#> You may provide the `dbh` unit manually via the argument `dbh_unit`.
#> * Matching equations by site and species.
#> * Refining equations according to dbh.
#> * Using generic equations where expert equations can't be found.
#> # A tibble: 100 x 32
#>    rowid treeID stemID tag   StemTag sp    quadrat    gx     gy DBHID
#>    <int>  <int>  <int> <chr> <chr>   <chr> <chr>   <dbl>  <dbl> <int>
#>  1     1  10696  10696 90447 1       carp~ 0905    180    83.3  15288
#>  2     2  14990  14990 1122~ 1       unid~ 1123    202.  450.   20510
#>  3     3  23076  23076 1607~ 1       quer~ 1607    318.  121.   30505
#>  4     4  36583     NA 1933~ <NA>    lind~ 1904    374.   69.2     NA
#>  5     5   8124   8124 70093 1       hama~ 0704    123.   71.3  12097
#>  6     6  36186     NA 1930~ <NA>    lind~ 1901    369.    1.40    NA
#>  7     7  38049     NA 2035~ <NA>    lind~ 2004    386.   75.4     NA
#>  8     8  26615  26615 1807~ 1       liri~ 1811    355.  211.   34789
#>  9     9  25338  25338 1720~ 1       corn~ 1719    320.  362.   33246
#> 10    10   2489   2489 20242 1       lind~ 0204     27.9  70.9   5228
#> # ... with 90 more rows, and 22 more variables: CensusID <int>, dbh <dbl>,
#> #   pom <chr>, hom <dbl>, ExactDate <chr>, DFstatus <chr>, codes <chr>,
#> #   nostems <dbl>, date <dbl>, status <chr>, agb <dbl>, site <chr>,
#> #   equation_id <chr>, eqn <chr>, eqn_source <chr>, eqn_type <chr>,
#> #   anatomic_relevance <chr>, dbh_unit <chr>, bms_unit <chr>,
#> #   dbh_min_mm <dbl>, dbh_max_mm <dbl>, is_generic <lgl>

# Uses given units
suppressWarnings(
  allo_find(census_species, dbh_unit = "mm")
)
#> # A tibble: 100 x 32
#>    rowid treeID stemID tag   StemTag sp    quadrat    gx     gy DBHID
#>    <int>  <int>  <int> <chr> <chr>   <chr> <chr>   <dbl>  <dbl> <int>
#>  1     1  10696  10696 90447 1       carp~ 0905    180    83.3  15288
#>  2     2  14990  14990 1122~ 1       unid~ 1123    202.  450.   20510
#>  3     3  23076  23076 1607~ 1       quer~ 1607    318.  121.   30505
#>  4     4  36583     NA 1933~ <NA>    lind~ 1904    374.   69.2     NA
#>  5     5   8124   8124 70093 1       hama~ 0704    123.   71.3  12097
#>  6     6  36186     NA 1930~ <NA>    lind~ 1901    369.    1.40    NA
#>  7     7  38049     NA 2035~ <NA>    lind~ 2004    386.   75.4     NA
#>  8     8  26615  26615 1807~ 1       liri~ 1811    355.  211.   34789
#>  9     9  25338  25338 1720~ 1       corn~ 1719    320.  362.   33246
#> 10    10   2489   2489 20242 1       lind~ 0204     27.9  70.9   5228
#> # ... with 90 more rows, and 22 more variables: CensusID <int>, dbh <dbl>,
#> #   pom <chr>, hom <dbl>, ExactDate <chr>, DFstatus <chr>, codes <chr>,
#> #   nostems <dbl>, date <dbl>, status <chr>, agb <dbl>, site <chr>,
#> #   equation_id <chr>, eqn <chr>, eqn_source <chr>, eqn_type <chr>,
#> #   anatomic_relevance <chr>, dbh_unit <chr>, bms_unit <chr>,
#> #   dbh_min_mm <dbl>, dbh_max_mm <dbl>, is_generic <lgl>

# Converting dbh to cm
census_species2 <- mutate(census_species, dbh = dbh / 1000)

# Guesses cm
suppressWarnings(
  allo_find(census_species2)
)
#>   Guessing `dbh` in [cm] (required to find dbh-specific equations).
#> You may provide the `dbh` unit manually via the argument `dbh_unit`.
#> * Matching equations by site and species.
#> * Refining equations according to dbh.
#> * Using generic equations where expert equations can't be found.
#> # A tibble: 100 x 32
#>    rowid treeID stemID tag   StemTag sp    quadrat    gx     gy DBHID
#>    <int>  <int>  <int> <chr> <chr>   <chr> <chr>   <dbl>  <dbl> <int>
#>  1     1  10696  10696 90447 1       carp~ 0905    180    83.3  15288
#>  2     2  14990  14990 1122~ 1       unid~ 1123    202.  450.   20510
#>  3     3  23076  23076 1607~ 1       quer~ 1607    318.  121.   30505
#>  4     4  36583     NA 1933~ <NA>    lind~ 1904    374.   69.2     NA
#>  5     5   8124   8124 70093 1       hama~ 0704    123.   71.3  12097
#>  6     6  36186     NA 1930~ <NA>    lind~ 1901    369.    1.40    NA
#>  7     7  38049     NA 2035~ <NA>    lind~ 2004    386.   75.4     NA
#>  8     8  26615  26615 1807~ 1       liri~ 1811    355.  211.   34789
#>  9     9  25338  25338 1720~ 1       corn~ 1719    320.  362.   33246
#> 10    10   2489   2489 20242 1       lind~ 0204     27.9  70.9   5228
#> # ... with 90 more rows, and 22 more variables: CensusID <int>, dbh <dbl>,
#> #   pom <chr>, hom <dbl>, ExactDate <chr>, DFstatus <chr>, codes <chr>,
#> #   nostems <dbl>, date <dbl>, status <chr>, agb <dbl>, site <chr>,
#> #   equation_id <chr>, eqn <chr>, eqn_source <chr>, eqn_type <chr>,
#> #   anatomic_relevance <chr>, dbh_unit <chr>, bms_unit <chr>,
#> #   dbh_min_mm <dbl>, dbh_max_mm <dbl>, is_generic <lgl>

Created on 2019-03-28 by the reprex package (v0.2.1)

from fgeo.biomass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.