mikejohnson51 / climateR

An R 📦 for getting point and gridded climate data by AOI
https://mikejohnson51.github.io/climateR/
MIT License
168 stars 40 forks source link

Error with getMACA function to extract a time series #98

Closed CatherineGilbert closed 1 month ago

CatherineGilbert commented 1 month ago

Using the getMACA function to extract a time series for one or more points returns the error "Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘crs’ for signature ‘"POSIXct"’."

Here's an example with the built-in dataset.

cities = readRDS(system.file("co/cities_colorado.rds", package = "climateR"))
cities = cities[1,]

pts = getMACA(AOI = cities,
              varname = "pr",
              startDate = "2024-01-01",
              endDate = "2025-01-01",
              model = "CCSM4",
              ID = "NAME")

And here's my session info.

R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] sf_1.0-16       climateR_0.3.5  AOI_0.3.0       apsimx_2.7.7    lubridate_1.9.3 forcats_1.0.0   stringr_1.5.1   dplyr_1.1.4    
 [9] purrr_1.0.2     readr_2.1.5     tidyr_1.3.1     tibble_3.2.1    ggplot2_3.5.1   tidyverse_2.0.0

loaded via a namespace (and not attached):
 [1] gtable_0.3.5        xfun_0.45           tzdb_0.4.0          vctrs_0.6.5         tools_4.3.3         generics_0.1.3     
 [7] parallel_4.3.3      gifski_1.12.0-2     proxy_0.4-27        fansi_1.0.6         RSQLite_2.3.6       blob_1.2.4         
[13] pkgconfig_2.0.3     KernSmooth_2.23-22  assertthat_0.2.1    lifecycle_1.0.4     compiler_4.3.3      munsell_0.5.1      
[19] terra_1.7-78        codetools_0.2-19    class_7.3-22        pillar_1.9.0        classInt_0.4-10     cachem_1.0.8       
[25] RNetCDF_2.9-2       ncmeta_0.4.0        parallelly_1.37.1   digest_0.6.36       tidyselect_1.2.1    rvest_1.0.4        
[31] future_1.33.2       stringi_1.8.4       listenv_0.9.1       tidygeocoder_1.0.5  arrow_16.1.0        fastmap_1.1.1      
[37] rnaturalearth_1.0.1 grid_4.3.3          colorspace_2.1-0    cli_3.6.1           magrittr_2.0.3      utf8_1.2.4         
[43] future.apply_1.11.2 e1071_1.7-14        withr_3.0.0         scales_1.3.0        bit64_4.0.5         timechange_0.3.0   
[49] httr_1.4.7          globals_0.16.3      bit_4.0.5           hms_1.1.3           memoise_2.0.1       knitr_1.48         
[55] rlang_1.1.3         Rcpp_1.0.12         glue_1.7.0          DBI_1.2.3           xml2_1.3.6          rstudioapi_0.16.0  
[61] jsonlite_1.8.8      R6_2.5.1            units_0.8-5         fipio_1.1.2        

Thanks.

CatherineGilbert commented 1 month ago

Actually works fine when more points are added.