Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when downloading tables for several states #49

Open
flakesw opened this issue Dec 4, 2023 · 3 comments
Open

Error when downloading tables for several states #49

flakesw opened this issue Dec 4, 2023 · 3 comments

Comments

@flakesw
Copy link

flakesw commented Dec 4, 2023

Hi there,

I recently updated to the dev version so that I could download some new tables with the change to the URLs on the datamart, but I now get this error if I try to download data for more than one state. Here's an example:

> getFIA(states =  c("RI", "CT"),
+        dir = 'D:/Data/fia/rFIA_downloads/',
+        common = TRUE,
+        load = FALSE)
Saving to D:/Data/fia/rFIA_downloads/. NOTE: modifying FIA tables in Excel may corrupt csv files.
Error in if (states == "REF") { : the condition has length > 1

I think the error happens in line 441 here: b80e180

I think it could be fixed if you were to check if the length of states was >1, and then check if any of those states are "REF", and throw an error in that case.

It also looks like the "ENTIRE" option is broken, perhaps due to the datamart update. I get this error if I try it:

trying URL 'https://apps.fs.usda.gov/fia/datamart/CSV/ENTIRE_CSV.zip'
Error in download.file(url, temp, timeout = 3600) :
cannot open URL 'https://apps.fs.usda.gov/fia/datamart/CSV/ENTIRE_CSV.zip'
In addition: Warning messages:
1: In download.file(url, temp, timeout = 3600) :
downloaded length 0 != reported length 1245
2: In download.file(url, temp, timeout = 3600) :
cannot open URL 'https://apps.fs.usda.gov/fia/datamart/CSV/ENTIRE_CSV.zip': HTTP status was '404 Not Found'

Thanks for putting together such a useful package! Let me know if I can help troubleshoot.

@flakesw
Copy link
Author

flakesw commented Dec 4, 2023

It looks like Jacob Fraser already solved it in this PR: #46
Jacob's fork is working fine for me.

@mikoontz-vp
Copy link

Flagging here that @jacobf37's fork also worked for me, but I had the same issue that @flakesw pointed out

@jacobf37
Copy link

I added an argument to the getFIA function to set a value for the timeout option with a default of 3600.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants