The Greenhouse Gas Value Calculator (GHGVC) uses the ghgvcR
package to calculate greenhouse gas emissions. GHGVC can be installed at https://github.com/ebimodeling/ghgvc.
Citation: Kristina J. Teixeira and Evan H. Delucia 2011. The greenhouse gas value of ecosystems. Global Change Biology. 17(1):425438 doi: 10.1111/j.1365-2486.2010.02220.x
ghgvcR
has several principal functions:
get_biome()
determines the biomes available at a given latitude and longitude.get_ncdf()
reads in netcdf biome data for a given latitude and longitude.calc_ghgv()
calculates the greenhouse gas emissions of a specific ecosystem.plot_ghgv()
creates plots of greenhouse gas emissions seen on the GHGVC app.ghgvcR
talks to the GHGVC web app by receiving json parameters and passing back json results. However it also works as a stand alone estimator of greenhouse gas emissions at a specific location.
Several example ecosystem data files are kept in inst/config_examples/
. These can be used in place of biome data to run the calculator entirely within R:
library(ghgvcr) #load example config data config_file <- system.file("config/single_site.json", package = "ghgvcr") #Calculate res <- calc_ghgv(system.file("config/single_site.json", package = "ghgvcr")) #Write the data to a file: #outdir <- "./" #write_json(res, outdir, filename = "ghgvc_example", format="json")
ghgvcR
can also plot the greenhouse gas values that are returned by calc_ghgv()
:
``` {r, fig.show='hold'}
####Biome Example The same calculation can be done for a specific location if biome data is available. ```r #NOT RUN library(ghgvcr) data(biome_defaults) #Example location latitude <- 40.18 longitude <- -89.82 #paths netcdf_dir <- "<data directory>" #Load the biome data for that location #biome <- get_biome(latitude, longitude, netcdf_dir, biome_defaults, write_data = FALSE) #head(biome) #Calculate GHGV #res <- calc_ghgv(biome)
ghgvcR
works in concert with ghgvc
through the ghgvcR
scripts. This requires a certain amount of configuration. Once ghgvc
is set up correctly, the following settings must be configured in app/workflows_controller.rb
:
Where to find the ghgvcR
scripts
ghgvcR_scripts_path
needs to be set. In development this is currently "ghgvc
app itself (e.g. "
Where the netcdf data is stored
By default the netcdf data is stored at "
Where the name-indexed ecosystem json file is stored
By default this is "
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.