RAJohansen / waterquality

Package designed to detect and quantify water quality and cyanobacterial harmful algal bloom (CHABs) from remotely sensed imagery
https://rajohansen.github.io/waterquality/
Other
42 stars 8 forks source link

Wrong Error when algorithm is NA #9

Closed RAJohansen closed 6 years ago

RAJohansen commented 6 years ago

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'

Nowosad commented 6 years ago

Reproducible error:

library(raster)
#> Loading required package: sp
library(waterquality)

l8 = stack(system.file("raster/L8_Taylorsville.tif", package = "waterquality"))
l8_ndci = wq_calc(raster_stack = l8, alg = "MM12NDCI", sat = "landsat8")
#> Error in wq_calc(raster_stack = l8, alg = "MM12NDCI", sat = "landsat8"): Unknown satellite or instrument.Please provide one of: 'worldview2', 'sentinel2', 'landsat8', 'modis', or 'meris'

Created on 2018-06-20 by the reprex package (v0.2.0).

Nowosad commented 6 years ago

@RAJohansen How about this:

library(raster)
#> Loading required package: sp
library(waterquality)

l8 = stack(system.file("raster/L8_Taylorsville.tif", package = "waterquality"))
l8_ndci = wq_calc(raster_stack = l8, alg = "MM12NDCI", sat = "landsat8")
#> Error in wq_calc(raster_stack = l8, alg = "MM12NDCI", sat = "landsat8"): Some of the algorithms are not available for the selected satellite.
#> Please provide appropriate algorithms' names

Created on 2018-06-20 by the reprex package (v0.2.0).

RAJohansen commented 6 years ago

Good!