Closed raruggie closed 9 months ago
Hi there! Thanks for reaching out,
Using the latest code I am not seeing this issue. Can you please confirm?
library(dplyr)
library(terra)
library(climateR)
load("~/Downloads/glue_issue.Rdata")
j<-1; k<-1
# loop and print classes:
for (i in seq_along(df.ws$Site_Key)){
df.i <- filter(dfHydroGrab, Sample.Name == df.ws$Site_Key[i])
rast.k<-getGridMET(terra::vect(df.ws[i,]),
varname = result_vector[k],
startDate = df.i$DATETIME[j]-21,
endDate = df.i$DATETIME[j])
print(class(rast.k))
}
#> [1] "data.frame"
#> [1] "data.frame"
#> [1] "list"
#> [1] "list"
#> [1] "data.frame"
#> [1] "list"
#> [1] "list"
#> [1] "list"
#> [1] "list"
#> [1] "list"
Created on 2023-12-18 by the reprex package (v2.0.1)
I needed to load the sf library for it to run but I am still getting glue class:
library(dplyr)
library(terra)
library(sf)
library(climateR)
load("C:/PhD/FOR797/FOR797_git/Processed_Data/glue_issue.Rdata")
j<-1; k<-1
# loop and print classes:
for (i in seq_along(df.ws$Site_Key)){
df.i <- filter(dfHydroGrab, Sample.Name == df.ws$Site_Key[i])
rast.k<-getGridMET(terra::vect(df.ws[i,]),
varname = result_vector[k],
startDate = df.i$DATETIME[j]-21,
endDate = df.i$DATETIME[j])
print(class(rast.k))
}
[1] "data.frame"
[1] "data.frame"
[1] "list"
[1] "glue" "character"
[1] "data.frame"
[1] "list"
[1] "list"
[1] "glue" "character"
[1] "list"
[1] "list"
Hi - sorry for the continued issue. What does packageVersion("climateR")
give you? It should be 0.3.2 if recently installed.
I will consider this closed for now - please feel free to re-open!
I have 10 watershed shapefiles in New Hampshire that I want to use in getGridMet. Depending on the watershed used, I get either data.frames, lists, or glue objects. Here is the reproducible example using the Rdata file located here on google drive (https://drive.google.com/file/d/1zETjrQ_IzLFHQTJubwRS-yNsyLzJ3Jmz/view?usp=drive_link):
I am thinking that the smaller watersheds are returning
data.frame
because the watershed only spans one GridMet cell? But I am not sure what is happening with the watersheds that are returning classglue
.Any help would be much appreciated. Thank you.