Plot.Kriged: Visualise kriged raster data and associated uncertainties and...

View source: R/Plotting.R

Plot.KrigedR Documentation

Visualise kriged raster data and associated uncertainties and overlay sf polygons if desired.

Description

Use the ggplot2 plotting engine to easily create visualisations of kriged raster data and associated uncertainties raster data - like the ones obtained using Kriging(...) - and overlay sf polygon data if desired.

Usage

Plot.Kriged(
  Krigs,
  SF,
  Dates,
  Legend = "Air Temperature [K]",
  Size = 1,
  Shape = 1
)

Arguments

Krigs

List of length 2. Containing kriging prediction SpatRast in slot 1 and kriging standard error SpatRast in slot 2.

SF

Optional. SF object which to overlay.

Dates

Optional. Character vector of labels to apply to each layer of the SpatRast. By default, the content of the terra::time() field of the supplied SpatRast objects in list.

Legend

Colour label legend.

Size

Optional. Size of SF overlay.

Shape

Optional. Shape of SF overlay if points.

Value

A ggplot2 object visualising a raster.

See Also

Kriging.

Examples

CDS_rast <- terra::rast(system.file("extdata", "CentralNorway.nc", package = "KrigR"))
Cov_train <- terra::rast(system.file("extdata", "Covariates_Train.nc", package = "KrigR"))
Cov_target <- terra::rast(system.file("extdata", "Covariates_Target.nc", package = "KrigR"))
names(Cov_train) <- names(Cov_target) <- "GMTED2010 [m]"

### kriging itself
ExtentKrig <- Kriging(
  Data = CDS_rast[[1:2]],
  Covariates_training = Cov_train,
  Covariates_target = Cov_target,
  Equation = "GMTED2010",
  Cores = 2,
  FileName = "KrigTest1",
  FileExtension = ".nc",
  Keep_Temporary = TRUE,
  nmax = 40,
  verbose = TRUE
)

Plot.Kriged(Krigs = ExtentKrig)


ErikKusch/KrigR documentation built on Feb. 17, 2025, 2:09 p.m.