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 month for gdas file #51

Open dickyaryag6 opened 4 years ago

dickyaryag6 commented 4 years ago

Hello

i successfully run the trajectories from the beginning of the month until 28th of day of the month, but from 29th through the end of the month, it filled the value with 'NA' and display a warning

HYSPLIT_Traj <- function(datafile) {
  trajectory <- NULL
  N <- nrow(datafile)
  for (i in 1:N) {
    print(paste(i,"/",N))
    # print(as.character(as.Date(datafile$date[i], "%m/%d/%Y")))
    print(datafile$date[i])
    trajectory1 <-
      hysplit_trajectory(
        lat = datafile$latitude[i],
        lon = datafile$longitude[i],
        height = 10,
        duration = 72,
        days = datafile$date[i],
        daily_hours = c(0),
        direction = "forward",
        met_type = "gdas1",
        vert_motion = c(0),
        model_height = 16000,
        extended_met = FALSE,
        met_dir = "D:/College/Skripsi/coba")
    trajectory = rbind(trajectory, trajectory1)
    trajectory1 = NULL
  }
  trajectory_new <- unique(trajectory)
  View(trajectory_new)
  new_receptor <- rep(1:N, each = 73) #each = duration + 1
  print("Done")
  trajectory_new$receptor <- new_receptor
  View(trajectory_new)
  return(trajectory_new)
}

and the warning is

49: In shell(sys_cmd) :
  '(cd "C:/Users/dicky/Downloads" && "C:/Users/dicky/Documents/R/win-library/3.6/splitr/win/hyts_std.exe" > NUL 2>&1)' execution failed with error code 900
50: All formats failed to parse. No formats found.

is there anything wrong with the code or is something to do with the package?

Thank you

MauricioCely commented 4 years ago

I am trying to compile the example from hysplit_trajectory function. At the beginning are downloaded some .gbl files but at the end I get an error Warning messages: 1: In system(sys_cmd) : error in running command.

juliombarros commented 3 years ago

Same issue here, any leads?

MRPHarris commented 2 years ago

I have had a similar issue, and I think I have identified the cause.

I had been attempting to run hourly back-trajectories across multiple years by iterating monthly runs, using GDAS1 data. I was unsuccessful, and found that the last 2 hours (i.e. 'daily hours' 22 and 23, representing 22:00 and 23:00) of the last day of each month fail to execute when using GDAS met data as set up by splitr.

I was able to identify the source of the problem by running identical trajectories in the HYSPLIT GUI. This problem was solved in the GUI by adding the first met file of the following month to the run. I suppose this must indicate that for some reason data related to the last 2 hours of each month are stored in the week 1 file for the following month (e.g., hours 22 and 23 from the 31st of January 2005 will not run for my 120hr back-trajectories unless the week 1 February GDAS1 file is included in the CONTROL file).

I believe this is not handled by the way splitr currently assesses which met files to include in the CONTROL file before executing the system call to initiate the model. I suppose a solution would be to detect if the hours fulfill the above criteria (last two of the month), and if that's the case include the following month's met file in the CONTROL file.

This is more of a diagnosis than a solution, but it is a step closer!