Skip to contents

Each row of df_profiles (one profile) is expanded over a pF grid to produce the [N_profiles * N_pf, K, p+1] array needed for dense curve prediction.

Usage

make_profile_array(
  df_profiles,
  x_inputs,
  scaler,
  K = 64L,
  knot_grid = seq(0, 1, length.out = K)
)

Arguments

df_profiles

Data frame with one row per profile (unique PEDON × depth combination).

x_inputs

Character vector of covariate names.

scaler

Fitted scaler from fit_minmax().

K

Number of knots (default 64L).

knot_grid

Knot positions (default seq(0,1,length.out=K)).

Value

Named list:

Xseq

3-D array [Np, K, p+1].

Np

Number of profiles.

p

Number of covariates.

Examples

df <- prepare_swrc_data(swrc_example, depth_col = "depth")
x  <- c("clay", "silt", "bd_gcm3", "soc", "Depth_num")
sc <- fit_minmax(df, x)
# one row per horizon, de-duplicated: the covariates do not vary with pF
prof <- df[!duplicated(df[, c("PEDON_ID", "Depth_num")]), ]
a <- make_profile_array(prof, x, sc, K = 16L)
a$Np          # profiles
#> [1] 600
a$p           # covariates
#> [1] 5
dim(a$Xseq)   # [Np, K, p + 1]
#> [1] 600  16   6