The data output of the weather_dl() function include a corresponding _flag column for each data column. These columns are used by ECCC to add notes regarding measurements.
In the weather_dl() function if format = TRUE (the default), data corresponding to flags M, NA, [empty] and L are all replaced with NA.
For example, a sample of unformatted data from Magog station in Quebec looks like:
## # A tibble: 6 x 4
## station_name `Date/Time` `Total Precip (mm)` `Total Precip Flag`
## <chr> <chr> <chr> <chr>
## 1 MAGOG 2017-09 63.0 ^
## 2 MAGOG 2017-10 140.8 ^
## 3 MAGOG 2017-11 70.0 ^
## 4 MAGOG 2017-12 45.7 ^
## 5 MAGOG 2018-01 34.6 ^
## 6 MAGOG 2018-02 77.2 ^
## # A tibble: 6 x 4
## station_name `Date/Time` `Snow Grnd Last Day (cm)` `Snow Grnd Last Day Flag`
## <chr> <chr> <chr> <chr>
## 1 MAGOG 2017-09 0 ""
## 2 MAGOG 2017-10 0 ""
## 3 MAGOG 2017-11 0 ""
## 4 MAGOG 2017-12 10 ""
## 5 MAGOG 2018-01 2 ""
## 6 MAGOG 2018-02 0 ""
In this output, you can see two flags: ^ in Total Precip and M in Snow Grnd Last Day
This same sample, formatted looks like:
## # A tibble: 6 x 5
## date total_precip total_precip_flag snow_grnd_last_day snow_grnd_last_day_flag
## <date> <dbl> <chr> <dbl> <chr>
## 1 2017-09-01 63.0 ^ 0 ""
## 2 2017-10-01 141 ^ 0 ""
## 3 2017-11-01 70.0 ^ 0 ""
## 4 2017-12-01 45.7 ^ 10.0 ""
## 5 2018-01-01 34.6 ^ 2.00 ""
## 6 2018-02-01 77.2 ^ 0 ""
As you can see, we still have the two flags, but the missing data flag (M) is now replaced with NA. The other flag ^ is not, as it indicates that “The value displayed is based on incomplete data” (see below).
The flags index can be accessed through the built in data frame: flags
| code | meaning |
|---|---|
| E | Estimated |
| M | Missing |
| NA | Not Available |
| Date/Time | Year |
| A | Accumulated |
| C | Precipitation occurred, amount uncertain |
| F | Accumulated and estimated |
| L | Precipitation may or may not have occurred |
| N | Temperature missing but known to be > 0 |
| S | More than one occurrence |
| T | Trace |
| Y | Temperature missing but known to be < 0 |
| [empty] | No data available |
| ^ | The value displayed is based on incomplete data |
| † | Data that is not subject to review by the National Climate Archives |
| B | More than one occurrence and estimated |