Mercurial > repos > greg > insect_phenology_model
comparison insect_phenology_model.R @ 65:8f3dba5dddb5 draft
Uploaded
author | greg |
---|---|
date | Tue, 14 Nov 2017 12:53:34 -0500 |
parents | e2f2780f5c14 |
children | f575148ce157 |
comparison
equal
deleted
inserted
replaced
64:e2f2780f5c14 | 65:8f3dba5dddb5 |
---|---|
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 temperature_data_matrix <- cbind(temperature_data_matrix, daylight_length_vector) | 45 rbind(temperature_data_matrix[, 7], daylight_length_vector) |
46 # Give the new column a name. | |
47 colnames(temperature_data_matrix)[7] <- c("DAYLEN") | |
46 } | 48 } |
47 | 49 |
48 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) { |
49 # Base development threshold for Brown Marmolated Stink Bug | 51 # Base development threshold for Brown Marmolated Stink Bug |
50 # insect phenology model. | 52 # insect phenology model. |