MazamaScience/tiotemp

timeseriesCalendar first day issue

Closed this issue · 1 comments

The timeseriesCalendar() plot plots everything gray if I give the start date as Jan 01:

# Works fine starting on Jan 02
library(tiotemp)

library(AirSensor)
setArchiveBaseUrl("http://data.mazamascience.com/PurpleAir/v1")

sctv_08 <-
  sensor_loadYear(datestamp = 2019) %>%
  sensor_filterMeta(label == "SCTV_08") %>%
  sensor_filterDate(20190102, 20200101, timezone = "America/Los_Angeles")
  
timeseriesCalendar(sctv_08$data, sctv_08$meta)

# Shows all gray if I start on Jan 01
sctv_08 <-
  sensor_loadYear(datestamp = 2019) %>%
  sensor_filterMeta(label == "SCTV_08") %>%
  sensor_filterDate(20190101, 20200101, timezone = "America/Los_Angeles")
  
timeseriesCalendar(sctv_08$data, sctv_08$meta)

This kind of thing is often related to insufficient specification of timezones. That's why we have timezone linting capabilities!

> MazamaCoreUtils::lintFunctionArgs_dir(rules = MazamaCoreUtils::timezoneLintRules)
# A tibble: 6 x 6
  file                 line_number column_number function_name named_args includes_required
  <chr>                      <int>         <int> <chr>         <list>     <lgl>            
1 helpers.R                     89            33 parseDatetime <chr [1]>  TRUE             
2 helpers.R                     90            31 parseDatetime <chr [1]>  TRUE             
3 timeseriesCalendar.R         119            49 ymd_h         <NULL>     FALSE            
4 timeseriesCalendar.R         119            55 strftime      <NULL>     FALSE            
5 timeseriesCalendar.R         120            49 ymd_h         <NULL>     FALSE            
6 timeseriesCalendar.R         120            55 strftime      <NULL>     FALSE   

Every single function that can accept a timezone should do so explicitly with the appropriate named argument (e.g. timezone, tzone, tz).

Resolved on "jon" branch.