harphub / harpIO

IO functions for HARP
https://harphub.github.io/harpIO/
Other
6 stars 16 forks source link

read_grid function problem #17

Closed meteorolog90 closed 4 years ago

meteorolog90 commented 4 years ago

Hi Andrew. My name is Martin and i working in Slovak Hydrometeorological Institute. I trying to open grib files (harp example data), with read grib function. This is error what i get:

library(harpIO) library(harpData)

data <- read_grid(system.file("grib/HARMUK20171015T12Z+003.grib", package ="harpData"),parameter = "T2m")

Error: Input must be a vector, not a data.frame/GRIBlist object. Run rlang::last_error() to see where the error occurred.

rlang::last_error() <error/vctrs_error_scalar_type> Input must be a vector, not a data.frame/GRIBlist object. Backtrace:

  1. harpIO::read_grid(...)
  2. vctrs:::stop_scalar_type(...)
  3. vctrs:::stop_vctrs(msg, "vctrs_error_scalar_type", actual = x) Run rlang::last_trace() to see the full context.

rlang::last_trace() <error/vctrs_error_scalar_type> Input must be a vector, not a data.frame/GRIBlist object. Backtrace: █

  1. ├─harpIO::read_grid(...)
  2. │ └─harpIO:::read_func(...)
  3. │ └─purrr::map2_dfr(...)
  4. │ └─purrr::map2(.x, .y, .f, ...)
  5. │ └─harpIO:::.f(.x[[1L]], .y[[1L]], ...)
  6. │ ├─dplyr::filter(grib_info, .data$shortName == param_info$short_name)
  7. │ └─dplyr:::filter.data.frame(grib_info, .data$shortName == param_info$short_name)
  8. │ ├─dplyr::dplyr_row_slice(.data, loc, preserve = .preserve)
  9. │ └─dplyr:::dplyr_row_slice.data.frame(.data, loc, preserve = .preserve)
  10. │ ├─dplyr::dplyr_reconstruct(vec_slice(data, i), data)
  11. │ │ └─dplyr:::dplyr_new_data_frame(data)
  12. │ │ ├─row.names %||% .row_names_info(x, type = 0L)
  13. │ │ └─base::.row_names_info(x, type = 0L)
  14. │ └─vctrs::vec_slice(data, i)
  15. └─vctrs:::stop_scalar_type(...)
  16. └─vctrs:::stop_vctrs(msg, "vctrs_error_scalar_type", actual = x)

This problem is manifested after we update harp in to new version. Before update, this function, and other stuff worked perfectly.

andrew-MET commented 4 years ago

Hi Martin,

This appears to be related to a major update in the dplyr package, which may also cause problems elsewhere in harp. Roll back your version of dplyr to 0.8.5 for now, until I come up with solution. You can do this with:

remotes::install_version("dplyr", "0.8.5")

You may need to restart R for the change to take effect.

meteorolog90 commented 4 years ago

Hi Martin,

This appears to be related to a major update in the dplyr package, which may also cause problems elsewhere in harp. Roll back your version of dplyr to 0.8.5 for now, until I come up with solution. You can do this with:

remotes::install_version("dplyr", "0.8.5")

You may need to restart R for the change to take effect.

Thanks for the quick reply. I did as you told me and now it works.

Best regards

andrew-MET commented 4 years ago

Fixed: https://github.com/andrew-MET/harpIO/commit/b4dd169df553097748f7e46156b55590129c6efb

I couldn't see anywhere else in the code where this would be a problem fortunately.