Git Product home page Git Product logo

waterquality's Introduction

CRAN status codecov downloads

waterquality

The main purpose of waterquality is to quickly and easily convert satellite-based reflectance imagery into one or many well-known water quality indices designed for the detection of Harmful Algal Blooms (HABs) using the following pigment proxies: chlorophyll-a, blue-green algae (phycocyanin), and turbidity. Currently, this package is able to process 40 algorithms for the following satellite-based imagers: WorldView-2, Sentinel-2, Landsat-8, MODIS, MERIS, and OLCI. In order to improve the aesthetics of the wq_calc() output, a series of Map_WQ() functions were developed to help reduce technical barriers and simplify the complexities in selecting a map layout. Additional functionality of the package includes a series of extract_lm() functions that wrap the “Fitting Linear Models” and “caret” packages to quickly generate crossvalidated linear models and standardized outputs (r2, p-value, slope, intercept of the global lm model & average r2, average RMSE, average MAE of crossvalidated model) for any number of algorithm and water quality parameter combinations. It is important to note that the extract_lm() functions require ground-truth data in order to develop the models. For a more detailed look into the full functionality of waterquality, please view “Introduction to the waterquality package”. For a broader look into how to apply this tool into a research workflow or for more information on topics such as data acquisition, image pre-processing, or results, see our publication entitled “Waterquality: An Open-Source R Package for the Detection and Quantification of Cyanobacterial Harmful Algal Blooms and Water Quality”.

Additionally, we have recently developed and published a complementary python-based version of waterquality compatible with ESRI ArcGIS and ArcPro. For more information please visit “waterquality for ArcGIS Pro Toolbox”.

Installation

You can install the released version from CRAN with:

install.packages("waterquality")

You can install waterquality from github with:

# install.packages("devtools")
devtools::install_github("RAJohansen/waterquality")

Basic Example

The main function in this package is wq_calc():

library(waterquality)
library(terra)
s2 = terra::rast(system.file("raster/S2_Harsha.tif", package = "waterquality"))
MM12NDCI = wq_calc(s2, alg = "MM12NDCI", sat = "sentinel2")
Map_WQ_raster(WQ_raster = MM12NDCI,
              map_title= "Water Quality Map",
              raster_style = "quantile",
              histogram = TRUE)
#> The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
#> which was just loaded, will retire in October 2023.
#> Please refer to R-spatial evolution reports for details, especially
#> https://r-spatial.org/r/2023/05/15/evolution4.html.
#> It may be desirable to make the sf package available;
#> package maintainers should consider adding sf to Suggests:.
#> The sp package is now running under evolution status 2
#>      (status 2 uses the sf package in place of rgdal)

Citation

To cite waterquality in publications, please use:

Johansen R, Nowosad J, Reif M, Emery E (2023). waterquality: Satellite Derived Water Quality Detection Algorithms. U.S Army Engineer Research and Development Center, Vicksburg, MS, USA. R package version 1.0.0, https://github.com/RAJohansen/waterquality/.

Package Contributions

We encourage users to submit issues and enhancement requests so we may continue to improve our package.

Furthermore, if you have a water quality algorithm that was not on our list, and you would like for it to be included in our package please email [email protected].

waterquality's People

Contributors

nowosad avatar olivroy avatar rajohansen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

waterquality's Issues

Please remove dependencies on **rgdal**, **rgeos**, and/or **maptools**

This package depends on (depends, imports or suggests) raster and one or more of the retiring packages rgdal, rgeos or maptools (https://r-spatial.org/r/2022/04/12/evolution.html, https://r-spatial.org/r/2022/12/14/evolution2.html). Since raster 3.6.3, all use of external FOSS library functionality has been transferred to terra, making the retiring packages very likely redundant. It would help greatly if you could remove dependencies on the retiring packages as soon as possible.

Error when running "all" algorithms

I think the error is due to the algorithm formula (look to make sure the band math makes sense)

Harsha_All <- wq_calc(raster_stack = Harsha, alg = "all", sat = "sentinel2" )

Error in .overlayList(x, fun = fun, filename = filename, forcefun = forcefun, :
cannot use this formula, probably because it is not vectorized

formula(x) is deprecated error

The function extract_lm_cv uses my_formula = as.formula(paste(parameter, "~" ,algorithm)) but when this is passed to the function extract_lm_cv_multi we receive the following error

"Using formula(x) is deprecated when x is a character vector of length > 1.
Consider formula(paste(x, collapse = " ")) instead."

Need to figure out a way to recode extract_lm_cv so that it works for single and multiple independent/dependent variables.

Wrong Error when algorithm is NA

MM12NDCI is not available as a landsat8 algorithm (i.e. it is NA), but the error states the problem is because I chose the wrong satellite. We need to change that error to say "MM12NDCI is NA for landsat8" or "MM12NDCI is not available for the selected satellite, please chose an appropriate algorithm"

Example Code:
Harsha_ndci <- wq_calc(raster_stack = Harsha, alg = "MM12NDCI", sat = "landsat8")

Error Code:
Error in wq_calc(raster_stack = Harsha, alg = "MM12NDCI", sat = "landsat8") :
Unknown satellite or instrument.Please provide one of: 'worldview2', 'sentinel2', 'landsat8', 'modis', or 'meris'

Calculating line height algorithms

Hi,

Thanks for your contribution of this package. I want to check about two line height algorithms that you include: Go04MCI and Zh10FLH. I'm familiar with MCI and FLH, but not with the "Go04" and "Zh10" prefixes - are these meant to be different from the original algorithms? I ask because the calculation of both is different from how a line height algorithm is normally calculated.

The calculation for MCI in the waterquality package amounts to w709 - w753, and for FLH, w686 - w672. Below I attached an image showing how these two algorithms are normally calculated. Could you please clarify if I am missing something?

Thank you,
Wilson

lineheight

Select Algorithms by Type

We need to create a argument similar to alg (within alg is fine too) that allows for the selection of algorithms by type (chlorophyll-a, turbidity, or phycocyanin)

***May want to change the name to metric or something more meaningful than type.

Worldview-2 B8 mislabeled

B8 needs to be corrected from 880nm to 950nm. The documentation is incorrect, but none of the current algorithms make use of this band yet.

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.