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

ADCP2 data #304

Closed
kjschaudt opened this issue Mar 29, 2019 · 7 comments
Closed

ADCP2 data #304

kjschaudt opened this issue Mar 29, 2019 · 7 comments
Labels
Milestone

Comments

@kjschaudt
Copy link

kjschaudt commented Mar 29, 2019

Session Info
> library('reprex')
> sessionInfo() 
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rnoaa_0.8.4  reprex_0.2.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0       pillar_1.3.1     compiler_3.5.2   plyr_1.8.4       bindr_0.1.1      tools_3.5.2     
 [7] digest_0.6.18    evaluate_0.13    jsonlite_1.6     lubridate_1.7.4  tibble_2.0.1     gtable_0.3.0    
[13] pkgconfig_2.0.2  rlang_0.3.1      rstudioapi_0.10  crul_0.7.0       curl_3.3         yaml_2.2.0      
[19] xfun_0.5         bindrcpp_0.2.2   gridExtra_2.3    knitr_1.22       xml2_1.2.0       dplyr_0.7.8     
[25] stringr_1.4.0    rappdirs_0.3.1   fs_1.2.7         triebeard_0.3.0  grid_3.5.2       tidyselect_0.2.5
[31] glue_1.3.0       httpcode_0.2.0   R6_2.3.0         XML_3.98-1.19    rmarkdown_1.12   hoardr_0.5.2    
[37] tidyr_0.8.3      ggplot2_3.1.0    purrr_0.3.0      magrittr_1.5     htmltools_0.3.6  urltools_1.7.2  
[43] scales_1.0.0     assertthat_0.2.0 colorspace_1.4-1 stringi_1.4.3    lazyeval_0.2.2   munsell_0.5.0   
[49] crayon_1.3.4    
> library('rnoaa')
> A2_res <- buoys(dataset = "adcp2")
> head(A2_res)
     id                                                                      url
1 15319 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/15319/catalog.html
2 41008 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/41008/catalog.html
3 41012 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/41012/catalog.html
4 42361 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/42361/catalog.html
5 42362 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/42362/catalog.html
6 42363 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/42363/catalog.html
> tail(A2_res)
       id                                                                      url
121 42936 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/42936/catalog.html
122 42937 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/42937/catalog.html
123 42940 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/42940/catalog.html
124 46044 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/46044/catalog.html
125 46081 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/46081/catalog.html
126 46089 https://dods.ndbc.noaa.gov/thredds/catalog/data/adcp2/46089/catalog.html
> browseURL(A2_res[6,2])
> buoy(dataset='adcp2', buoyid=42363)
Using a2005.nc
Error in data.frame(time, lat, lon, stringsAsFactors = FALSE) : 
  arguments imply differing number of rows: 13692, 0
> buoy(dataset = 'cwind', buoyid = 45005, year = 2008, datatype = "c")
Dimensions (rows/cols): [29688 X 5] 
2 variables: [wind_dir, wind_spd] 

                   time    lat     lon wind_dir wind_spd
1  2008-04-29T09:00:00Z 41.677 -82.398       10      9.0
2  2008-04-29T09:10:00Z 41.677 -82.398        8      9.0
3  2008-04-29T09:20:00Z 41.677 -82.398        5      9.3
4  2008-04-29T09:30:00Z 41.677 -82.398       13      9.5
5  2008-04-29T09:40:00Z 41.677 -82.398       14      9.4
6  2008-04-29T09:50:00Z 41.677 -82.398       12      9.4
7  2008-04-29T14:00:00Z 41.677 -82.398      341      6.5
8  2008-04-29T14:10:00Z 41.677 -82.398      332      6.8
9  2008-04-29T14:20:00Z 41.677 -82.398      335      6.4
10 2008-04-29T14:30:00Z 41.677 -82.398      332      6.5
..                  ...    ...     ...      ...      ...
@sckott
Copy link
Contributor

sckott commented Mar 30, 2019

edited your post to show the code

@sckott sckott added the bug label Apr 8, 2019
@sckott sckott added this to the v0.9 milestone Apr 8, 2019
sckott added a commit that referenced this issue Apr 8, 2019
@sckott
Copy link
Contributor

sckott commented Apr 8, 2019

@kjschaudt reinstall remotes::install_github("ropensci/rnoaa"), restart your R session, then try again.

now it should not error, and instead of a data.frame in the output data slot of the list you'll get an empty data.frame, but the meta slot will have an ncdf4 object which you can parse yourself. There's just too many possible variables and dimensions for us to have parsing for all of them

let me know if it works

@kjschaudt
Copy link
Author

Thanks. Using the version from GitHub, buoy now grabs the specified files. Thanks for the letting me know about the meta slot. Might have missed the fact that the object was stored there. I have little experience with ncdf4 objects. Are there any R toolkits that you might suggest?

@sckott
Copy link
Contributor

sckott commented Apr 8, 2019

you might try https://github.com/hypertidy/tidync - under review at ropensci right now in fact. i'd been thinking of using it here in this pkg, but its not on CRAN yet

@sckott sckott closed this as completed Apr 8, 2019
@kjschaudt
Copy link
Author

Thanks again. At the moment, it appears tidying does not like "buoy" class objects. Will play with this. If I come up with something simple, I'll pass it along.

@sckott
Copy link
Contributor

sckott commented Apr 8, 2019

try:

library(rnoaa)
library(tidync)
x = buoy(dataset='adcp2', buoyid=42363)
tidync(x$meta$filename)

@kjschaudt
Copy link
Author

That looks more hopeful.

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

No branches or pull requests

2 participants