rich-iannone / splitr

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

Trajectory duration cut short at end of week - gdas1 #67

Open jb-li opened 3 years ago

jb-li commented 3 years ago

Hi, trajectories get cut short when they finish around the end of the week.

I ran:

library(splitr)
x <- hysplit_trajectory(
  lat = 37.05, 
  lon = -119.25, 
  height = 500,
  duration = 72,
  days = "2020-01-11",
  daily_hours = 23,
  met_type = "gdas1", 
  met_dir = "/path/to/gdas1/",
  exec_dir = "/path/to/exec/",
  clean_up = FALSE
)

This returned: max(x["hour_along"]) = 70 So the trajectory is missing the 71st and 72nd hour (2020-01-14 22:00 and 23:00).

In fact, the trajectory remains cut short at 70 hours when changing duration from 71 to 95 (missing at most from 2020-01-14 22:00 to 2020-01-15 22:00, i.e. the last two hours of the starting time's week + all but the last hour of the first day of the subsequent week). Then at duration = 96, the trajectory has max(x["hour_along"]) = 96, working as normal.

I tried running this 72-hour duration trajectory in the HYSPLIT GUI, and the T file had 72 hours.

Moving start time earlier by one hour: daily_hours = 22 Returned: max(x["hour_along"]) = 71 So missing the 72nd hour (2020-01-14 22:00).

Moving start time earlier by two hours and increasing duration by two hours: duration = 74, daily_hours = 21 Returned: max(x["hour_along"]) = 72 So missing the 73rd and 74th hours (still 2020-01-14 22:00 and 23:00).

Setting start time one week earlier: days = "2020-01-04" Returned: max(x["hour_along"]) = 70 So missing the 71st and 72nd hours (2020-01-07 22:00 and 23:00).

Setting to a different start date and duration that also ends around the end of the week: days = "2011-10-20", duration = 24 Returned: max(x["hour_along"]) = 22 So missing the 23rd and 24th hours (2011-10-21 22:00 and 23:00).

Changing the lat, lon, and height did not make a difference. The issue occurred for different starting locations.

It seems to have something to do with the starting date and hour, the duration, and the weekly file structure of gdas1.

af-font commented 1 year ago

Hello, I'm experiencing the same problem here. I can't launch the backtrajectory at the end of a gdas1 file and I was wondering why.

hysplit_trajectory(lat = 44.5694444, lon = 5.2789722, height = 500, duration = 72, days = "2014-03-14", daily_hours = c(22, 23), direction = "backward", config = NULL, ascdata = NULL, met_type = "gdas1", extended_met = TRUE, met_dir = "C:/hysplit/working", exec_dir = "C:/hysplit/exec")

Error in tbl_at_vars(): ! Can't subset columns that don't exist. x Column year doesn't exist. Run rlang::last_error() to see where the error occurred. Warning messages: 1: In shell(sys_cmd) : '(cd "C:/hysplit/exec" && "C:/Users/.../Documents/R/win-library/4.1/splitr/win/hyts_std.exe" > NUL 2>&1)' execution failed with error code 900 2: In shell(sys_cmd) : '(cd "C:/hysplit/exec" && "C:/Users/.../Documents/R/win-library/4.1/splitr/win/hyts_std.exe" > NUL 2>&1)' execution failed with error code 900

Anyone found a way around this?