@@ -97,6 +97,13 @@ patch_wfms = function(f, df) {
9797 sub(' WS ' , ' WS_raw ' , . ) %> %
9898 sub(' WD ' , ' WD_raw ' , . )
9999 }
100+ # Flag very suspicious (probably wrong) CO dip with V4
101+ suspicious_co = df $ `Time (EST)` > = as.POSIXct(' 1999-03-01' , tz = ' EST' ) &
102+ df $ `Time (EST)` < as.POSIXct(' 2001-05-02 05:00' , tz = ' EST' )
103+ if (any(suspicious_co )) {
104+ make_v4 = suspicious_co & df $ `CO (flag)` != ' M1'
105+ df $ `CO (flag)` [make_v4 ] = ' V4'
106+ }
100107 # In July 2014, something knocked the wind direction sensor off by 140
101108 # degrees. Brian, not yet knowing the true offset or timing of the error,
102109 # corrected the winds by 75 degrees, gradually phasing in the full 75 degree
@@ -277,7 +284,7 @@ read_processed = function(f, index_cols = 5) {
277284 # # make sure non-flag columns are numeric
278285 for (n in (index_cols + 1 ): (ncols - 1 )) {
279286 if (! grepl(' .*flag' , units [n ], ignore.case = T )) {
280- if (is(df [, n ], ' factor' )) {
287+ if (is(df [, n ], ' factor' ) || is( df [, n ], ' character ' ) ) {
281288 warning(' non-numeric values in ' , names(df )[n ])
282289 tmp_char = as.character(df [, n ])
283290 old_nas = is.na(df [, n ])
0 commit comments