r-spatial / gstat

Spatial and spatio-temporal geostatistical modelling, prediction and simulation
http://r-spatial.github.io/gstat/
GNU General Public License v2.0
195 stars 49 forks source link

Messages are emitted by code that rmarkdown cannot suppress #116

Closed alankjackson closed 2 years ago

alankjackson commented 2 years ago

Here is a reprex:

df_temp <- as_tibble(replicate(3,sample(0:100,10,rep=TRUE))) %>% rename(x=1, y=2, z=3)
df_temp <- sf::st_as_sf(df_temp, coords=c("x", "y"), agr = "identity")
df_out <- sf::st_sfc(sf::st_point(c(50,50))) 

fit_IDW <- gstat::gstat( 
  formula = z ~ 1,
  data = df_temp, 
  set = list(idp = 1) 
)

interp_IDW <- predict(fit_IDW, df_out)
suppressMessages(interp_IDW <- predict(fit_IDW, df_out))

[inverse distance weighted interpolation] [inverse distance weighted interpolation]

Even worse is when running sf::st_as_sf(gstat::gstat.cv(fit_IDW)) I get output like:

| | 0% [inverse distance weighted interpolation] |= | 2% [inverse distance weighted interpolation] |=== | 4% inverse distance weighted interpolation] |==== | 5% etc....

edzer commented 2 years ago

Did you try setting debug.level = 0?

alankjackson commented 2 years ago

Much improved, but

Validate <- sf::st_as_sf(gstat::gstat.cv(fit_IDW, debug.level=0)) |=================================================================================| 100%

edzer commented 2 years ago

How about reading the documentation of gstat.cv?

alankjackson commented 2 years ago

Thank you.