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

getEDDI broken? #37

Closed awlostowski-noaa closed 3 years ago

awlostowski-noaa commented 3 years ago

The getEDDI function may be suffering from a broken our outdated ftp link. I get the following error:

Error in curl::curl_fetch_disk(url, x$path, handle = handle) : 
  Given file does not exist
Timing stopped at: 0.99 0.15 1.74

NOAA may have recently changed their ftp address, according to this

mikejohnson51 commented 3 years ago

Hi @awlostowski-noaa,

Thanks for reaching out! Would you mind sharing an example of what you are doing? Right now everything is working for me locally (at least with the basic test case):

library(climateR)
AOI = AOI::aoi_get(state = "CA")
r = getEDDI(AOI, startDate = "2018-01-01")
raster::plot(r$EDDI_ETrs_03wk_20180101)

Created on 2021-05-21 by the reprex package (v2.0.0)

mikejohnson51 commented 3 years ago

@awlostowski-noaa so this was a really bizarre issue. It turns out the behavior of sprintf("%02d", ...) works differently on Mac then it does on Linux/Windows. The result is that on MacOS, urls were formatted correctly while on other OSs they have an unexpected space. I believe this commit 728ad2c8b00a5213f6a5e65e408ce71e90940906 solves this issue

Thanks to @program-- for testing through this with me,

Mike