DrylandEcology / rSOILWAT2

A R package for SOILWAT2
GNU General Public License v3.0
10 stars 4 forks source link

`get_soiltemp()` may not return soil temperature across soil profile for old output objects #221

Closed dschlaep closed 1 year ago

dschlaep commented 1 year ago

To extract temperatures at the soil surface and throughout a soil profile, I get expected output from an rSOILWAT2 output object created by rSOILWAT2 v5.3.2 sw_out <- rSOILWAT2::sw_exec(inputData = rSOILWAT2::sw_exampleData)

tmp_st <- rSOILWAT2::get_soiltemp(
  sw_out,
  timestep = "Day",
  levels = c("min", "avg", "max"),
  surface = TRUE,
  soillayers = seq_len(12)
)
lapply(tmp_st, dim)

$min [1] 11323 9 $avg [1] 11323 9 $max [1] 11323 9

However, using and output object created by a previous rSOILWAT2, e.g., v5.0.4, I get for lapply(tmp_st, dim)

$min [1] 11323 1 $avg [1] 11323 1 $max [1] 11323 1

Interestingly, I get the correct output if I don't specify argument soillayers, i.e.,

tmp_st <- rSOILWAT2::get_soiltemp(
  sw_out,
  timestep = "Day",
  levels = c("min", "avg", "max"),
  surface = TRUE
)