Datetime issues with splitr package

Hello everyone,

I want to premise that they are new to r. I am writing to ask for help on using rich-iannone's splitr package (github). The package link is this: GitHub - rich-iannone/splitr: Use the HYSPLIT model from inside R and do more with it

I have installed the package:

devtools::install_github("rich-iannone/splitr")

I used the recommended code in your github page:

library(splitr)
library(here)

trajectory <-
hysplit_trajectory(
lat = 42.83752,
lon = -80.30364,
height = 50,
duration = 24,
days = "2012-03-12",
daily_hours = c(0, 6, 12, 18),
direction = "forward",
met_type = "gdas1",
extended_met = TRUE,
met_dir = here::here("met"),
exec_dir = here::here("out")
)

and I encountered two errors (one I managed to solve), and I have a question about the code:

  1. Error in Sys.setlocale("LC_Time", locale)
    ---> #and i SOLVE it thanks to MRPHarris (link: hysplit_trajectory() fails due Error in Sys.setlocale("LC_Time", locale) [SOLVED: SEE EDIT] · Issue #57 · rich-iannone/splitr · GitHub)

  2. warning messages: 1: problem with mutate() input traj_dt . i all formats failed to parse. no formats found.
    ---> #I can't solve this problem. You can help me? i tried everything but i can't get over this problem. Thank you. I noticed that the trajectory is created but without the date and time information.

  3. Also, in --> exec_dir ... should I enter the exec folder contained in the hysplit installation file?
    -->(in my case: "C: \ hysplit4 \ exec")???

thanks for your valuable contribution
S

Using lubridate::ymd to first parse the date strings may fix this.

suppressPackageStartupMessages({
  library(lubridate)
})

a_date <- "2020-04-30"
str(ymd(a_date))
#>  Date[1:1], format: "2020-04-30"

Dear @technocrat ,
thank you for your contribution. However, I was unable to fix the problem. I tried the exact same code using a mac. Here I can do everything !! i think it is a windows date formatting problem.

With windows: the code stops because it cannot download data from the ftp / gdas1 server (i dont know why !!!). With "reanalysis" server i encounter this error:

Warning messages:
1: Problem with mutate () input traj_dt.
i All formats failed to parse. No formats found.
i Input traj_dt islubridate :: ymd_h (date_h_str).

Anyway, thank you for your help and I consider this post closed as I solved it using another operating system. Thank you so much and I hope I can contribute one day!

bye