climr icon indicating copy to clipboard operation
climr copied to clipboard

Can't pass SpatRaster to `normal_input`

Open CeresBarros opened this issue 2 years ago • 3 comments

documentation for the normal argument of normal_input suggests that a SpatRaster with normal variable values can be supplied, but I'm encountering an error when trying to supply one. What am I doing wrong?

reprex, with @devl version

library(terra)
  
dbCon <- data_connect()
  
xyz <- structure(list(Long = c(-127.70521, -127.62279, -127.56235, -127.7162, 
                                 ## smaller example in BC
                                 -127.18585, -127.1254, -126.94957, -126.95507),
                        Lat = c(55.3557, 55.38847, 55.28537, 55.25721, 54.88135, 54.65636, 54.6913, 54.61025),
                        Elev = c(291L, 296L, 626L, 377L, 424L, 591L, 723L, 633L),
                        ID = LETTERS[1:8],
                        Zone = c(rep("CWH",3), rep("CDF",5)),
                        Subzone = c("vm1","vm2","vs1",rep("mm",3),"dk","dc")),
                   row.names = c(NA, -8L), class = "data.frame")
  
thebb <- get_bb(xyz)
normalout <- normal_input(dbCon, thebb, normal = list_normal()[1], cache = TRUE)
    
normalout2 <- normal_input(dbCon, thebb, normal = normalout[[1:36]], cache = TRUE)

CeresBarros avatar Dec 21 '23 02:12 CeresBarros

I don't think you're doing anything wrong, but I haven't implemented that yet in the new postgres version. On my todo list.

kdaust avatar Dec 21 '23 19:12 kdaust

@cmahony , @kdaust, is this really necessary for v1.0.0? perhaps for now we could simply fix the documentation?

CeresBarros avatar Feb 14 '24 20:02 CeresBarros

up to @kdaust as i'm not sure how involved this is. fine to leave to v2 if difficult.

cmahony avatar Feb 14 '24 20:02 cmahony