ropensci / rnoaa

R interface to many NOAA data APIs
https://docs.ropensci.org/rnoaa
Other
330 stars 84 forks source link

Cannot Retrieve Buoy Data - Error in is.url(url) #273

Closed Orionsic closed 5 years ago

Orionsic commented 6 years ago

Hello, I am trying to retrieve Buoy data as instructed in this tutorial, however I am getting an error. Below is my script for retrieving data.

First, retrieve NOAA key from .Renviron file

any(grepl("^\\.Renviron", list.files("~", all.files = TRUE))) Sys.getenv("noaakey") options("noaakey" = Sys.getenv("noaakey"))

Success.

Second, find out what buoy data is available

head(buoys(dataset = "cwind")) id url 1 41001 http://dods.ndbc.noaa.gov/thredds/catalog/data/cwind/41001/catalog.html 2 41002 http://dods.ndbc.noaa.gov/thredds/catalog/data/cwind/41002/catalog.html 3 41004 http://dods.ndbc.noaa.gov/thredds/catalog/data/cwind/41004/catalog.html 4 41006 http://dods.ndbc.noaa.gov/thredds/catalog/data/cwind/41006/catalog.html 5 41008 http://dods.ndbc.noaa.gov/thredds/catalog/data/cwind/41008/catalog.html 6 41009 http://dods.ndbc.noaa.gov/thredds/catalog/data/cwind/41009/catalog.html

Third, try to retrieve buoy id '41001' data for 2016.

buoy(dataset = 'cwind', buoyid = 41001, year = 2016, datatype = "cc")

Error in is.url(url) : length(url) == 1 is not TRUE

Any help would be appreciated. Thank you.

sckott commented 6 years ago

please share your sessionInfo()

Orionsic commented 6 years ago

please share your sessionInfo()

> session_info()
Session info --------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 system   x86_64, mingw32             
 ui       RStudio (1.1.453)           
 language (EN)                        
 collate  English_United States.1252  
 tz       America/Chicago             
 date     2018-10-04                  

