harphub / harpIO

IO functions for HARP
https://harphub.github.io/harpIO/
Other
6 stars 16 forks source link

read_point_forecast change of behavior? #16

Closed mpartio closed 4 years ago

mpartio commented 4 years ago

I updated our Harp code to latest at 20th of May. We extract stations from MEPS model (domain) before running verification. The extraction is done so:

metcoop_stations <- read_point_forecast(
  start_date    = <date>,
  end_date      = <date>,
  fcst_model    = "MEPS_prod",
  parameter     = <param>,
  fcst_type     = "eps",
  lead_time     = lead_times[1],
  file_path     = <path>,
  file_template = "{eps_model}/{YYYY}/{MM}/FCTABLE_{parameter}_{YYYY}{MM}_{HH}.sqlite"
) %>% 
  dplyr::pull(SID) %>%
  purrr::reduce(union)

With older harp code I get a list of stations:

   [1]  1001  1010  1014  1015  1018  1021  1022  1023  1025  1026  1027  1028
...

With the new code I get:

integer(0)

Any idea what could go wrong here?

andrew-MET commented 4 years ago

union only works if there is more than one model. A more robust way would be rather to use

read_point_forecast(...) %>%
  dplyr::pull(SID) %>%
  unlist() %>%
  unique()

This works regardless of the number of models.

However, harpPoint now has a pull_stations() function that does the exact same thing - https://github.com/andrew-MET/harpPoint/blob/master/R/pull_stations.R

mpartio commented 4 years ago

Thanks! I will try pull_stations() and see if it works.