NLMR icon indicating copy to clipboard operation
NLMR copied to clipboard

`user_seed` parameter for `nlm_mpd`

Open bniebuhr opened this issue 3 years ago • 1 comments

Is it possible to include a user_seed parameter for nlm_mpd, in a way similar to, e.g., nlm_gaussianfield or nlm_fbm? This would be useful to create the very same landscapes with different degrees of clumpiness.

bniebuhr avatar Nov 30 '21 12:11 bniebuhr

So far I have explored that doing this trick:

# function with user_seed
nlm_mpd_seed <- function(user_seed = 123, ...) {
  set.seed(user_seed)
  NLMR::nlm_mpd(...)
}

# parameters
param_df <- expand.grid(ncol = 100,
                        nrow = 100,
                        resolution = 100, 
                        roughness = c(seq(0.1, 1, 0.1), 2), #0.5,
                        rand_dev = 1 #c(0.1, 1, 5, 10, 100)
                        ) %>% 
  tibble::as_tibble()

# simulated landscapes
nlm_list = param_df %>% pmap(nlm_mpd_seed, user_seed = 123)

# plot
landscapetools::show_landscape(nlm_list)

but it would be nice to have it within the function.

bniebuhr avatar Nov 30 '21 12:11 bniebuhr