ropensci / rnoaa

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

ADCP2 data download #303

Closed kjschaudt closed 5 years ago

kjschaudt commented 5 years ago

Trying to use Rnoaa to obtain the ADCP2 data at the NDBC using the buoy vignette. For any adcp2 dataset (year and buoy combination), I get the following error.

buoy(dataset='adcp2',buoyid=42881,year=2010) Using a2010.nc Error in data.frame(time, lat, lon, stringsAsFactors = FALSE) : arguments imply differing number of rows: 15755, 0

Works great for wind. Any ideas?

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

sckott commented 5 years ago

thanks for your question. please share your R session info as requested

kjschaudt commented 5 years ago

Hopefully, this is what you are requesting. Any time I reference an ADCP2 dataset, I get the data frame error listed in the output below. No problem with CWIND as the example shows.

Input script is as follows.


library('rnoaa')
buoy_stations(refresh=TRUE)
A2_res <- buoys(dataset = "adcp2")
head(A2_res)
tail(A2_res)
browseURL(A2_res[6,2])
buoy(dataset='adcp2', buoyid=42363)
buoy(dataset = 'cwind', buoyid = 45005, year = 2008, datatype = "c
```")
Output below.
> library('rnoaa')
> buoy_stations(refresh=TRUE)
# A tibble: 1,834 x 12
   station    lat    lon viewport DC.title DC.description description DC.subject
   <chr>    <dbl>  <dbl> <chr>    <chr>    <chr>          <chr>       <chr>     
 1 21413    30.5   152.  width=d… NDBC St… National Data… National D… weather, …
 2 21414    49.0   178.  width=d… NDBC St… National Data… National D… weather, …
 3 21415    50.2   172.  width=d… NDBC St… National Data… National D… weather, …
 4 21416    48.1   163.  width=d… NDBC St… National Data… National D… weather, …
 5 21417    43.2   157.  width=d… NDBC St… National Data… National D… weather, …
 6 21418    38.7   149.  width=d… NDBC St… National Data… National D… weather, …
 7 21419    44.4   156.  width=d… NDBC St… National Data… National D… weather, …
 8 32301    -9.9  -105.  width=d… NDBC St… National Data… National D… weather, …
 9 32302   -18     -85.1 width=d… NDBC St… National Data… National D… weather, …
10 32411     4.95  -90.9 width=d… NDBC St… National Data… National D… weather, …
# … with 1,824 more rows, and 4 more variables: DC.creator <chr>, DC.language <chr>,
#   DC.format <chr>, DC.date.created <chr>
> 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     
sckott commented 5 years ago

I meant the output of sessionInfo() - requested when you open a new issue https://github.com/ropensci/rnoaa/issues/new

kjschaudt commented 5 years ago

Hopefully, I have it correct this time.

On 3/29/19 3:24 PM, Scott Chamberlain wrote:

I meant the output of |sessionInfo()| - requested when you open a new issue https://github.com/ropensci/rnoaa/issues/new

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ropensci/rnoaa/issues/303#issuecomment-478138068, or mute the thread https://github.com/notifications/unsubscribe-auth/AUJ1lc9XVuZAlVoOCm58_gu9pMhS0cY5ks5vbnaWgaJpZM4cRnCF.

sckott commented 5 years ago

thanks, i'll close this one in favor of #304