Check data quality (directive 2008/50/EC)
check_validity.Rd
Check measured data compliance with data quality objectves according to directive 2008/50/EC.
Arguments
- time
a date-time or date object of class POSIXct, POSIXlt
- value
a numeric vector of measured data to be checked
- type
Optional character vector indicating the type of validation to be performed. The only accepted value is "O3".
Details
The function check for data quality compliance according to the objectives established in Annex I of EU directive 2008/50/CE. Specifically it is tested the "Minimum data capture threshold" for fixed measurements.
All pollutants and quantities are deemed valid if at least 90% of (hourly) data are available.
In the case of $O_3$ two different thresholds applies:
90% for date times in the summer season (April to September)
75% for date times in the winter season (January to March, October to December) Both thresholds must be respected for data to be valid.
time
and value
must have the same length and it is assumed they cover
a full year of either daily or hourly measurements.
Examples
# Random data to simulate a PM10 daily values serie
pm10 <- runif(365) * 60
ts <- seq(lubridate::dmy("1/1/2019"), lubridate::dmy("31/12/2019"), by = "1 day")
check_validity(time = ts, value = pm10)
#> [1] 12.59115580 34.02102941 38.28664751 41.54954583 12.41530695 45.63143166
#> [7] 32.44825945 16.49986073 31.39019751 54.98078135 19.86434603 14.12956632
#> [13] 52.02137476 40.39188093 27.34703762 44.38689667 9.35638305 3.69458713
#> [19] 12.94786497 31.62283109 53.01462105 8.46634913 19.07561074 45.85947553
#> [25] 39.35037590 50.62064365 21.87190081 22.00765219 51.04944910 26.27830653
#> [31] 0.53280130 48.97346256 7.69775843 58.88026400 7.61420420 55.36113394
#> [37] 17.54104433 54.46686408 48.57070180 47.84860487 49.59023842 49.77931182
#> [43] 37.63013205 13.76905530 54.95679428 41.24665950 49.60930887 18.37011010
#> [49] 15.25946145 44.53230659 16.54211319 9.98188284 15.15391440 27.72971161
#> [55] 22.76112716 6.13222461 14.88687996 56.25451825 52.08880131 25.48130516
#> [61] 39.37858986 50.67684607 13.41591158 23.36126788 42.48807188 15.43425119
#> [67] 36.99763368 39.04829051 50.56959456 29.74842918 26.88683031 31.98241434
#> [73] 5.09140811 32.44333711 17.80866588 3.35813713 43.03047595 0.95015582
#> [79] 46.81459046 39.56436946 19.41873035 0.60626128 32.64971798 4.63876130
#> [85] 5.45796168 32.35417369 32.10168551 51.18980147 16.54265428 18.96559494
#> [91] 3.48241301 1.30074211 25.30404499 10.47158448 49.99834009 16.50016101
#> [97] 35.13833906 1.18968478 30.88111290 29.60923200 57.19183910 32.55025544
#> [103] 22.42161335 40.08855277 10.14171962 41.04178675 21.20848113 52.30438560
#> [109] 20.45493951 53.01390078 20.69887856 35.62379600 11.08394972 12.06820906
#> [115] 50.90978944 43.42269240 0.83933769 48.91416161 52.85001052 58.25550233
#> [121] 25.85172376 37.46109499 33.57394708 41.37031322 8.86178448 38.90475672
#> [127] 55.58021373 47.52285238 28.49734012 46.07846101 13.23392887 53.76703107
#> [133] 53.73741383 0.93393181 50.98425311 43.45135089 7.74140194 55.68728548
#> [139] 32.20794163 24.49221158 26.58759469 11.64097253 13.80475145 24.88493419
#> [145] 54.86007256 52.20309655 11.02028690 45.06469823 19.92802025 16.78484602
#> [151] 40.84417724 10.22229385 36.12526270 35.70880140 30.39633952 24.51280827
#> [157] 14.87432823 35.95693379 29.35746723 1.51846643 26.80998031 3.72708840
#> [163] 8.43764450 55.06273224 28.48919019 24.76263306 25.29525949 3.45243322
#> [169] 39.57168384 38.15637618 2.73025224 34.76659664 0.81197146 11.51604407
#> [175] 36.90928684 1.81424688 9.14478082 18.49989682 41.53368963 2.43361901
#> [181] 56.03353447 37.25230463 2.93860062 23.81986816 33.24979287 29.55449919
#> [187] 0.98948940 36.21339658 14.57454612 55.27465593 44.38904746 13.60465508
#> [193] 24.69159918 21.17850638 35.35370833 13.88170386 14.25860759 35.37249237
#> [199] 55.20349899 5.40685364 50.49218366 3.60487939 48.50664942 10.65440463
#> [205] 52.13632242 58.58439053 8.43259476 0.05569453 16.47535957 50.57699618
#> [211] 25.75720306 2.69906068 34.75146883 13.16645066 52.13053067 46.52587394
#> [217] 39.61188549 6.37679825 5.36976385 51.26455303 16.42773216 33.63810740
#> [223] 14.92914847 55.51351311 35.68064442 20.58640326 51.79695924 51.10703242
#> [229] 57.84791253 17.78777316 21.48442708 6.57834160 36.12469048 8.95333692
#> [235] 30.30357731 6.84831160 17.53499135 33.72059234 51.46262682 10.56657229
#> [241] 57.71472478 20.28138392 53.87778176 5.21539946 50.51162103 8.32853267
#> [247] 8.76037316 14.10068961 59.97161855 22.84220471 13.18719488 1.95746122
#> [253] 38.47830924 59.25935007 21.58660641 37.04582174 18.77313897 28.54164560
#> [259] 39.55006277 47.43124877 37.32823770 47.26523315 30.62670079 12.83114006
#> [265] 10.69321556 49.10404916 8.64007560 59.34966470 16.04468476 18.96363413
#> [271] 52.41291977 54.63845561 27.44971965 20.88618660 45.01848632 9.63317629
#> [277] 8.19089191 41.44807999 22.07050361 14.06845964 18.68702559 47.03510973
#> [283] 4.60417810 26.06908960 30.43725429 16.82656808 43.86589678 13.96707878
#> [289] 42.51884834 12.05418375 23.49284128 47.37664004 20.64628059 28.27100439
#> [295] 14.03608657 9.38062924 49.26909607 49.13043015 51.59305466 42.47872483
#> [301] 7.61825598 45.47594930 44.45536268 8.26873161 45.36708025 30.85099303
#> [307] 55.08253647 15.93239503 7.40047550 10.68668639 8.45754839 56.99289673
#> [313] 30.96467176 56.65840776 55.52962735 33.68125076 59.80251817 57.03998162
#> [319] 25.50054736 8.18660839 10.62759911 9.21958549 30.18925995 50.97963800
#> [325] 58.46824434 48.62538502 57.61245358 8.11749967 3.24372823 12.17517475
#> [331] 7.23415882 22.94239178 50.08798096 59.32360223 54.38509882 34.36637681
#> [337] 18.10309009 7.22851161 17.94292458 58.51296069 35.93341143 48.28345366
#> [343] 58.29158762 31.92533408 41.66968695 37.65947483 26.39417593 27.01003621
#> [349] 4.98389576 38.18609749 12.99174471 14.78998542 14.55436832 36.63518395
#> [355] 8.62481744 11.63270209 12.11925498 24.33834426 18.61064272 10.26602341
#> [361] 35.03973695 40.17766548 31.79694759 37.09459268 30.16876758