comparison insect_phenology_model.R @ 66:f575148ce157 draft

Uploaded
author greg
date Tue, 14 Nov 2017 13:03:59 -0500
parents 8f3dba5dddb5
children e8923653a5bf
comparison
equal deleted inserted replaced
65:8f3dba5dddb5 66:f575148ce157
40 phi <- asin(0.39795 * cos(theta)) 40 phi <- asin(0.39795 * cos(theta))
41 # Compute the length of daylight for the day of the year. 41 # Compute the length of daylight for the day of the year.
42 daylight_length_vector[i] <- 24 - (24 / pi * acos((sin(p * pi / 180) + sin(latitude * pi / 180) * sin(phi)) / (cos(latitude * pi / 180) * cos(phi)))) 42 daylight_length_vector[i] <- 24 - (24 / pi * acos((sin(p * pi / 180) + sin(latitude * pi / 180) * sin(phi)) / (cos(latitude * pi / 180) * cos(phi))))
43 } 43 }
44 # Append daylight_length_vector as a new column to temperature_data_matrix. 44 # Append daylight_length_vector as a new column to temperature_data_matrix.
45 rbind(temperature_data_matrix[, 7], daylight_length_vector) 45 cbind(temperature_data_matrix, newColumn=daylight_length_vector)
46 # Give the new column a name. 46 # Give the new column a name.
47 colnames(temperature_data_matrix)[7] <- c("DAYLEN") 47 colnames(temperature_data_matrix)[7] <- c("DAYLEN")
48 } 48 }
49 49
50 get_temperature_at_hour = function(latitude, temperature_data_matrix, row, num_days) { 50 get_temperature_at_hour = function(latitude, temperature_data_matrix, row, num_days) {