Skip to contents

Reshapes x$data into a \(T \times N\) numeric matrix where rows are time steps and columns are grid cells.

Usage

hm_to_matrix(x)

Arguments

x

An hm_hazard object returned by [hm_read_netcdf()].

Value

A numeric matrix with attributes time and coords.

See also

[hm_decode_time()], [hm_standardize_coords()]

Examples

f <- system.file("extdata", "Copernicus_dailymax_1994_2021.nc",
                 package = "HazardMaps")
x <- hm_read_netcdf(f, var = "i10fg")
x <- hm_standardize_coords(x)
x <- hm_decode_time(x)
X <- hm_to_matrix(x)
dim(X)
#> [1] 10226   195