ropensci / GSODR

API Client for Global Surface Summary of the Day (GSOD) Weather Data Client in R
https://docs.ropensci.org/GSODR
Other
90 stars 15 forks source link

"Error in read_connection_(con):" when writing to csv #30

Closed amshew closed 7 years ago

amshew commented 7 years ago

I can retrieve the station data as a data frame when I first open my script, but only once. After that, I get this error for any further efforts to retrieve station data, whether as a data frame or as a csv:

image

Is this an issue with the server?

adamhsparks commented 7 years ago

That's a local issue, but I'm unable to duplicate it this morning when I use the same command, years and station that you show here.

Can you share your script so I can have a look at it?

amshew commented 7 years ago

gsodr_example.txt

Thanks for responding. My code is attached.

I tried a number of things this morning. If I only run get_GSOD() for a station on a fresh R session, it works every time. However, if I try to run get_GSOD() for a country, it finishes downloading and then throws this error: " Error in rawToChar(block[seq_len(ns)]) : embedded nul in string: '\0./008403-99999-2014.op.gz' "

Then, if I try to run getGSOD() for another station/or the same one, it throws the original error in the issue: " Error in readconnection(con) : Evaluation error: error reading from the connection. "

I also tried running the country with "GPKG = T" instead of "CSV = T" but the same error is produced.

I'm running Windows 7 on a Dell Latitude E7450 with R v3.4.1 and RStudio v1.0.153.

Let me know if I can help with anything else. Thanks.

On Thu, Aug 17, 2017 at 3:36 PM, Adam H. Sparks notifications@github.com wrote:

That's a local issue, but I'm unable to duplicate it this morning when I use the same command, years and station that you show here.

Can you share your script so I can have a look at it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ropensci/GSODR/issues/30#issuecomment-323186957, or mute the thread https://github.com/notifications/unsubscribe-auth/ARSfwnrbm71NeOhOVMI7X1XEM_i8yOupks5sZKRJgaJpZM4O6TGI .

-- aaron m. shew NSF Graduate Research Fellow Environmental Dynamics http://endy.uark.edu University of Arkansas www.aaronmshew.com

"The right question is intellectually superior to finding the right answer." -E.O. Wilson "Measure what is measurable, and make measurable what is not so." -Galilei Galileo

adamhsparks commented 7 years ago

Thanks Aaron.

I've fixed it in this commit: https://github.com/ropensci/GSODR/commit/461fc623af81aca746824c65b2d7381bcd6d5d8a

A new updated version will soon be on CRAN. In the meantime, you can install v1.0.5 from GitHub following the example in the README file of the repository.

amshew commented 7 years ago

Excellent. Thanks.