earthlab / cft

Climate futures toolbox: easy MACA (MACAv2) climate data access 📦
https://www.earthdatascience.org/cft/index.html
25 stars 6 forks source link

single_point_firehose Error in FUN(X[[i]], ...): only defined on a data frame with all numeric variables #158

Closed Davidzhen2020 closed 2 years ago

Davidzhen2020 commented 2 years ago

When I use the single_point_firehose(input_variables, known_lat, known_lon ) download the climate variable Temperature and Rainfall from all of the models and all of the years, the function ends in an error and outputs an error message:

Connection succeeded. Error in FUN(X[[i]], ...) : only defined on a data frame with all numeric variables

traceback() 5: stop("only defined on a data frame with all numeric variables") 4: FUN(X[[i]], ...) 3: lapply(args, function(x) { x <- as.matrix(x) if (!is.numeric(x) && !is.complex(x)) stop("only defined on a data frame with all numeric variables") x }) 2: Summary.data.frame(structure(list(), .Names = character(0), class = "data.frame", row.names = integer(0)), na.rm = FALSE) 1: single_point_firehose(input_variables, lat_pt, lon_pt, web_link = "https://cida.usgs.gov/thredds/dodsC/macav2metdata_daily_future", verbose = TRUE)

Davidzhen2020 commented 2 years ago

The Error in FUN(X[[i]], ...) error was caused by the single_point_firehose itself. The bad code in the single_point_firehose function is

all(first_pass[,which(names(first_pass) == "time")]) all(first_pass[,which(names(first_pass) == "lon")]) all(first_pass[,which(names(first_pass) == "lat")])