Giter Club home page Giter Club logo

nani's Introduction

nani

Calculates net anthropogenic input index and soil system budget for nitrogen and phosphorus.

Codecov test coverage

Installation

# install the devtools package and then
library(devtools)

install_github("alexology/nani", ref = "main")

Basic usage

library(nani)


# load example files

data("animal_numbers")
data("coef_table")
data("crop")
data("fertilizers_quantity")
data("cultivated_area")
data("nfix_table")
data("depositions")
data("depositions_ssb")
data("province_shape")
data("watershed_perc")


# calculate necessary information for net anthropogenic input and soil system budget

crop_production_n <- crop_production(crop, coef_table)
animal_feed_n <- animal_feed(crop_production_n, coef_table)
animal_production_n <- animal_production(animal_numbers, coef_table)
fertilizers_n <- fertilizers(fertilizers_quantity, coef_table, multiplier = 1000)
gross_excretion_n <- animal_excretion(animal_numbers, coef_table, type = "gross")
net_excretion_n <- animal_excretion(animal_numbers, coef_table, type = "net")
animal_consumption_n <- animal_feed_consumption(animal_numbers, coef_table)
human_consumption_n <- human_food_consumption(human_population, coef_table)
human_excretion_n <- human_excretion(human_population, coef_table)
human_food_n <- human_food(crop_production_n, coef_table)
nfix_n <- nitrogen_fixation(cultivated_area, crop, coef_table, nfix_table, multiplier = c(100, 0.01, 1))
depositions_n <- as_nani(depositions, "depositions")
depositions_ssb_n <- as_nani(depositions_ssb, "depositions")

# nani
nani_n <- net_anthropogenic_input(fertilizers_n, depositions_n, nfix_n, crop_production_n, human_food_n, human_consumption_n, human_excretion_n, animal_feed_n, animal_consumption_n, animal_production_n, gross_excretion_n)


# ssb
ssb_n <- soil_system_budget(fertilizers_n, depositions_ssb_n, nfix_n, crop_production_n, net_excretion_n)

# calculate nani and ssb at watershed level
nani_res_wat <- watershed_percentage(nani_n, watershed_perc)
ssb_res_wat <- watershed_percentage(ssb_n, watershed_perc)

# plot the result
plot_maps(nani_res_wat, province_shape, sp_unit = "DEN_PCM", variable = "net_input", alpha = 0.7)

nani's People

Contributors

alexology avatar

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.