importBC_data() date is POSIXct, UTC
Closed this issue · 1 comments
GailR commented
The time zone attribute of the date
column produced by importBC_data()
is incorrectly assigned as UTC (should be Etc/GMT+8 , i.e. Pacific Standard Time).
A reprex:
data <- importBC_data("co", 2018)
(head(data, n = 5))
# A tibble: 5 x 15
date station_name station_name_full ems_id naps_id raw_value rounded_value unit instrument parameter owner region validation_stat~ ws wd
<dttm> <chr> <chr> <chr> <dbl> <dbl> <dbl> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <lgl>
1 2018-01-01 01:00:00 Victoria Topaz VICTORIA TOPAZ E231866 100304 0.204 0.204 ppm CO_API300 CO ENV 01 - Vancouver Is~ VALID NA NA
2 2018-01-01 02:00:00 Victoria Topaz VICTORIA TOPAZ E231866 100304 0.186 0.186 ppm CO_API300 CO ENV 01 - Vancouver Is~ VALID NA NA
3 2018-01-01 03:00:00 Victoria Topaz VICTORIA TOPAZ E231866 100304 0.199 0.199 ppm CO_API300 CO ENV 01 - Vancouver Is~ VALID NA NA
4 2018-01-01 04:00:00 Victoria Topaz VICTORIA TOPAZ E231866 100304 0.186 0.186 ppm CO_API300 CO ENV 01 - Vancouver Is~ VALID NA NA
5 2018-01-01 05:00:00 Victoria Topaz VICTORIA TOPAZ E231866 100304 0.164 0.164 ppm CO_API300 CO ENV 01 - Vancouver Is~ VALID NA NA
(attr(data$date, "tzone"))
# [1] "UTC"
I see that importBC_data
uses read_csv
. Perhaps setting locale = locale(tz = "Etc/GMT+8")
within read_csv
will fix the issue?
GailR commented
I'll close this issue - it looks like it has been resolved.
data <- importBC_data("co", 2018)
(head(data, n = 5))
# A tibble: 5 x 15
DATE_PST DATE TIME STATION_NAME STATION_NAME_FU… EMS_ID NAPS_ID RAW_VALUE ROUNDED_VALUE UNIT
<dttm> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <chr>
1 2018-01-01 01:00:00 2018… 01:00 Victoria To… VICTORIA TOPAZ E2318… 100304 0.204 0.204 ppm
2 2018-01-01 02:00:00 2018… 02:00 Victoria To… VICTORIA TOPAZ E2318… 100304 0.186 0.186 ppm
3 2018-01-01 03:00:00 2018… 03:00 Victoria To… VICTORIA TOPAZ E2318… 100304 0.199 0.199 ppm
4 2018-01-01 04:00:00 2018… 04:00 Victoria To… VICTORIA TOPAZ E2318… 100304 0.186 0.186 ppm
5 2018-01-01 05:00:00 2018… 05:00 Victoria To… VICTORIA TOPAZ E2318… 100304 0.164 0.164 ppm
(attr(data$DATE_PST, "tzone"))
[1] "Etc/GMT+8"