irg

:package: irg is an R package for calculating the instantaneous rate of green-up.

https://github.com/robitalec/irg

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.3%) to scientific vocabulary

Keywords

irg modis ndvi r
Last synced: 6 months ago · JSON representation ·

Repository

:package: irg is an R package for calculating the instantaneous rate of green-up.

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 7
Topics
irg modis ndvi r
Created about 7 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Codemeta

README.Rmd

---
output: github_document
always_allow_html: yes
---


[![R-CMD-check](https://github.com/robitalec/irg/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/robitalec/irg/actions/workflows/R-CMD-check.yaml)
[![lifecycle](https://img.shields.io/badge/lifecycle-active-green.svg)](https://www.tidyverse.org/lifecycle/#active)
[![CRAN status](https://www.r-pkg.org/badges/version/irg)](https://cran.r-project.org/package=irg)





```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# irg
`irg` is an R package for calculating the instantaneous rate of green-up (IRG).
It can be used to fit a double logistic curve to a time series of normalized
difference vegetation index (NDVI) and calculate IRG, as described in Bischoff
et al. (2012) [[1]](#references). IRG helps identify the timing of green-up and
can be used to determine if migratory animals are "surfing" a green-wave of high
quality forage or if non-migratory animals are selecting available resources at
the peak IRG in their environments. 

~~At the moment, the `irg` package is designed to work with MODIS imagery, but
we're working on adding other sensors~~. Update: we recently added an example
Landsat 8 dataset. The `irg` package functions have been updated to be more
flexible to different sensors. Let us know (open an issue!) if you use a sensor
other than MODIS for calculating IRG. Thanks!



## Approach
The `irg` package opts for a tabular calculation of IRG as opposed to a raster
based approach. Sampling imagery is left up to the user and a prerequisite
for all functions. The main input (`DT`) for all functions is a
[`data.table`](https://github.com/Rdatatable/data.table) of an NDVI time series.
The sampling unit (`id`) is flexible (a decision for the user) though we would
anticipate points or polygons, or maybe a pixel. All functions leverage the
speed of `data.table` to efficiently filter, scale, and model NDVI time series
and calculate IRG.

More details in the first vignette: 
[Getting started with IRG](https://robitalec.github.io/irg/articles/getting-started-with-irg.html). 


## Installation

Install with CRAN

```{r, eval = FALSE}
# Install 
install.packages('irg')
```

or R-universe

```{r, eval = FALSE}
# Enable the robitalec universe
options(repos = c(
    robitalec = 'https://robitalec.r-universe.dev',
    CRAN = 'https://cloud.r-project.org'))

# Install 
install.packages('irg')
```



## Usage

IRG is calculated by filtering an NDVI time series, scaling variables, modeling
the time series with a double logistic curve and taking the first derivative of
this curve.

Here, the example uses  use the meta function `irg`. Generally, users should opt
for the individual filtering, scaling, modeling and irg functions separately to
tweak settings and column names (see 
[Getting started with IRG](https://robitalec.github.io/irg/articles/getting-started-with-irg.html)).

```{r ggIRG, message = FALSE, warning = FALSE}
library(data.table)
library(ggplot2)
library(irg)

# Load package data
ndvi <- fread(system.file("extdata", "sampled-ndvi-MODIS-MOD13Q1.csv", package = "irg"))

# Filter and scale NDVI
filter_ndvi(ndvi)
scale_ndvi(ndvi)
scale_doy(ndvi)

# Guess starting parameters
model_start(ndvi, id = 'id', year = 'yr')

# Double logistic model parameters given starting parameters for nls
mods <- model_params(
  ndvi,
  returns = 'models',
  id = 'id', year = 'yr',
  xmidS = 'xmidS_start', xmidA = 'xmidA_start',
  scalS = 0.05,
  scalA = 0.01
)

# Fit double log to NDVI
fit <- model_ndvi(mods, observed = FALSE)

# Calculate IRG for each day of the year
calc_irg(fit)

# Plot IRG and NDVI for 1 year at 1 point
cols <- c('IRG' = '#14c62f', 'NDVI' = '#47694d')

random_yr <- sample(fit$yr, 1)
random_id <- sample(fit$id, 1)

ggplot(fit[yr == random_yr & id == random_id], aes(x = t)) +
	geom_line(aes(y = irg, color = 'IRG')) +
	geom_line(aes(y = fitted, color = 'NDVI')) +
	geom_point(aes(y = scaled), data = ndvi[yr == random_yr & id == random_id]) + 
	scale_color_manual(values = cols) +
	labs(y = '', color = '')
```




## Functions



  
## Contributing
Contributions welcome! See details in [CONTRIBUTING.md](CONTRIBUTING.md). 

Please note that the `irg` package is released with a 
[Contributor Code of Conduct](CODE_OF_CONDUCT.md). 
By contributing to this package, you agree to abide by its terms.

## Thanks
To [Mike Laforge](https://mammalspatialecology.weebly.com/)
([\@MamlSpatialEco](https://twitter.com/MamlSpatialEco)) and 
[Eric Vander Wal](https://weel.gitlab.io) for thoughtful discussion that 
stimulated development of this package. 

## References

[[1]](https://www.journals.uchicago.edu/doi/abs/10.1086/667590) Bischof, R., Loe, L. E., Meisingset, E. L., Zimmermann, B., Van Moorter, B., & Mysterud, A. (2012). A migratory northern ungulate in the pursuit of spring: jumping or surfing the green wave? *The American Naturalist*, 180(4), 407-424.

Owner

  • Name: Alec L. Robitaille
  • Login: robitalec
  • Kind: user
  • Company: @wildlifeevoeco

(he/him/il)

Citation (CITATION.cff)

# --------------------------------------------
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# --------------------------------------------
 
cff-version: 1.2.0
message: 'To cite package "irg" in publications use:'
type: software
license: GPL-3.0-only
title: 'irg: Instantaneous Rate of Green Up'
version: 0.1.6
doi: 10.32614/CRAN.package.irg
abstract: Fits a double logistic function to NDVI time series and calculates instantaneous
  rate of green (IRG) according to methods described in Bischoff et al. (2012) <https://doi.org/10.1086/667590>.
authors:
- family-names: Robitaille
  given-names: Alec L.
  email: robit.alec@gmail.com
  orcid: https://orcid.org/0000-0002-4706-1762
repository: https://CRAN.R-project.org/package=irg
repository-code: https://github.com/robitalec/irg
url: https://robitalec.github.io/irg/
contact:
- family-names: Robitaille
  given-names: Alec L.
  email: robit.alec@gmail.com
  orcid: https://orcid.org/0000-0002-4706-1762
keywords:
- irg
- modis
- ndvi
- r
references:
- type: software
  title: knitr
  abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
  notes: Suggests
  url: https://yihui.org/knitr/
  repository: https://CRAN.R-project.org/package=knitr
  authors:
  - family-names: Xie
    given-names: Yihui
    email: xie@yihui.name
    orcid: https://orcid.org/0000-0003-0645-5666
  year: '2024'
  doi: 10.32614/CRAN.package.knitr
- type: software
  title: rmarkdown
  abstract: 'rmarkdown: Dynamic Documents for R'
  notes: Suggests
  url: https://pkgs.rstudio.com/rmarkdown/
  repository: https://CRAN.R-project.org/package=rmarkdown
  authors:
  - family-names: Allaire
    given-names: JJ
    email: jj@posit.co
  - family-names: Xie
    given-names: Yihui
    email: xie@yihui.name
    orcid: https://orcid.org/0000-0003-0645-5666
  - family-names: Dervieux
    given-names: Christophe
    email: cderv@posit.co
    orcid: https://orcid.org/0000-0003-4474-2498
  - family-names: McPherson
    given-names: Jonathan
    email: jonathan@posit.co
  - family-names: Luraschi
    given-names: Javier
  - family-names: Ushey
    given-names: Kevin
    email: kevin@posit.co
  - family-names: Atkins
    given-names: Aron
    email: aron@posit.co
  - family-names: Wickham
    given-names: Hadley
    email: hadley@posit.co
  - family-names: Cheng
    given-names: Joe
    email: joe@posit.co
  - family-names: Chang
    given-names: Winston
    email: winston@posit.co
  - family-names: Iannone
    given-names: Richard
    email: rich@posit.co
    orcid: https://orcid.org/0000-0003-3925-190X
  year: '2024'
  doi: 10.32614/CRAN.package.rmarkdown
- type: software
  title: DiagrammeR
  abstract: 'DiagrammeR: Graph/Network Visualization'
  notes: Suggests
  url: https://rich-iannone.github.io/DiagrammeR/
  repository: https://CRAN.R-project.org/package=DiagrammeR
  authors:
  - family-names: Iannone
    given-names: Richard
    email: riannone@me.com
    orcid: https://orcid.org/0000-0003-3925-190X
  - family-names: Roy
    given-names: Olivier
    email: olivierroy71@hotmail.com
  year: '2024'
  doi: 10.32614/CRAN.package.DiagrammeR
- type: software
  title: ggplot2
  abstract: 'ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics'
  notes: Suggests
  url: https://ggplot2.tidyverse.org
  repository: https://CRAN.R-project.org/package=ggplot2
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: hadley@posit.co
    orcid: https://orcid.org/0000-0003-4757-117X
  - family-names: Chang
    given-names: Winston
    orcid: https://orcid.org/0000-0002-1576-2126
  - family-names: Henry
    given-names: Lionel
  - family-names: Pedersen
    given-names: Thomas Lin
    email: thomas.pedersen@posit.co
    orcid: https://orcid.org/0000-0002-5147-4711
  - family-names: Takahashi
    given-names: Kohske
  - family-names: Wilke
    given-names: Claus
    orcid: https://orcid.org/0000-0002-7470-9261
  - family-names: Woo
    given-names: Kara
    orcid: https://orcid.org/0000-0002-5125-4188
  - family-names: Yutani
    given-names: Hiroaki
    orcid: https://orcid.org/0000-0002-3385-7233
  - family-names: Dunnington
    given-names: Dewey
    orcid: https://orcid.org/0000-0002-9415-4582
  - family-names: Brand
    given-names: Teun
    name-particle: van den
    orcid: https://orcid.org/0000-0002-9335-7468
  year: '2024'
  doi: 10.32614/CRAN.package.ggplot2
- type: software
  title: curl
  abstract: 'curl: A Modern and Flexible Web Client for R'
  notes: Suggests
  url: https://jeroen.r-universe.dev/curl
  repository: https://CRAN.R-project.org/package=curl
  authors:
  - family-names: Ooms
    given-names: Jeroen
    email: jeroenooms@gmail.com
    orcid: https://orcid.org/0000-0002-4035-0289
  year: '2024'
  doi: 10.32614/CRAN.package.curl
- type: software
  title: tinytest
  abstract: 'tinytest: Lightweight and Feature Complete Unit Testing Framework'
  notes: Suggests
  url: https://github.com/markvanderloo/tinytest
  repository: https://CRAN.R-project.org/package=tinytest
  authors:
  - family-names: Loo
    given-names: Mark
    name-particle: van der
    email: mark.vanderloo@gmail.com
    orcid: https://orcid.org/0000-0002-9807-4686
  year: '2024'
  doi: 10.32614/CRAN.package.tinytest
- type: software
  title: 'R: A Language and Environment for Statistical Computing'
  notes: Depends
  url: https://www.R-project.org/
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2024'
  version: '>= 2.10'
- type: software
  title: data.table
  abstract: 'data.table: Extension of `data.frame`'
  notes: Imports
  url: https://r-datatable.com
  repository: https://CRAN.R-project.org/package=data.table
  authors:
  - family-names: Barrett
    given-names: Tyson
    email: t.barrett88@gmail.com
  - family-names: Dowle
    given-names: Matt
    email: mattjdowle@gmail.com
  - family-names: Srinivasan
    given-names: Arun
    email: asrini@pm.me
  - family-names: Gorecki
    given-names: Jan
  - family-names: Chirico
    given-names: Michael
  - family-names: Hocking
    given-names: Toby
    orcid: https://orcid.org/0000-0002-3146-0865
  year: '2024'
  doi: 10.32614/CRAN.package.data.table
- type: software
  title: RcppRoll
  abstract: 'RcppRoll: Efficient Rolling / Windowed Operations'
  notes: Imports
  repository: https://CRAN.R-project.org/package=RcppRoll
  authors:
  - family-names: Ushey
    given-names: Kevin
  year: '2024'
  doi: 10.32614/CRAN.package.RcppRoll
- type: software
  title: stats
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2024'
- type: software
  title: chk
  abstract: 'chk: Check User-Supplied Function Arguments'
  notes: Imports
  url: https://poissonconsulting.github.io/chk/
  repository: https://CRAN.R-project.org/package=chk
  authors:
  - family-names: Thorley
    given-names: Joe
    email: joe@poissonconsulting.ca
    orcid: https://orcid.org/0000-0002-7683-4592
  - family-names: Müller
    given-names: Kirill
    orcid: https://orcid.org/0000-0002-1416-3412
  - family-names: Pearson
    given-names: Ayla
    orcid: https://orcid.org/0000-0001-7388-1222
  year: '2024'
  doi: 10.32614/CRAN.package.chk

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "irg",
  "description": "Fits a double logistic function to NDVI time series and calculates instantaneous rate of green (IRG) according to methods described in Bischoff et al. (2012) <doi:10.1086/667590>. ",
  "name": "irg: Instantaneous Rate of Green Up",
  "relatedLink": "https://robitalec.github.io/irg/",
  "codeRepository": "https://github.com/robitalec/irg",
  "issueTracker": "https://github.com/robitalec/irg/issues",
  "license": "https://spdx.org/licenses/GPL-3.0",
  "version": "0.1.6",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.4.2 (2024-10-31)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Alec L.",
      "familyName": "Robitaille",
      "email": "robit.alec@gmail.com",
      "@id": "https://orcid.org/0000-0002-4706-1762"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Alec L.",
      "familyName": "Robitaille",
      "email": "robit.alec@gmail.com",
      "@id": "https://orcid.org/0000-0002-4706-1762"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "knitr",
      "name": "knitr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=knitr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "rmarkdown",
      "name": "rmarkdown",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rmarkdown"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "DiagrammeR",
      "name": "DiagrammeR",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=DiagrammeR"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "ggplot2",
      "name": "ggplot2",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=ggplot2"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "curl",
      "name": "curl",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=curl"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "tinytest",
      "name": "tinytest",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=tinytest"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 2.10"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "data.table",
      "name": "data.table",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=data.table"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "RcppRoll",
      "name": "RcppRoll",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=RcppRoll"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "stats",
      "name": "stats"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "chk",
      "name": "chk",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=chk"
    },
    "SystemRequirements": null
  },
  "fileSize": "268.911KB"
}

GitHub Events

Total
  • Delete event: 1
  • Push event: 4
  • Pull request event: 2
  • Create event: 1
Last Year
  • Delete event: 1
  • Push event: 4
  • Pull request event: 2
  • Create event: 1

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 361
  • Total Committers: 1
  • Avg Commits per committer: 361.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 6
  • Committers: 1
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Alec Robitaille r****c@g****m 361

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 16
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.06
  • Merged pull requests: 16
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • robitalec (17)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 261 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: irg

Instantaneous Rate of Green Up

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 261 Last month
Rankings
Stargazers count: 28.5%
Forks count: 28.8%
Dependent packages count: 29.8%
Average: 33.6%
Dependent repos count: 35.5%
Downloads: 45.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • RcppRoll * imports
  • chk * imports
  • data.table * imports
  • stats * imports
  • DiagrammeR * suggests
  • curl * suggests
  • ggplot2 * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • tinytest * suggests