rich-iannone / splitr

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

Splitr does not recognize non-leap years. #31

Closed omidnabavi closed 5 years ago

omidnabavi commented 5 years ago

Dear all, Have ever run into this problem that trajectory object in magrittr workflow does not recognize non-leap year. When you run

trajectory_model <-
  create_traj_model() %>%
  add_grid(
    lat = 49.0,
    lon = -123.0,
    range = c(0.8, 0.8),
    division = c(0.2, 0.2)) %>%
  add_params(
    height = 50,
    duration = 6,
    **run_period = c("2015-02-01","2015-02-31"),**
    daily_hours = c(0, 12),
    direction = "backward",
    met_type = "reanalysis") %>%
  run_model()

It asks for the fifth file of met data ( I am using gdas1). As you know, there only 4 files in February for non-leap years. It does not find the file, starts downloading the fifth file and ends in an error. Can you please let me know how to fix this problem? Best regards, Omid.

wjjxjd commented 5 years ago

There are many other problems here

rich-iannone commented 5 years ago

This is now fixed for trajectory runs. Here's an example that runs twice daily across 25 receptor sites for all of February 2012:

library(SplitR)
library(lubridate)
library(here)

traj_model <- 
  create_traj_model() %>%
  add_grid(
    lat = 49.0,
    lon = -123.0,
    range = c(0.8, 0.8),
    division = c(0.2, 0.2)
  ) %>%
  add_params(
    height = 50,
    duration = 6,
    days = seq(ymd("2012-02-01"), ymd("2012-02-28"), by = "1 day"),
    daily_hours = c(0, 12),
    direction = "backward",
    met_type = "gdas1",
    met_dir = here::here("met"),
    exec_dir = here::here("out")
  ) %>%
  run_model()