Closed michestzav closed 1 year ago
Hi @michestzav,
Thanks for the note. When climateR
returns a URL it means the connection to the web resource failed.
The urls you are getting do seem correct:
'http://convection.meas.ncsu.edu:8080/thredds/dodsC/prism/daily/combo/2021/PRISM_combo_20210601.nc?tmin[0:1:0][68:1:68][49:1:49]' |>
RNetCDF::open.nc() |>
RNetCDF::var.get.nc("tmin")
#> [1] 8.316999
Created on 2022-01-21 by the reprex package (v2.0.1)
And when calling the entire series we see the same (reprex is not working for me right now with the parrellization I climateR so please excuse the screenshot):
Would you mind running that first example and seeing if you get an error?
Thanks!
Mike
Thanks Mike for replying so fast!
I run the URL as you did and I got the temperature value.
Here is:
plot(Evergreen_prism$tmax)
and
plot(Evergreen_prism$tmin)
Apparently the problem is just with tmin.
Hi @michestzav,
Sorry for the long delay on this. The package has been completely re-written to supply greater flexibility, more datasets, and easier use. In this example, PRISM now works as expected.
library(climateR)
#> Using GDAL version 3.6.0 which was retracted because it cannot write large GPKG files
library(sf)
#> Linking to GEOS 3.11.1, GDAL 3.6.0, PROJ 9.1.1; sf_use_s2() is TRUE
pt<- st_point(c(-122.9765,47.07159)) %>% st_sfc(crs=4326) %>% st_sf()
ss = system.time({
Evergreen_prism <- getPRISM(AOI = pt,varname=c('tmax','tmin'),startDate="2021-01-01",endDate="2021-06-01")
})
message(round(2 * nrow(Evergreen_prism) / ss[3], 3) , " values extracted per second")
#> 2.645 values extracted per second
plot(Evergreen_prism$date, Evergreen_prism$tmax, main = "tmax")
plot(Evergreen_prism$date, Evergreen_prism$tmin, main = "tmin")
Created on 2023-02-16 by the reprex package (v2.0.1)
I hope the package rewrite proves useful to you if you are still using it and pursuing simular research/data questions.
Mike
Hi,
I am using getPRISM() for the first time but for half on the dates it returns a URL. I would really appreciate some help to solve this issue. Thanks in advance!
library(climateR) library(sf) library(AOI)
pt<- st_point(c(-122.9765,47.07159)) %>% st_sfc(crs=4326) %>% st_sf()
Evergreen_prism <- getPRISM(pt,param=c('tmax','tmin'),startDate="2021-1-1",endDate="2021-6-1")
152 prism 47.08333 -122.9583 2021-06-01 26.9139995574951 http://convection.meas.ncsu.edu:8080/thredds/dodsC/prism/da](http://convection.meas.ncsu.edu:8080/thredds/dodsC/prism/daily/combo/2021/PRISM_combo_20210601.nc?tmin[0:1:0][68:1:68][49:1:49])
My R session info is:
R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
system code page: 65001
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] AOI_0.2.0.9000 sf_1.0-5 climateR_0.1.0
loaded via a namespace (and not attached): [1] leaflet.extras_1.0.0 tidyselect_1.1.1 terra_1.5-13 purrr_0.3.4
[5] lattice_0.20-44 rnaturalearth_0.1.0 vctrs_0.3.8 generics_0.1.1
[9] USAboundaries_0.4.0 htmltools_0.5.2 s2_1.0.7 utf8_1.2.2
[13] rlang_0.4.12 e1071_1.7-9 pillar_1.6.4 later_1.3.0
[17] glue_1.6.0 DBI_1.1.2 sp_1.4-6 RNetCDF_2.5-2
[21] wk_0.6.0 foreach_1.5.1 lifecycle_1.0.1 rvest_1.0.2
[25] raster_3.5-12 htmlwidgets_1.5.4 codetools_0.2-18 fastmap_1.1.0
[29] doParallel_1.0.16 httpuv_1.6.5 crosstalk_1.2.0 parallel_4.1.0
[33] class_7.3-19 fansi_0.5.0 Rcpp_1.0.8 xtable_1.8-4
[37] KernSmooth_2.23-20 promises_1.2.0.1 classInt_0.4-3 leaflet_2.0.4.1
[41] jsonlite_1.7.3 mime_0.12 digest_0.6.29 dplyr_1.0.7
[45] shiny_1.7.1 grid_4.1.0 tools_4.1.0 magrittr_2.0.1
[49] proxy_0.4-26 tibble_3.1.6 crayon_1.4.2 pkgconfig_2.0.3
[53] ellipsis_0.3.2 xml2_1.3.3 httr_1.4.2 iterators_1.0.13
[57] R6_2.5.1 units_0.7-2 compiler_4.1.0