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

2.7.8 readNWISsite returns numeric groundwater site_no, rather than character #575

Closed jmusgs closed 3 years ago

jmusgs commented 3 years ago

Just updated to 2.7.8 Noticed the command readNWISsite returns a numeric id (see below, USGS 4.142401e+14) for the site_no column, rather than character. I have a number of scripts that use this command, and join on that field, so noticed when they returned errors.

library(dataRetrieval) test <- readNWISsite("414240072033201")

note that you also get this message now, which is new

Parsed with column specification: cols( .default = col_character(), X2 = col_double(), X5 = col_double(), X7 = col_double(), X8 = col_double(), X10 = col_double(), X17 = col_logical(), X22 = col_double(), X25 = col_logical(), X26 = col_logical(), X28 = col_double(), X29 = col_logical(), X30 = col_logical(), X31 = col_logical(), X39 = col_double(), X40 = col_double(), X41 = col_logical(), X42 = col_double() ) See spec(...) for full column specifications. print(test)

print(test) agency_cd site_no station_nm site_tp_cd lat_va long_va dec_lat_va dec_long_va 1 USGS 4.142401e+14 CT-SC 22 SCOTLAND GW 414239.7 720333 41.71102 -72.05917 coord_meth_cd coord_acy_cd coord_datum_cd dec_coord_datum_cd district_cd state_cd county_cd country_cd 1 G 5 NAD83 NAD83 09 09 015 US land_net_ds map_nm map_scale_fc alt_va alt_meth_cd alt_acy_va alt_datum_cd huc_cd basin_cd 1 NA SCOTLAND NC 24000 327.13 X 0.16 NAVD88 01100002 NA topo_cd instruments_cd construction_dt inventory_dt drain_area_va contrib_drain_area_va 1 TRUE NNNNYNNNNNNNNNNNNNNNNNNNNNNNNN 19841002 NA NA NA tz_cd local_time_fg reliability_cd gw_file_cd nat_aqfr_cd aqfr_cd aqfr_type_cd well_depth_va 1 EST Y C YYNYNYNN N100GLCIAL 112DFSF U 26 hole_depth_va depth_src_cd project_no 1 26 NA 440900200

jmusgs commented 3 years ago

This also appears to be a problem with readNWISgwl command. Site numbers are returned as numeric with scientific notation.

ldecicco-USGS commented 3 years ago

Sorry about that! There's a fairly big update to readr coming out any day now. I pushed the update for that a bit quick. You should be able to get the fix here for now (remotes::install_github("USGS-R/dataRetrieval")). There's already another planned CRAN update late-July that will include this.