I’ve previously written about quality codes and some approaches to summarising the quality codes in a hydrologic data set. This post provides some additional approaches to producing graphical summaries of codes. These figures summarise around 1.8 million flow records (12 min data from 1975 to the present). R code to produce these plots is available in a gist.
Legend placed inside the plot, filled boxes, superscripts in axis title.
Time series coloured by quality code
Time series faceted by year. Points in legend are larger than used for graphing to aid interpretation.
Time series showing occurrence of a single code
For this data, quality code 120 means “Estimated data not using correlation (ave. dry weather hydrograph used) or Rating extrapolated”.
Single code, single year
Codes for selected years and months
Legend placed on plot and made transparent
Missing values don’t appear on plots. Here I’ve recoded missing data as -50 so it will show up as points below the flow data. Check the facet for 1975 which shows several missing values.
The codes used for missing data can be summarised easily using commands in the dplyr package.
yarra %>% filter(is.na(discharge_229143A)) %>% count(discharge_229143A_qcode)
In this case, three codes have been used.
|151||1127||Poor or unverified data. Use with caution.
Data lost due to natural causes
For this plot, there is one tile for each 12 min record. The tile colour shows the quality code.
Area shows the frequency of codes.
Summary of all missing values
Summary data for quality codes can be formatted and pasted to the clipboard on a Mac. Flow data is in a dataframe called yarra. Quality codes are in a column called discharge_229143A_qcode
# Quality codes # Make a table of the different codes that are used qcode_table <- yarra %>% count(discharge_229143A_qcode) %>% mutate(pc = 100 * n/sum(n)) %>% mutate(pc = round(pc, 2)) %>% mutate(n = format(n, big.mark = ',')) %>% rename(`Proportion (%)` = pc) %>% rename(`Quality code` = discharge_229143A_qcode) %>% rename('Number' = n) # write to clipboard clip <- pipe("pbcopy", "w") write.table(qcode_table, file=clip, sep = '\t', row.names = FALSE, quote = FALSE) close(clip)
All code is available as a gist.
Sinclair Knight Merz (2010) Developing guidelines for the selection of streamflow gauging stations. (link to page at Wayback Machine) (link to page at Bureau). Appendix A of this report lists quality codes as used in many jurisdictions in Australia.