rich-iannone / splitr

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

Can't create trajectories with daily meterology data (NAM 12, gdal0.5 etc) #68

Closed ChrisLaw08 closed 12 months ago

ChrisLaw08 commented 3 years ago

Hi Richard,

Thank you for creating such a wonderful R package. I've already used it extensively, and being able to keep my workflow all in R has been such a time saver.

I've encounter this strange problem that only seems to happen with meterology data that you dowload on a daily basis like the NAM 12 and gdal0.5, but doesn't occur with the monthly data like NARR. When the model is started at UTC hours 22 or 23, no trajectory can be created. For example:

TestNAM<-hysplit_trajectory( lat = 44.3658, lon = -73.9028, height = 976, duration = 72, direction = "backward", met_type = "nam12", days = as.Date("2018-07-15"), daily_hours = 22, clean_up = FALSE )

But I get the warning: 'Warning message: Problem with mutate() input traj_dt. ℹ All formats failed to parse. No formats found. ℹ Input traj_dt is `lubridate::ymd_h(date_h_str).

And it returns an empty tibble. However, when I run this same trajectory using NARR data instead, no issues seem to occur. In addition, if I run the above code for hours 21 and before, there doesn't seem to be any issues either. Any ideas what could be causing this issue? My best guess is it involes how datetimes are getting read in, but I'm not really sure.

This seems related to issue #67, which may provide some extra ideas.

Thanks for the great work you've done on this package

ChrisLaw08 commented 12 months ago

After a couple of years, I wanted to come back to this to mention that this isn't an issue with splitr but with HYSPLIT itself. For daily meteorology files like the NAM 12, you need an extra day of data for hours after 21 UTC. This problem exists in the HYSPLIT stand alone software as well. There may be a way to include this tweak in splitr, but it's simple enough to just extend your analysis an extra in R as well.