comparison insect_phenology_model.R @ 53:b7c9837047d9 draft

Uploaded
author greg
date Thu, 18 Oct 2018 10:17:02 -0400
parents 3f827fe31756
children 5bb1d76c29ca
comparison
equal deleted inserted replaced
52:e2d12bafe9d7 53:b7c9837047d9
310 end_date_ytd_row = which(temperature_data_frame$DATE==end_date); 310 end_date_ytd_row = which(temperature_data_frame$DATE==end_date);
311 if (length(end_date_ytd_row) > 0) { 311 if (length(end_date_ytd_row) > 0) {
312 end_date_ytd_row = end_date_ytd_row[1]; 312 end_date_ytd_row = end_date_ytd_row[1];
313 # The end date is contained within the input_ytd data. 313 # The end date is contained within the input_ytd data.
314 end_doy_ytd = as.integer(temperature_data_frame$DOY[end_date_ytd_row]); 314 end_doy_ytd = as.integer(temperature_data_frame$DOY[end_date_ytd_row]);
315 if (end_doy_ytd > end_date_ytd_row + 1) {
316 # The input year-to-date dataset is missing 1 or more
317 # days of data.
318 days_missing = end_doy_ytd - end_date_ytd_row;
319 msg = cat("The year-to-date dataset is missing ", days_missing, " days of data.\n");
320 stop_err(msg);
321 }
315 } else { 322 } else {
316 end_date_ytd_row = 0; 323 end_date_ytd_row = 0;
317 } 324 }
318 } else { 325 } else {
319 # We're plotting an entire year. 326 # We're plotting an entire year.
333 # Properly set the end_date to be Dec 31 of the year. 340 # Properly set the end_date to be Dec 31 of the year.
334 end_date = paste(year, "12", "31", sep="-"); 341 end_date = paste(year, "12", "31", sep="-");
335 # Save the first DOY to later check if start_date is Jan 1. 342 # Save the first DOY to later check if start_date is Jan 1.
336 start_doy_ytd = as.integer(temperature_data_frame$DOY[1]); 343 start_doy_ytd = as.integer(temperature_data_frame$DOY[1]);
337 end_doy_ytd = as.integer(temperature_data_frame$DOY[num_ytd_rows]); 344 end_doy_ytd = as.integer(temperature_data_frame$DOY[num_ytd_rows]);
345 if (end_doy_ytd > end_date_ytd_row + 1) {
346 # The input year-to-date dataset is missing 1 or more
347 # days of data.
348 days_missing = end_doy_ytd - end_date_ytd_row;
349 msg = cat("The year-to-date dataset is missing ", days_missing, " days of data.\n");
350 stop_err(msg);
351 }
338 } 352 }
339 } else { 353 } else {
340 # We're processing only the 30 year normals data, so create an empty 354 # We're processing only the 30 year normals data, so create an empty
341 # data frame for containing temperature data after it is converted 355 # data frame for containing temperature data after it is converted
342 # from the 30 year normals format to the year-to-date format. 356 # from the 30 year normals format to the year-to-date format.