mikejohnson51 / climateR

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

getDaymet error: "Error in var[[i]] * scale_factor : non-numeric argument to binary operator" #61

Closed rsmiller74 closed 1 year ago

rsmiller74 commented 1 year ago

Is this package still being maintained?

When attempting to compile daymet data the "Error in var[[i]] * scale_factor : non-numeric argument to binary operator" is returned.

library(sf) library(climateR) packageVersion("climateR")

library(AOI) packageVersion("AOI")

AOI = aoi_get(state = "IL")

p<-getDaymet(AOI=AOI, param="prcp", startDate="2020-01-01", endDate="2020-12-31")

library(sf) library(climateR) packageVersion("climateR")
[1] ‘0.1.0’

library(AOI) packageVersion("AOI")
[1] ‘0.2.1’

AOI = aoi_get(state = "IL")

p<-getDaymet(AOI=AOI, param="prcp", startDate="2020-01-01", endDate="2020-12-31") Spherical geometry (s2) switched off Spherical geometry (s2) switched on Error in var[[i]] * scale_factor : non-numeric argument to binary operator

ERGINCAGATAYCANKAYA commented 1 year ago

I have the same problem. Could you please help us?

rsmiller74 commented 1 year ago

This is still an issue as of 26 Jan 2023. See example below. The error appears to be thrown from 'fast.download' at the end of the getDaymet function.

aoi.object <- aoi_get(state="VA", county="Fairfax")

p<-getDaymet(AOI=aoi.object, param="tmax", startDate="2018-01-01", endDate="2018-01-05") Spherical geometry (s2) switched off Spherical geometry (s2) switched on Error in var[[i]] * scale_factor : non-numeric argument to binary operator

mikejohnson51 commented 1 year ago

Hi @rsmiller74 @ERGINCAGATAYCANKAYA ,

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, all calls to Daymet (and to a larger extent all calls to var[[i]] * scale_factor) have been resolved:

library(climateR)
#> Using GDAL version 3.6.0 which was retracted because it cannot write large GPKG files
library(AOI)
library(terra)
#> terra 1.7.8

aoi.object <- aoi_get(state="VA", county="Fairfax")

p<-getDaymet(AOI=aoi.object, varname="tmax", startDate="2018-01-01", endDate="2018-01-05")

plot(p$tmax_total)

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. I am also in a place where I can maintain this software as part of my job and not on the side which will allow much more rapid development and support.

Thanks again for your patience,

Mike