krose / entsoeapi

An R Wrapper for the Entso-E API.
Other
17 stars 3 forks source link

Bug in `dt_seq_helper` #27

Open sergejlazuk opened 1 month ago

sergejlazuk commented 1 month ago

There seems to be a bug in dt_seq_helper func:

by <- dplyr::case_when(seq_resolution == "PT1M" ~ "1 min",
                          seq_resolution == "PT15M" ~ "15 mins",
                          seq_resolution == "PT30M" ~ "30 mins",
                          seq_resolution == "PT60M" ~ "1 hour",
                          seq_resolution == "P1D" ~ "1 DSTday",
                          seq_resolution == "P7D" ~ "7 DSTdays",
                          seq_resolution == "P1Y" ~ "1 year",
                          .default = "n/a")

  Error in `dplyr::case_when()`:
  ! Case 8 (`seq_resolution == "PT1M" ~ "1 min"`) must be a two-sided formula, not a character vector.

It works if I remove .default in the end.

sbudai commented 1 month ago

Dear sergejlazuk,

The dt_seq_helper() is a not exported function of the package. Do you use it implicitly by calling exported 'entsoeapi' functions, or you would like to use it independently of the package? If the earlier one is true, would you provide a reproducible example (what exported function you called with which parameters?).

Thanks & Regards Sandor

sergejlazuk commented 1 month ago

Hi Sandor, I was trying to call this function:

gen_wind_solar_forecasts(eic = '10YDE-RWENET---I',tidy_output = TRUE)

It throwed an error; then I was seeking where it comes from and it seems it comes from dt_seq_helper; there it is caused by dplyr::case_when.

I had to remove .default from case_when and now it works.

I use R 4.2.2 and dplyr version 1.2.2.

Regards, Sergej

sbudai commented 1 month ago

At first glance it seems a dplyr issue. (It works like charm with an earlier version of dplyr.) It will take several days to figure out the reason and the resolution. (I do it as a hobby project.) Thank you for your patience!

sergejlazuk commented 1 month ago

No harry! Thx for maintaining this project, Sergej

Am Di., 24. Sept. 2024 um 10:15 Uhr schrieb Sandor Budai < @.***>:

At first glance it seems a dplyr issue. (It works like charm with an earlier version of dplyr.) It will take several days to figure out the reason and the resolution. (I do it as a hobby project.) Thank you for your patience!

— Reply to this email directly, view it on GitHub https://github.com/krose/entsoeapi/issues/27#issuecomment-2370581173, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIAMYVNBQ4UYX5QXJ6L62TTZYENTHAVCNFSM6AAAAABOUM3TP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZQGU4DCMJXGM . You are receiving this because you authored the thread.Message ID: @.***>

sbudai commented 1 month ago

Hey Sergej,

I have not forgotten it, but I am very busy nowadays. So I ask for more patience.

sergejlazuk commented 1 month ago

No problem, I understand.

Sandor Budai @.***> schrieb am Fr. 4. Okt. 2024 um 21:30:

Hey Sergej,

I have not forgotten it, but I am very busy nowadays. So I ask for more patience.

— Reply to this email directly, view it on GitHub https://github.com/krose/entsoeapi/issues/27#issuecomment-2394442821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIAMYVLPXQ6XGZZ6ALQHH7TZZ3UEXAVCNFSM6AAAAABOUM3TP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJUGQ2DEOBSGE . You are receiving this because you authored the thread.Message ID: @.***>

sbudai commented 1 month ago

Hi Sergej,

I was not able to reproduce the error so I was not able to find out the root cause of the problem either. Therefore I added a tryCatch and some debug messages added to dt_seq_helper() function. Please, upgrade to the new version (0.7.1.1) and inform me what kind of related error messages you get, if any.

Thanks, Sandor

sergejlazuk commented 1 month ago

Ok, I will check.

Thx.

Am So., 6. Okt. 2024 um 00:11 Uhr schrieb Sandor Budai < @.***>:

Hi Sergej,

I was not able to reproduce the error so I was not able to find out the root cause of the problem either. Therefore I added a tryCatch and some debug messages added to dt_seq_helper() function. Please, upgrade to the new version (0.7.1.1) and inform me what kind of related error messages you get, if any.

Thanks, Sandor

— Reply to this email directly, view it on GitHub https://github.com/krose/entsoeapi/issues/27#issuecomment-2395211139, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIAMYVJDQ3Q4SGZSE53T6BTZ2BPZJAVCNFSM6AAAAABOUM3TP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJVGIYTCMJTHE . You are receiving this because you authored the thread.Message ID: @.***>

sergejlazuk commented 3 weeks ago

HI Sandor, I have installed latest version (0.7.1.2) and am using dplyr 1.0.10. I still get an error, here with example from README:

load_actual_total(eic = "10Y1001A1001A83F",
+                   period_start = ymd("2020-01-01", tz = "CET"),
+                   period_end = ymd("2020-01-02", tz = "CET")) |>
+   glimpse()
https://web-api.tp.entsoe.eu/api?documentType=A65&processType=A16&outBiddingZone_Domain=10Y1001A1001A83F&periodStart=201912312300&periodEnd=202001012300&securityToken=63a0b5b3-d74a-4093-b8fd-821807415afd ...
downloaded
Case 8 (`seq_resolution == "PT1M" ~ "1 min"`) must be a two-sided formula, not a character vector.
The sequence resolution does not seem to be valid.
Its type is: character
Its structure is:  chr "PT15M"
Error in `purrr::map()`:
ℹ In index: 1.
Caused by error in `purrr::map()`:
ℹ In index: 1.
Caused by error in `dt_seq_helper()`:
! The 'resolution' value of the response is not supported yet.
Please use 'PT1M', 'PT15M', 'PT30M', 'PT60M', 'P1D', 'P7D' or 'P1Y'.
Run `rlang::last_error()` to see where the error occurred.
sbudai commented 3 weeks ago

It is still a mysterious error. (I cannot reproduce.) Now I replaced dplyr::case_when() function with data.table::fcase(). I hope it will be OK on your machine as well. It will be released with the forthcoming 0.7.1.3 version.

sergejlazuk commented 3 weeks ago

Thx, I will test it then,

Mit freundlichen Grüßen/Best Regards S. Lazuk

Sandor Budai @.***> schrieb am Mi. 16. Okt. 2024 um 14:19:

It is still a mysterious error. (I cannot reproduce.) Now I replaced dplyr::case_when() function with data.table::fcase(). I hope it will be OK on your machine as well. It will be released with the forthcoming 0.7.1.3 version.

— Reply to this email directly, view it on GitHub https://github.com/krose/entsoeapi/issues/27#issuecomment-2416666954, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIAMYVLUO6GBM4LCVK44EJDZ3ZKWHAVCNFSM6AAAAABOUM3TP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJWGY3DMOJVGQ . You are receiving this because you authored the thread.Message ID: @.***>

sbudai commented 2 weeks ago

The new version is out. I versioned as 0.7.2.0. It contains the hoped error resolution.