changeset 53:b7c9837047d9 draft

Uploaded
author greg
date Thu, 18 Oct 2018 10:17:02 -0400
parents e2d12bafe9d7
children 5bb1d76c29ca
files insect_phenology_model.R
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/insect_phenology_model.R	Wed Aug 08 14:16:58 2018 -0400
+++ b/insect_phenology_model.R	Thu Oct 18 10:17:02 2018 -0400
@@ -312,6 +312,13 @@
                 end_date_ytd_row = end_date_ytd_row[1];
                 # The end date is contained within the input_ytd data.
                 end_doy_ytd = as.integer(temperature_data_frame$DOY[end_date_ytd_row]);
+                if (end_doy_ytd > end_date_ytd_row + 1) {
+                    # The input year-to-date dataset is missing 1 or more
+                    # days of data.
+                    days_missing = end_doy_ytd - end_date_ytd_row;
+                    msg = cat("The year-to-date dataset is missing ", days_missing, " days of data.\n");
+                    stop_err(msg);
+                }
             } else {
                 end_date_ytd_row = 0;
             }
@@ -335,6 +342,13 @@
             # Save the first DOY to later check if start_date is Jan 1.
             start_doy_ytd = as.integer(temperature_data_frame$DOY[1]);
             end_doy_ytd = as.integer(temperature_data_frame$DOY[num_ytd_rows]);
+            if (end_doy_ytd > end_date_ytd_row + 1) {
+                # The input year-to-date dataset is missing 1 or more
+                # days of data.
+                days_missing = end_doy_ytd - end_date_ytd_row;
+                msg = cat("The year-to-date dataset is missing ", days_missing, " days of data.\n");
+                stop_err(msg);
+            }
         }
     } else {
         # We're processing only the 30 year normals data, so create an empty