Skip to content

Change error to data frame with rain = 0 #59

Description

@jonbry

Max noticed a strange error with the following query:

Test case:
target_id = '63491'
start_date = '2024-07-01'
end_date = '2024-07-04'

Image

Currently if there are no rows returned for a given rain period:

  1. It looks for zero rows
  2. Then if it's the month is the same as the current month it gives the error you received
  3. Otherwise, it says no data in the database

rain_temp <- DBI::dbGetQuery(con, rain_query)
# Error messages if there are no rows in returned from the DB
if(nrow(rain_temp) == 0){
if(lubridate::month(start_date) == lubridate::month(lubridate::today())){
stop(paste("Rainfall data appears in the MARS database on about a 5 week delay. \nData for", lubridate::month(start_date, label = TRUE, abbr = FALSE), "should be available in the second week of", lubridate::month(lubridate::today() + lubridate::dmonths(1), label = TRUE, abbr = FALSE)))
}
stop("There is no data in the database for this date range.")

This should be changed to:

  • If no data, return data frame with zero values for rain.
    • We should make sure that all queries have zeros and not NA since no rain is a known amount.
  • Remove errors

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions