DOI-USGS / dataRetrieval

This R package is designed to obtain USGS or EPA water quality sample data, streamflow data, and metadata directly from web services.
https://doi-usgs.github.io/dataRetrieval/
Other
259 stars 84 forks source link

Parsing Failure for sites with data #606

Closed nrlottig closed 2 years ago

nrlottig commented 2 years ago

Periodically discovering sites that have a signifiant amount of data (verified through web download) that result in an error:

Warning: 3 parsing failures. row col expected actual file 230 -- 1 columns 3 columns '/var/folders/c3/wxq8b_v15gd2cmkfl0qrhylw0000gn/T//RtmpxwVEJ6/file3b323d5561f' 231 -- 1 columns 3 columns '/var/folders/c3/wxq8b_v15gd2cmkfl0qrhylw0000gn/T//RtmpxwVEJ6/file3b323d5561f' 232 -- 1 columns 3 columns '/var/folders/c3/wxq8b_v15gd2cmkfl0qrhylw0000gn/T//RtmpxwVEJ6/file3b323d5561f'

Error in if (nrow(parameterData) != length(parameterCd)) { : argument is of length zero

library(dataRetrieval)
temp <- readWQPdata(siteid="USGS-425027076564401")

Expected behavior Associated data from identified site should download

Screenshots If applicable, add screenshots to help explain your problem.

Session Info

R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.16
ldecicco-USGS commented 2 years ago

Sorry about that! That's from a bug that was caused by the USGS parameter code service changing. We've fixed it on GitHub, but it hasn't made it's way to CRAN yet. The reason you are seeing it in a WQP call is that if the data contains USGS parameter codes, dataRetrieval will use the NWIS pCode service to get some extra metadata in the "variableInfo" attribute.

So, for now if you can install dataRetrieval from GitHub like this:

remotes::install_github("USGS-R/dataRetrieval")

That should fix it. Another option is to set ignore_attributes to TRUE. This will grab the data, but not get any of the metadata attributes (like siteInfo, variableInfo).

temp <- readWQPdata(siteid="USGS-425027076564401", ignore_attributes = TRUE)
nrlottig commented 2 years ago

That worked!