Home > database >  Unable to download data with tidyhydat
Unable to download data with tidyhydat

Time:11-22

I'm using tidyhydat to download historical data on water flow from Environment Canada. I attempted to store the data in my own director (rather than the default) and received an error message. However, I can clearly see the Hydat.sqlite3 file (~1.1 GB in my specified folder).

download_hydat(dl_hydat_here = "./Data_Covariates/Raw/")
✔ Downloading HYDAT to ./Data_Covariates/Raw/
• Your local copy of HYDAT published on 2022-10-24 will be overwritten.
  |==================================================================================================================================| 100%
• Extracting HYDAT
★ HYDAT successfully downloaded
Error in hy_src(hydat_path) : 
  No Hydat.sqlite3 found at C:/Users/[redacted]/AppData/Local/tidyhydat/tidyhydat. Run download_hydat() to download the database.

When I download it to the default directory I got same error message and I don't see the database in this folder:

download_hydat()
✔ Downloading HYDAT to C:\Users\[removed]\AppData\Local/tidyhydat/tidyhydat
• Downloading new version of HYDAT created on 2022-10-24
  |==================================================================================================================================| 100%
• Extracting HYDAT
✖ HYDAT not successfully downloaded
Error in hy_src(hydat_path) : 
  No Hydat.sqlite3 found at C:/Users/[redacted]/AppData/Local/tidyhydat/tidyhydat. Run download_hydat() to download the database.
In addition: Warning message:
In file.rename(list.files(tempdir, pattern = "\\.sqlite3$", full.names = TRUE),  :
  cannot rename file 'C:\Users\[redacted]\AppData\Local\Temp\1\RtmpCEBKiZ/extracted/Hydat.sqlite3' to 'C:\Users\[redacted]\AppData\Local/tidyhydat/tidyhydat/Hydat.sqlite3', reason 'The system cannot find the path specified'

What am I missing?

CodePudding user response:

I ended up needing to download the latest version of the package and from there I could get the download to work properly either using the default directory or by specifying the whole pathway to my personal directory.

remotes::install_github("ropensci/tidyhydat")
library(tidyhydat)

# OPTION 1: default directory
download_hydat()

# OPTION 2: personal directory
download_hydat(dl_hydat_here = "C:/Users/[redacted]/Analysis/Data_Covariates/Raw/")
  • Related