rich-iannone / splitr

Use the HYSPLIT model from inside R and do more with it
Other
141 stars 60 forks source link

Can't run Trajectory at the end of the month #44

Closed ivanhigueram closed 4 years ago

ivanhigueram commented 4 years ago

Hello!

I'm trying to estimate daily trajectories from different points. I'm just testing my code (I'm wrapping the trajectory_model example in the documentation within a function to map it to different parameters).

But, when I try to estimate any trajectory at the end of any month (with a duration > 24 hours) I get an error:

trajectory_model <-
  create_trajectory_model() %>%
  add_trajectory_params(
    lat = c(38.172375),
    lon = c(-82.616488),
    height = 10,
    duration = 72,
    days = seq(
        lubridate::ymd("2000-01-31"),
        lubridate::ymd("2000-02-02"),
        by = "1 day"
    ),
    met_dir = here::here("met"),
    exec_dir = here::here("Hysplit4/exec/"),
    daily_hours = seq(1, 23, 1),
    direction = "forward",
    clean_up = FALSE,
    met_type = "reanalysis"
  ) %>%
  run_model()

Yields:

Error in .f(.x[[i]], ...) : object 'hour_along' not found

Which is just showing that HYSPLIT created an empty trajectory file when the hysplit_trajectory function is reading the file. If I change the days argument to: days = seq( lubridate::ymd("2000-01-27"), lubridate::ymd("2000-02-02"), by = "1 day"), the code works as expected. Is this due to a lack of meteorological data or what else I am ignoring here?

I think I can solve the issue by changing the date, but that seems more like a hack rather than a good way of solving the problem.

rich-iannone commented 4 years ago

Fixed by #47