Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make visible warning messages in interactive/verbose mode #77

Merged
merged 1 commit into from
May 6, 2022

Conversation

brownag
Copy link
Member

@brownag brownag commented May 6, 2022

This does not generate actual R warnings. It also does not change the character result -- it is still (should be) tool name and elapsed time when a warning is issued; character of length 1.

Two examples:

library(sf)
library(terra)
library(soilDB)
library(whitebox)

wbt_verbose(TRUE)
m <- SDA_spatialQuery(st_as_sfc('POLYGON((-120.4712 37.9501,-120.4712 37.9625,-120.4369 37.9625,-120.4369 37.9501,-120.4712 37.9501))', 4326), what = 'mupolygon', geomIntersection = TRUE)

m$foo <- letters[1:nrow(m)]
write_sf(m, "test.shp")

wbt_vector_polygons_to_raster("./test.shp", "./test.tif", field = 'foo', cell_size = 0.001)
#> Warning: Non-numeric attributes cannot be directly assigned to raster data. A key will be established.
#> vector_polygons_to_raster - Elapsed Time (excluding I/O): 0.1s
library(terra)
library(whitebox)
wbt_verbose(TRUE)

writeRaster(rast(matrix(
  c(2, 2, 1, 1, 1,
    2, 1, 1, 0, 1,
    1, 1, 1, 1, 1),
  ncol = 5, byrow = TRUE
), crs = "EPSG:4326"), filename = "test.tif")

wbt_fd8_flow_accumulation("test.tif", "test2.tif")
#> **********************************************************************************
#> WARNING: Interior pit cells were found within the input DEM. It is likely that the 
#>             DEM needs to be processed to remove topographic depressions and flats prior to
#>             running this tool.
#> **********************************************************************************
#> fd8_flow_accumulation - Elapsed Time (excluding I/O): 0.0s

@brownag brownag merged commit 4e13923 into opengeos:master May 6, 2022
@brownag brownag deleted the warnMsg branch May 6, 2022 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant