# HG changeset patch # User greg # Date 1510689621 18000 # Node ID 0c807f99a816cb3b6ddf73251da7075861385456 # Parent 5729eb737082043dc1e6f51367129f1fd0320f86 Uploaded diff -r 5729eb737082 -r 0c807f99a816 insect_phenology_model.R --- 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")