Skip to contents

This function create a GeoPressureR map object from a spatio-temporal dataset. The data needs to be discretized according to scale, extend (space) and stap (time).

This functions is used by geopressure_map and graph_marginal.

Usage

map_create(data, extent, scale, stap, id = NA, type = "unknown")

Arguments

data

list of matrices of the same size, one for each stationary period.

extent

geographical extent of the map on which the likelihood and graph model will be computed. Vector of length 4 c(xmin, xmax, ymin, ymax) or c(W, E, S, N).

scale

number of pixels per 1° latitude-longitude. For instance, scale = 10 for a resolution of 0.1° (~10km) and scale=4 for a resolution of 0.25° (~30km). To avoid interpolating the ERA5 data, the scale should be equal to or smaller than 10. Read more about scale on the Google earth Engine documentation .

stap

a data.frame of stationary periods.

id

unique identifier of a tag.

type

type of data one of "unknown","pressure", "light", "pressure_mse", "water_mask", "pressure_mask", "marginal". Allows for custom colour palette on plot.

Value

A GeoPressure map object is returned

See also

Other map: print.map(), rast.map()

Examples

data <- lapply(1:10, \(x) matrix(runif(5000), nrow = 50, ncol = 100))
scale <- 10
extent <- c(0, 10, 0, 5)
seq(as.Date("2023-01-01"), as.Date("2023-01-10"), by = "day")
#>  [1] "2023-01-01" "2023-01-02" "2023-01-03" "2023-01-04" "2023-01-05"
#>  [6] "2023-01-06" "2023-01-07" "2023-01-08" "2023-01-09" "2023-01-10"
stap <- data.frame(
  stap_id = 1:10,
  start = seq(as.POSIXct("2023-01-01", tz = "UTC"),
    as.POSIXct("2023-01-10 UTC", tz = "UTC"),
    by = "day"
  ),
  include = TRUE
)
stap$end <- stap$start + sample(1:10) * 10000

# Create the map
map <- map_create(
  data = data,
  extent = extent,
  scale = scale,
  stap = stap,
  id = "18LX",
  type = "pressure"
)

print(map)
#> 
#> ── GeoPressureR `map` object  of pressure for 18LX ─────────────────────────────
#> 
#> ── Map 
#>  Extent (W, E, S, N): 0°, 10°, 0°, 5°
#>  Dimensions (lat x lon): 50 x 100 (res. 0.1°)
#> 
#> ── Stationary periods stap (n=10) 
#> Run `map$stap` to display full table

plot(map)