ropensci / rnoaa

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

gefs function returning inconsistent data #230

Closed lcsma closed 7 years ago

lcsma commented 7 years ago

using gefs function seems to be returning me inconsistent data. Can you please check? As an example:

data <- gefs("Temperature_height_above_ground_ens", 20, -155, date="20170807", forecast_time="0000")

data$data is a data frame with the returning results, I am assuming ens column is the index of model ensemble (model used), time8 is the forward time for the forecast.

if i look at all forecasts for time8 == 66, subset(data$data, time8==66), there are 21 rows returned, but with ens columns containing duplicated values which does not make sense.

If i request data for one specific ensemble using the ens_idx parameter, (ens_idx=1 for example), I get data with the same format, but they are different from the previous dataset for the same time8 values.

It seems like the time8 column is not meaningful, and the data are returned in blocks of each of the 21 model forecasts from the ensemble, but then how do I deduce what forward period the forecast is for?

Thanks!

sckott commented 7 years ago

thanks for the issue! please paste in your devtools::session_info() or sessionInfo()

lcsma commented 7 years ago

Here are the session_info:

devtools::session_info() Session info ------------------------------------------------------------------ setting value version R version 3.3.3 (2017-03-06) system x86_64, linux-gnu ui X11 language (EN) collate en_US.UTF-8 tz America/Toronto date 2017-08-13

Packages ---------------------------------------------------------------------- package version date source assertthat 0.2.0 2017-04-11 CRAN (R 3.3.3) base 3.3.3 2017-03-11 local bindr 0.1 2016-11-13 CRAN (R 3.3.3) bindrcpp 0.2 2017-06-17 CRAN (R 3.3.3) colorspace 1.3-2 2016-12-14 CRAN (R 3.1.1) datasets 3.3.3 2017-03-11 local devtools 1.13.3 2017-08-02 CRAN (R 3.3.3) digest 0.6.12 2017-01-27 CRAN (R 3.1.1) dplyr 0.7.2 2017-07-20 CRAN (R 3.3.3) ggplot2 2.2.1 2016-12-30 CRAN (R 3.3.3) glue 1.1.1 2017-06-21 CRAN (R 3.3.3) graphics 3.3.3 2017-03-11 local grDevices 3.3.3 2017-03-11 local grid 3.3.3 2017-03-11 local gridExtra 2.2.1 2016-02-29 CRAN (R 3.1.1) gtable 0.2.0 2016-02-26 CRAN (R 3.1.1) hoardr 0.2.0 2017-05-10 CRAN (R 3.1.1) httr 1.2.1 2016-07-03 CRAN (R 3.3.3) jsonlite 1.5 2017-06-01 CRAN (R 3.1.1) lazyeval 0.2.0 2016-06-12 CRAN (R 3.1.1) lubridate 1.6.0 2016-09-13 CRAN (R 3.1.1) magrittr 1.5 2014-11-22 CRAN (R 3.1.1) memoise 1.1.0 2017-04-21 CRAN (R 3.3.3) methods 3.3.3 2017-03-11 local munsell 0.4.3 2016-02-13 CRAN (R 3.1.1) pkgconfig 2.0.1 2017-03-21 CRAN (R 3.3.3) plyr 1.8.4 2016-06-08 CRAN (R 3.1.1) R6 2.2.2 2017-06-17 CRAN (R 3.1.1) rappdirs 0.3.1 2016-03-28 CRAN (R 3.1.1) Rcpp 0.12.12 2017-07-15 CRAN (R 3.3.3) rlang 0.1.1 2017-05-18 CRAN (R 3.3.3) rnoaa 0.7.0 2017-05-06 CRAN (R 3.3.3) rstudioapi 0.6 2016-06-27 CRAN (R 3.3.3) scales 0.4.1 2016-11-09 CRAN (R 3.1.1) stats 3.3.3 2017-03-11 local stringi 1.1.5 2017-04-07 CRAN (R 3.1.1) stringr 1.2.0 2017-02-18 CRAN (R 3.1.1) tibble 1.3.3 2017-05-28 CRAN (R 3.3.3) tidyr 0.6.3 2017-05-15 CRAN (R 3.3.3) tools 3.3.3 2017-03-11 local utils * 3.3.3 2017-03-11 local withr 2.0.0 2017-07-28 CRAN (R 3.3.3) XML 3.98-1.9 2017-06-19 CRAN (R 3.3.3) xml2 1.1.1 2017-01-24 CRAN (R 3.3.3)

lcsma commented 7 years ago

Have you had a chance to look at this issue? Just wondering if I am misunderstanding something or it is a problem with the library.

Thanks!

sckott commented 7 years ago

having a look today

sckott commented 7 years ago

hmm, i'm not sure -

@potterzot any insight on this?

lcsma commented 7 years ago

Thanks for looking into this. I am really hoping to make use of those data.

potterzot commented 7 years ago

@lcsma Thank you for finding this. I'll take a look at it this weekend and see what's going on.

potterzot commented 7 years ago

Submitted a PR to fix this issue. The time index was not correctly allocated in the returned data.frame.

The name of the time variable seems to vary, and the returned times are in hours since the forecast date and time, so that if the forecast time and time are "20170822" and "0000" then a time of 72 means 2017-08-25 at 0000.

sckott commented 7 years ago

thanks @potterzot

sckott commented 7 years ago

@lcsma can you reinstall and try again and let us know if works. devtools::install_github("ropensci/rnoaa")

lcsma commented 7 years ago

Sure. Just came back from a trip. Will try it tomorrow.

Thanks

lcsma commented 7 years ago

It looks good now. Thanks!

sckott commented 7 years ago

great, glad it works