Packages ------------------------------------------------------------------------------------------------------------------------------------------
 package     * version   date       source                            
 assertthat    0.2.0     2017-04-11 CRAN (R 3.5.1)                    
 base        * 3.5.1     2018-07-02 local                             
 bindr         0.1.1     2018-03-13 CRAN (R 3.5.1)                    
 bindrcpp      0.2.2     2018-03-29 CRAN (R 3.5.1)                    
 cli           1.0.0     2017-11-05 CRAN (R 3.5.1)                    
 colorspace    1.3-2     2016-12-14 CRAN (R 3.5.1)                    
 compiler      3.5.1     2018-07-02 local                             
 crayon        1.3.4     2017-09-16 CRAN (R 3.5.1)                    
 curl          3.2       2018-03-28 CRAN (R 3.5.1)                    
 datasets    * 3.5.1     2018-07-02 local                             
 devtools    * 1.13.6    2018-06-27 CRAN (R 3.5.1)                    
 digest        0.6.17    2018-09-12 CRAN (R 3.5.1)                    
 dplyr         0.7.6     2018-06-29 CRAN (R 3.5.1)                    
 ggplot2       3.0.0     2018-07-03 CRAN (R 3.5.1)                    
 glue          1.2.0     2017-10-29 CRAN (R 3.5.1)                    
 graphics    * 3.5.1     2018-07-02 local                             
 grDevices   * 3.5.1     2018-07-02 local                             
 grid          3.5.1     2018-07-02 local                             
 gridExtra     2.3       2017-09-09 CRAN (R 3.5.1)                    
 gtable        0.2.0     2016-02-26 CRAN (R 3.5.1)                    
 hoardr        0.2.0     2017-05-10 CRAN (R 3.5.1)                    
 httr          1.3.1     2017-08-20 CRAN (R 3.5.1)                    
 jsonlite      1.5       2017-06-01 CRAN (R 3.5.1)                    
 lazyeval      0.2.1     2017-10-29 CRAN (R 3.5.1)                    
 lubridate     1.7.4     2018-04-11 CRAN (R 3.5.1)                    
 magrittr      1.5       2014-11-22 CRAN (R 3.5.1)                    
 memoise       1.1.0     2017-04-21 CRAN (R 3.5.1)                    
 methods     * 3.5.1     2018-07-02 local                             
 munsell       0.5.0     2018-06-12 CRAN (R 3.5.1)                    
 ncdf4       * 1.16      2017-04-01 CRAN (R 3.5.0)                    
 pillar        1.2.3     2018-05-25 CRAN (R 3.5.1)                    
 pkgconfig     2.0.1     2017-03-21 CRAN (R 3.5.1)                    
 plyr        * 1.8.4     2016-06-08 CRAN (R 3.5.1)                    
 purrr         0.2.5     2018-05-29 CRAN (R 3.5.1)                    
 R6            2.2.2     2017-06-17 CRAN (R 3.5.1)                    
 rappdirs      0.3.1     2016-03-28 CRAN (R 3.5.1)                    
 Rcpp          0.12.17   2018-05-18 CRAN (R 3.5.1)                    
 rlang         0.2.1     2018-05-30 CRAN (R 3.5.1)                    
 rnoaa       * 0.7.0     2017-05-06 CRAN (R 3.5.1)                    
 rstudioapi    0.7       2017-09-07 CRAN (R 3.5.1)                    
 scales        1.0.0     2018-08-09 CRAN (R 3.5.1)                    
 stats       * 3.5.1     2018-07-02 local                             
 stringi       1.1.7     2018-03-12 CRAN (R 3.5.0)                    
 stringr       1.3.1     2018-05-10 CRAN (R 3.5.1)                    
 tibble        1.4.2     2018-01-22 CRAN (R 3.5.1)                    
 tidyr         0.8.1     2018-05-18 CRAN (R 3.5.1)                    
 tidyselect    0.2.4     2018-02-26 CRAN (R 3.5.1)                    
 tools         3.5.1     2018-07-02 local                             
 utf8          1.1.4     2018-05-24 CRAN (R 3.5.1)                    
 utils       * 3.5.1     2018-07-02 local                             
 weatherData * 0.6.0     2018-10-03 Github (Ram-N/weatherData@4326bdc)
 withr         2.1.2     2018-03-15 CRAN (R 3.5.1)                    
 XML           3.98-1.16 2018-08-19 CRAN (R 3.5.1)                    
 xml2          1.2.0     2018-01-24 CRAN (R 3.5.1)                    
 yaml          2.2.0     2018-07-25 CRAN (R 3.5.1)                    
> 
sckott commented 6 years ago

thanks @OrionDarley

Orionsic commented 6 years ago

thanks @OrionDarley

  • you shouldn't need a key to use buoy functions
  • can you upgrade to lastest development version remotes::install_github("ropensci/rnoaa") - it should be fixed in the dev version. let me know

Hi Sckott, thanks for the update. I versioned the one from the github repo as mentioned above. I'm no longer getting the error:

Error in is.url(url) : length(url) == 1 is not TRUE

But am getting this error instead:

> buoy(dataset = 'cwind', buoyid = 41001, year = 1990, datatype = "cc")
Error in buoy(dataset = "cwind", buoyid = 41001, year = 1990, datatype = "cc") : 
  No data files found, try a different search

According to Buoy 41001's site on NOAA, there should be "cwind" data available for 1990. I've tried 5-6 various commands for data that I know the NOAA warehouses, but am getting the same "No data files found" error. I haven't eliminated the possibility that the R API doesn't reference the same EDW tables the website has downloadable-links for.

Any help would be appreciated! Thanks.

sckott commented 6 years ago

if you look at the link you get from running buoys(dataset = 'cwind') for id=41001 you get https://dods.ndbc.noaa.gov/thredds/catalog/data/cwind/41001/catalog.html - and they have 41001c1990.nc, etc. with only one c, not two - so that's why the buoy() query with two c's wasn't working

sckott commented 5 years ago

AFAICT this is sorted, fails well I think