The goal of nimbus is to simulate cloud cover and add it to raster files.
You can install the development version of nimbus from GitHub with:
# install.packages("devtools")
devtools::install_github("jonotuke/nimbus")First we load the package.
library(nimbus)
library(raster)
#> Loading required package: sp
## basic example codeWe will illustrate by adding a cloud cover to the example raster. First we look at the example raster
plot(example_raster)We will simulate a
cloud <- simulate_cloud(phi = 0.1, seed = 2023)plot(cloud)Next, we will match the extent and projection of the simulated cloud raster with the original raster.
cloud <- match_rasters(example_raster, cloud)
plot(cloud)cloud
#> class : RasterLayer
#> dimensions : 7061, 7911, 55859571 (nrow, ncol, ncell)
#> resolution : 30, 30 (x, y)
#> extent : 426885, 664215, 7019185, 7231015 (xmin, xmax, ymin, ymax)
#> crs : +proj=utm +zone=55 +south +datum=WGS84 +units=m +no_defs
#> source : memory
#> names : Z
#> values : -5.199408, 5.321076 (min, max)Now, we will filter the cloud and convert values to NAs that will add ask masks in the next stage.
speckled_cloud <- filter_cloud(cloud)
large_cloud <- filter_cloud(cloud, type = "large")plot(speckled_cloud)plot(large_cloud)Finally, we can now add the clouds to the original raster
example_raster |> add_cloud(speckled_cloud) |> plot()example_raster |> add_cloud(large_cloud) |> plot()





