Title: | madrat-based package providing core FAO-related preprocessing functions |
---|---|
Description: | This madrat-based package provides core FAO-related preprocessing functions. |
Authors: | David Chen [aut, cre], Ulrich Kreidenweis [aut], Abhijeet Mishra [aut], Kristine Karstens [aut], Benjamin Leon Bodirsky [aut], Debbora Leip [aut], Mishko Stevanovic [aut], Benjamin Leon Bodrisky [aut], David Klein [aut], Edna Molina Bacca [aut] |
Maintainer: | David Chen <[email protected]> |
License: | LGPL-3 |
Version: | 1.1.1 |
Built: | 2024-11-13 06:00:20 UTC |
Source: | https://github.com/pik-piam/mrfaocore |
provides attributes of different products
calcAttributes(subtype = "Products")
calcAttributes(subtype = "Products")
subtype |
subtype of readProductAttributes function. |
List of magpie objects with results on global level, empty weight, unit and description.
Benjamin Leon Bodirsky
[readProductAttributes()]
## Not run: calcOutput("Attributes") ## End(Not run)
## Not run: calcOutput("Attributes") ## End(Not run)
Calculates bilateral trade values based on FAO trade matrix
calcFAOBilateralTrade( output = "value", products = "kcr", prodAgg = TRUE, fiveYear = TRUE )
calcFAOBilateralTrade( output = "value", products = "kcr", prodAgg = TRUE, fiveYear = TRUE )
output |
"value", "qty", or "price" |
products |
"kcr", "kli", or "kothers" |
prodAgg |
binary to keep FAO product level or magpie |
fiveYear |
only 5 year steps due to memory load |
List of magpie objects with results on bilateral country level, weight on bilateral country level, unit and description.
David M Chen
## Not run: calcOutput("FAOBilateralTrade", output = "qty", products = "kcr") ## End(Not run)
## Not run: calcOutput("FAOBilateralTrade", output = "qty", products = "kcr") ## End(Not run)
Calculate harmonized FAO Commodity Balance and Food Supply data based on CB, only harvested areas are taken from ProdSTAT. This functions adds the CBCrop, CBLive, FSCrop and FSLive data together.
calcFAOharmonized()
calcFAOharmonized()
FAO harmonized data, weight as NULL, and a description as as a list of MAgPIE objects
Ulrich Kreidenweis, David Chen, Kristine Karstens
## Not run: a <- calcOutput("FAOharmonized") ## End(Not run)
## Not run: a <- calcOutput("FAOharmonized") ## End(Not run)
Returns physical land areas from FAOSTAT
calcFAOLand()
calcFAOLand()
land areas from FAOSTAT and weight
Ulrich Kreidenweis, Kristine Karstens
Calculates an extended version of the Food Balance Sheets. Makes explicit the conversion processes that convert one type of product into another. Includes processes like milling, distilling, extraction etc. Adds certain byproducts like distillers grains or ethanol.
calcFAOmassbalance_pre(years = NULL)
calcFAOmassbalance_pre(years = NULL)
years |
years to be estimated, if null, then all years in FAOharmonized are returned |
List of magpie objects with results on country level, weight on country level, unit and description. This is an intermediary result, which is used e.g. for estimating the feed baskets. For most uses, it is more appropriate to use the FAOmasbalance instead of the FAOmassbalance_pre.
Benjamin Leon Bodirsky
[calcFAOmassbalance()]
## Not run: calcOutput("FAOmassbalance_pre") ## End(Not run)
## Not run: calcOutput("FAOmassbalance_pre") ## End(Not run)
calculates USD per kg of FAOSTAT Trade data for import and export prices
calcFAOTradePrices(aggregation = "k")
calcFAOTradePrices(aggregation = "k")
aggregation |
"none", "k", "fbs" or "springmann" for the last uses Marco Springmann's custom product mapping |
List of magpie objects with results on country level, weight on country level, unit and description.
David M Chen
## Not run: calcOutput("calcFAOTradePrices") ## End(Not run)
## Not run: calcOutput("calcFAOTradePrices") ## End(Not run)
calculates dataset of fertilizer prices in US$MER17/tonne (either referring to the amount of fertilizer product, or to the amount of nutrients within the fertilizer) based on FAO data
calcFertilizerPricesFAO(subtype = "N", by = "nutrient")
calcFertilizerPricesFAO(subtype = "N", by = "nutrient")
subtype |
"N" for fertilizer containing nitrogen, "P" for fertilizer containing phosphorus |
by |
"nutrient" if referring to price per amount of nutrients (N or P) within the fertilizer products, or "product" if referring to price per amount of fertilizer product |
List of magpie objects with results on country level, weight on country level, unit and description.
Debbora Leip
## Not run: calcOutput("FertilizerPricesFAO", subtype = "N", by = "nutrient") ## End(Not run)
## Not run: calcOutput("FertilizerPricesFAO", subtype = "N", by = "nutrient") ## End(Not run)
calculates dataset of fertilizer use in tonnes (either referring to the amount of fertilizer products used, or to the amount of nutrients within the fertilizer used) based on FAO data
calcFertilizerUseFAO(subtype = "N", by = "nutrient")
calcFertilizerUseFAO(subtype = "N", by = "nutrient")
subtype |
"N" for fertilizer containing nitrogen, "P" for fertilizer containing phosphorus (note that there is an overlap between those categories, as some fertilizers include both nutrients) |
by |
"nutrient" if referring to amount of nutrients (N or P) in total used fertilizer, or "product" if referring to total amount of fertilizer used |
List of magpie objects with results on country level, weight on country level, unit and description.
Debbora Leip
## Not run: calcOutput("FertilizerUseFAO", subtype = "N", by = "nutrient") ## End(Not run)
## Not run: calcOutput("FertilizerUseFAO", subtype = "N", by = "nutrient") ## End(Not run)
Converts FAO data to fit to the common country list and removes or converts relative values where possible. Yields (Hg/ha) are for instance removed since they can later easily be calculated from production and area but might be problematic in the spatial aggregation. Per capita demand values are transformed into absolute values using population estimates from the calcPopulationPast function.
convertFAO(x, subtype)
convertFAO(x, subtype)
x |
MAgPIE object containing original values |
subtype |
The FAO file type, e.g.: CBCrop |
Update 23-Jan-2017 - Added FAO Forestry production and trade data (Abhi)
Data as MAgPIE object with common country list
Ulrich Kreidenweis, Abhijeet Mishra, Mishko Stevanovic
[readFAO()], [readSource()],
## Not run: a <- readSource("FAO", "Crop", convert = TRUE) ## End(Not run)
## Not run: a <- readSource("FAO", "Crop", convert = TRUE) ## End(Not run)
Convert FRA 2015 data Update dd-Jmm-jjjj - Please add comment if changes made here (Abhi)
convertFAO_FRA2015(x, subtype)
convertFAO_FRA2015(x, subtype)
x |
MAgPIE object containing original values |
subtype |
The FAO FRA 2015 file type, e.g.: fac, production, biodiversity or anndat. |
Data as MAgPIE object with common country list
Abhijeet Mishra
[readSource()],
## Not run: a <- readSource("FRA2015", "production", convert = TRUE) ## End(Not run)
## Not run: a <- readSource("FRA2015", "production", convert = TRUE) ## End(Not run)
Converts FAO data to fit to the common country list and removes or converts relative values where possible. Yields (Hg/ha) are for instance removed since they can later easily be calculated from production and area but might be problematic in the spatial aggregation. Per capita demand values are transformed into absolute values using population estimates from the calcPopulationPast function.
convertFAO_online(x, subtype)
convertFAO_online(x, subtype)
x |
MAgPIE object containing original values |
subtype |
The FAO file type, e.g.: CBCrop |
Update 23-Jan-2017 - Added FAO Forestry production and trade data (Abhi)
Data as MAgPIE object with common country list
Ulrich Kreidenweis, Abhijeet Mishra, Mishko Stevanovic, David Klein, Daivd Chen, Edna Molina Bacca
[readFAO()], [readSource()],
## Not run: a <- readSource("FAO_online", "Crop", convert = TRUE) ## End(Not run)
## Not run: a <- readSource("FAO_online", "Crop", convert = TRUE) ## End(Not run)
Convert FAOSTAT detailed trade matrix. FAOSTAT does not balance or harmonize the import/export side reporting. Furthermore, in terms of trade value, exporters are "usuallY" reporting FOB, while importers report CIF. Difference in value, given identical qty, is thus the transport margin mixed with unharmonized reporting.
convertFAOTradeMatrix(x, subtype)
convertFAOTradeMatrix(x, subtype)
x |
output from read function |
subtype |
subsets of the detailed trade matrix to read in. Very large csv needs to be read in chunks separated by export/import quantities and values, as well as kcr, kli and kothers (not in kcr nor kli) Options are all combinations of c("import_value", "import_qty", "export_value", "export_quantity") X c("kcr", "kli", "kothers")) import is import side reporting while export is export-sde reporting |
FAO data as MAgPIE object in Mt or US$ 2017
David C
[readSource()]
Convert FRA 2020 data
convertFRA2020(x, subtype)
convertFRA2020(x, subtype)
x |
MAgPIE object containing original values |
subtype |
The FAO FRA 2020 subtype. |
Data as MAgPIE object with common country list
Abhijeet Mishra
[readSource()],
## Not run: a <- readSource("FRA2020", "growing_stock", convert = TRUE) ## End(Not run)
## Not run: a <- readSource("FRA2020", "growing_stock", convert = TRUE) ## End(Not run)
Corrects FAO data for known mismatches or insufficiencies
correctFAO(x, subtype)
correctFAO(x, subtype)
x |
MAgPIE object containing original values |
subtype |
The FAO file type, e.g.: CBCrop |
Data as MAgPIE object
Kristine Karstens
[readFAO()], [readSource()],
## Not run: a <- readSource("FAO", "Crop", convert = TRUE) ## End(Not run)
## Not run: a <- readSource("FAO", "Crop", convert = TRUE) ## End(Not run)
Corrects FAO data for known mismatches or insufficiencies
correctFAO_online(x, subtype)
correctFAO_online(x, subtype)
x |
MAgPIE object containing original values |
subtype |
The FAO file type, e.g.: CBCrop |
Data as MAgPIE object
Kristine Karstens
[readFAO()], [readSource()],
## Not run: a <- readSource("FAO_online", "Crop", convert = TRUE) ## End(Not run)
## Not run: a <- readSource("FAO_online", "Crop", convert = TRUE) ## End(Not run)
Downloads the latest data and meta data form the FAOStat website.
downloadFAO_online(subtype)
downloadFAO_online(subtype)
subtype |
Type of FAO data that should be read. |
Read in FAO data that has been bulk downloaded from the FAOSTAT website. Files with exception of fodder.csv are aquired from: http://faostat.fao.org/Portals/_Faostat/Downloads/zip_files/
readFAO(subtype)
readFAO(subtype)
subtype |
Type of FAO data that should be read. Available types are:
|
Update 23-Jan-2017 - Added FAO Forestry production and trade data (Abhi)
FAO data as MAgPIE object
Ulrich Kreidenweis, Abhijeet Mishra, Mishko Stevanovic
[readSource()]
## Not run: a <- readSource("FAO", "Crop") ## End(Not run)
## Not run: a <- readSource("FAO", "Crop") ## End(Not run)
Read-in an FRA data from 2015 (forest resource assessment)
readFAO_FRA2015(subtype)
readFAO_FRA2015(subtype)
subtype |
data subtype. Either "production" or "fac" (forest area and characteristics) or "biodiversity" or "anndat" (Annual Data) |
magpie object of the FRA 2015 data
Abhijeet Mishra
[readSource()]
## Not run: a <- readSource("FAO_FRA2015", "production") ## End(Not run)
## Not run: a <- readSource("FAO_FRA2015", "production") ## End(Not run)
Read in FAO data that has been downloaded from the FAOSTAT website. Files with exception of fodder.csv are aquired according to downloadFAO.
readFAO_online(subtype)
readFAO_online(subtype)
subtype |
Type of FAO data that should be read. Available types are:
|
Update 23-Jan-2017 - Added FAO Forestry production and trade data (Abhi)
FAO data as MAgPIE object
Ulrich Kreidenweis, Abhijeet Mishra, Mishko Stevanovic, David Klein, Edna Molina Bacca
[readSource()]
## Not run: a <- readSource("FAO_online", "Crop") ## End(Not run)
## Not run: a <- readSource("FAO_online", "Crop") ## End(Not run)
Food and Agriculture Organization of the United Nations, World Health Organization, and United Nations University. 1985. "Energy and protein requirements." http://www.who.int/iris/handle/10665/39527.
readFAO_WHO_UNU1985()
readFAO_WHO_UNU1985()
MAgPIE object
Benjamin Bodirsky
[readSource()]
## Not run: a <- readSource("Schofield") ## End(Not run)
## Not run: a <- readSource("Schofield") ## End(Not run)
Read in FAOSTAT detail trade matrix. FAOSTAT does not balance or harmonize the import/export side reporting. Furthermore, in terms of trade value, exporters are "usuallY" reporting FOB, while importers report CIF. Difference in value, given identical qty, is thus the transport margin and any unharmonized reporting combined.
readFAOTradeMatrix(subtype)
readFAOTradeMatrix(subtype)
subtype |
subsets of the detailed trade matrix to read in. Very large csv needs to be read in chunks separated by export/import quantities and values, as well as kcr, kli and kothers (not in kcr nor kli) Options are all combinations of c("import_value", "import_qty", "export_value", "export_quantity" X c("kcr", "kli", "kothers")) import is import side reporting while export is export-sde reporting |
FAO data as MAgPIE object
David C
[readSource()]
## Not run: a <- readSource("FAOTradeMatrix", "import_value_kcr") ## End(Not run)
## Not run: a <- readSource("FAOTradeMatrix", "import_value_kcr") ## End(Not run)
Reads data of fisheries generated using the FishstatJ app of FAO. Read-in specifically, exports_value, exports_quantity, and/or overall production of fish/aquatic products.
readFishstatJ_FAO(subtype = "Production")
readFishstatJ_FAO(subtype = "Production")
subtype |
data subtype needed. Either "exportsValue", "exportsQuantity", or "Production" |
magpie object of either tonnes of liveweight or 1000 current USD
Edna J. Molina Bacca
[readSource()]
## Not run: a <- readSource("FishstatJ_FAO", "Production") a <- readSource("FishstatJ_FAO", "exportsQuantity") a <- readSource("FishstatJ_FAO", "exportsValue") ## End(Not run)
## Not run: a <- readSource("FishstatJ_FAO", "Production") a <- readSource("FishstatJ_FAO", "exportsQuantity") a <- readSource("FishstatJ_FAO", "exportsValue") ## End(Not run)
Read-in an FRA (forest resource assessment) dataset from 2020.
readFRA2020(subtype)
readFRA2020(subtype)
subtype |
data subtype. Available subtypes: forest_area, deforestation, growing_stock, biomass_stock, carbon_stock, management, disturbance, forest_fire |
Magpie object of the FRA 2020 data
Abhijeet Mishra
[readSource()]
## Not run: a <- readSource("FRA2020", "growing_stock") ## End(Not run)
## Not run: a <- readSource("FRA2020", "growing_stock") ## End(Not run)
Read-in a file containing the attributes of MAgPIE products. Currently Covers dry matter (DM), reactive nitrogen (Nr), Phosphorus (P), Generalizable Energy (GE) and wet matter (WM). Values are assembled from various literature sources, and the weighting and allocation is done in the spreadsheet crop_specifications_06_2011.ods and livestock_specifications_2012_06_14.ods in the svn folder /tools/Nutrients . Values standardized on DM.
readProductAttributes(subtype = "Products")
readProductAttributes(subtype = "Products")
subtype |
Available subtypes: "Products", MAgPIE products "AgResidues" Aboveground crop residues and "BgResidues" Belowground crop residues |
magpie object with the dimension crops and attributes
Benjamin Leon Bodrisky
[readSource()]
## Not run: a <- readSource("ProductAttributes") ## End(Not run)
## Not run: a <- readSource("ProductAttributes") ## End(Not run)
Extrapolate fodder data, based on two time steps (5-averages around this years)
toolExtrapolateFodder(x, exyears = c(2004, 2009), average = 5, endyear = 2015)
toolExtrapolateFodder(x, exyears = c(2004, 2009), average = 5, endyear = 2015)
x |
input data |
exyears |
two years |
average |
the averaging_range in toolTimeInterpolate |
endyear |
year till when it should be extrapolated |
magpie object including extrapolated years
Kristine Karstens
Allows to combine two similar FAO datasets with dublicates being removed. For instance combine Production:Crops and Production: Crops Processed to one magpie object
toolFAOcombine(..., combine = "Item")
toolFAOcombine(..., combine = "Item")
... |
two magpie objects with FAO data |
combine |
"Item" to combine datasets that for instance both contain palm oil data |
MAgPIE object with data from both inputs but dublicates removed
Ulrich Kreidenweis
[readSource()]
## Not run: a <- toolFAOcombine(Crop, CropPro, combine = "Item") ## End(Not run)
## Not run: a <- toolFAOcombine(Crop, CropPro, combine = "Item") ## End(Not run)