changeset 82:0c807f99a816 draft

Uploaded
author greg
date Tue, 14 Nov 2017 15:00:21 -0500
parents 5729eb737082
children 3e214a2fcec9
files insect_phenology_model.R
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/insect_phenology_model.R	Tue Nov 14 14:57:26 2017 -0500
+++ b/insect_phenology_model.R	Tue Nov 14 15:00:21 2017 -0500
@@ -32,19 +32,20 @@
         # The input data has the following 6 columns:
         # LATITUDE, LONGITUDE, DATE, DOY, TMIN, TMAX
         # Add a column containing the daylight length for each day.
-        temperature_data_frame <- add_daylight_length(latitude, temperature_data_frame, num_rows)
+        temperature_data_frame <- add_daylight_length(temperature_data_frame, num_rows)
     }
     # Return the temperature_data_frame.
     temperature_data_frame
 }
 
-add_daylight_length = function(latitude, temperature_data_frame, num_days) {
+add_daylight_length = function(temperature_data_frame, num_rows) {
     # Return a vector of daylight length (photoperido profile) for
     # the number of days specified in the input temperature data
     # (from Forsythe 1995).
     p = 0.8333
+    latitude <- temperature_data_frame[1, 1]
     daylight_length_vector <- NULL
-    for (i in 1:num_days) {
+    for (i in 1:num_rows) {
         # Get the day of the year from the current row
         # of the temperature data for computation.
         doy <- temperature_data_frame[i, 4]
@@ -201,7 +202,6 @@
 }
 
 temperature_data_frame <- parse_input_data(opt$input, opt$num_days)
-print(temperature_data_frame)
 latitude <- temperature_data_frame[1, 1]
 
 cat("Number of days: ", opt$num_days, "\n")