Coder Social home page Coder Social logo

spectralr's Introduction

CRAN R-CMD-check Codecov test coverage

spectralR

Spectral reflectance visualisations for user-defined areas

See our vignette for detailed usage examples.

Authors: Oleh Prylutskyi, Vladimir Mikryukov, Dariia Shyriaieva

Description

This package provides tools for obtaining, processing, and visualization of satellite-derived spectral reflectance data for the user-defined polygons of earth surface classes, allowing to explore visually in which wavelengths the classes differ. Input should be a shapefile with polygons of surface classes (it might be polygons of different habitat types, crops, or any other things). We use Sentinel2 L2A satellite mission (only optical bands) as a source of spectral reflectance data, obtained through the Google Earth Engine service.

The workflow depends on rgee R package, which provides a bridge between R and Python API for Google Earth Engine. All the operations with satellite images run in a cloud, and the obtained pixel data is visualized locally afterward. Therefore, the most resource-hungry operations do not overload your local machine despite the extent of input data. But that means that you need a stable Internet connection for using API.

The overall workflow is following:

  1. Load the user’s ESRI shapefile containing polygons for user-defined surface classes, as well as the text or numerical field with classes names (labels).

  2. Apply rgee functionality to retrieve multi-band pixel data for classes polygons from the Google Earth Engine service.

  3. Visualize retrieved pixel data locally, mainly using ggplot2 approach.

Overall workflow

Essential requirements:

  • stable Internet connection (for using API)

  • Installed and correctly pre-configured Python environment (v. 3.5 or above)

  • valid Google Earth Engine account

Installation

Install the released version from CRAN

install.packages("spectralR")

You can install the development version of spectralR like so:

library(remotes)
install_github("olehprylutskyi/spectralR")

spectralR is strongly depends on rgee and sf packages, so install and configure them before installing spectralR. More details in the vignette.

Output examples

Spectral reflectance curves for user-defined set of habitat types

Reflectance per bands for user-defined set of habitat types

Density of values (as violin plots) for selected habitat types per band

References

Shyriaieva, D., Prylutskyi, O. (2021). Exploratory analysis of the spectral reflectance curves of habitat types: a case study on Southern Bug River valley, Ukraine. In: 63rd IAVS Annual Symposium: Book of Abstracts, p. 153.

spectralr's People

Contributors

vmikk avatar olehprylutskyi avatar driadash avatar hadley avatar

Stargazers

Sandalots avatar Tobias Augspurger avatar  avatar Andrew Gene Brown avatar Jakub Nowosad avatar  avatar Antony Barja  avatar Allan Irvine avatar Anton Biatov avatar

Watchers

 avatar Antony Barja  avatar  avatar

spectralr's Issues

broken `@docType package` documentation

You have file 'spectralR/man/spectralR.Rd' with \docType{package},
likely intended as a package overview help file, but without the
appropriate PKGNAME-package \alias as per "Documenting packages" in
R-exts.

This seems to be the consequence of the breaking change

Using @doctype package no longer automatically adds a -package alias.
Instead document _PACKAGE to get all the defaults for package
documentation.

in roxygen2 7.0.0 (2019-11-12) having gone unnoticed, see
r-lib/roxygen2#1491.

As explained in the issue, to get the desired PKGNAME-package \alias
back, you should either change to the new approach and document the new
special sentinel

"_PACKAGE"

or manually add

@Aliases spectralR-package

if remaining with the old approach.

Please fix in your master sources as appropriate, and submit a fixed
version of your package within the next few months.

Dependencies are not installed automatically

spectralR depends on rgee, sf, tidyverse, geojsonio, and reshape. Now user should install them manually before spectralR getting worked. Need to be forced to install during spectralR installation.

To-do list

  • Vignette auto building
  • Add spell check test (e.g., with spelling::spell_check_test)
  • Add unit testing (e.g., with tinytest or testthat)
  • Test code coverage (e.g., with Codecov)
  • Continuous integration testing (R-CMD-check)

spectralR failed to install in Ubuntu 20.04

The package failed to install by
library(remotes) install_github("olehprylutskyi/spectralR")

or building locally from sources in Ubuntu 20.04 with an error message:

double free or corruption (out)
Aborted (core dumped)
Exited with status 134.

Previously was installed successfully with the same system configs. Win10 and OS X - successful installation.

─ Session info ─
setting value
version R version 4.2.0 (2022-04-22)
os Ubuntu 20.04.4 LTS
system x86_64, linux-gnu
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz Europe/Kiev
date 2022-05-26
rstudio 2022.02.2+485 Prairie Trillium (desktop)
pandoc 2.17.1.1 @ /usr/lib/rstudio/bin/quarto/bin/ (via rmarkdown)

─ Packages ─
package * version date (UTC) lib source
cli 3.3.0 2022-04-25 [1] CRAN (R 4.2.0)
digest 0.6.29 2021-12-01 [3] CRAN (R 4.1.2)
evaluate 0.15 2022-02-18 [3] CRAN (R 4.1.2)
fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0)
htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.2.0)
knitr 1.39 2022-04-26 [1] CRAN (R 4.2.0)
rlang 1.0.2 2022-03-04 [3] CRAN (R 4.1.3)
rmarkdown 2.14 2022-04-25 [1] CRAN (R 4.2.0)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0)
xfun 0.31 2022-05-10 [1] CRAN (R 4.2.0)
yaml 2.3.5 2022-02-21 [1] CRAN (R 4.2.0)

[1] /home/oleh/R/x86_64-pc-linux-gnu-library/4.2
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library

Example shapefiles failed to load

Example shapefile filed to load via

sf_df <- prepare.vector.data(system.file("extdata/test_shapefile.shp", package = "spectralR"), "veget_type")

with an error message:

Error: dsn must point to a source, not an empty string

regardless using either RMarkdown or regular R script. Presumably path error.

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.