comparison insect_phenology_model.R @ 72:3c5a149d4255 draft

Uploaded
author greg
date Tue, 14 Nov 2017 13:23:36 -0500
parents f3d11014be12
children 9bc7ab4da9e7
comparison
equal deleted inserted replaced
71:f3d11014be12 72:3c5a149d4255
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 cbind(temperature_data_matrix, daylight_length_vector) 45 temperature_data_matrix[, 7] <- daylight_length_vector
46 # Return the altered temperature_data_matrix. 46 # Return the altered temperature_data_matrix.
47 temperature_data_matrix 47 temperature_data_matrix
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) {