comparison utils.R @ 60:393085589438 draft

Uploaded
author greg
date Thu, 20 Dec 2018 09:15:52 -0500
parents 892cf703be62
children
comparison
equal deleted inserted replaced
59:892cf703be62 60:393085589438
331 msg = paste("Invalid date: ", date_str, ", valid date format is yyyy-mm-dd.", sep=""); 331 msg = paste("Invalid date: ", date_str, ", valid date format is yyyy-mm-dd.", sep="");
332 stop_err(msg); 332 stop_err(msg);
333 } 333 }
334 return(valid_date); 334 return(valid_date);
335 } 335 }
336
337 validate_doys = function(temperature_data_frame) {
338 # Ensure all DOY values are consecutive integers.
339 last_doy = 0;
340 num_rows = dim(temperature_data_frame)[1];
341 for (i in 1:num_rows) {
342 doy = as.integer(temperature_data_frame$DOY[i]);
343 if (last_doy == 0) {
344 last_doy = doy;
345 } else {
346 if (doy != last_doy + 1) {
347 msg = paste("DOY ", doy, " is not consecutive (previous DOY is ", last_doy, ".", sep="");
348 stop_err(msg);
349 }
350 last_doy = doy;
351 }
352 }
353 }