bcgov / bcgov/envair

Inconsistent PM2.5 data downloaded for 2017 Kamloops

Open
#12 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
8
Forks
4
PR merge metrics
No merged PRs in 30d

Description

For PM2.5 data for Kamloops in 2017, data returned by `importBC_data()` function differs if downloading the data by station (`importBC_data(station, ...)` vs by parameter (`importBC_data("PM25", ...)`). When downloaded by parameter, the data are "missing" past 2017-06-19 12:00:00. This is likely due to the fact that the monitor was switched to a SHARP; data may not be gathered from the correct ftp paths and thus appears "missing". See example below to create plots for comparison.

```
library(envair)
library(tidyr)
library(ggplot2)

station <- "Kamloops Federal Building"
years <- 2016:2018

# by station
dataByStation <- importBC_data(station, years = years)
xs <- dataByStation %>%
mutate(pm25_instrument = paste0("ch_PM25_", pm25_instrument),
pm25_2_instrument = paste0("ch_PM25_2_", pm25_2_instrument))

ggplot() +
geom_point(data = xs, aes(x = date, y = pm25_raw, color = pm25_instrument), alpha = 0.5) +
geom_point(data = xs, aes(x = date, y = pm25_2_raw, color = pm25_2_instrument), size = 1.5, alpha = 0.5) +
theme_bw()

# by parameter
pm25 <- importBC_data("PM25", years = years)
dataByParameter <- pm25 %>% filter(STATION_NAME == station)

xp <- pivot_wider(dataByParameter, id_cols = c("DATE_PST", "DATE", "TIME", "STATION_NAME", "NAPS_ID", "INSTRUMENT"),
names_from = "PARAMETER",
values_from = "RAW_VALUE") %>%
rename(date = DATE_PST)

ggplot() +
geom_point(data = xp, aes(x = date, y = PM25, color = INSTRUMENT), alpha = 0.5) +
theme_bw()
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the two `importBC_data()` calls in the issue for Kamloops and compare results around 2017-06-19 12:00:00, including the monitor change to a SHARP. Trace how station- and parameter-based downloads select FTP paths; done means both forms include the expected PM2.5 data after that timestamp.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.