Mercurial > repos > greg > insect_phenology_model
changeset 74:9843894544a8 draft
Uploaded
author | greg |
---|---|
date | Tue, 14 Nov 2017 13:57:23 -0500 |
parents | 9bc7ab4da9e7 |
children | 392980f72514 |
files | insect_phenology_model.R |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/insect_phenology_model.R Tue Nov 14 13:54:27 2017 -0500 +++ b/insect_phenology_model.R Tue Nov 14 13:57:23 2017 -0500 @@ -28,14 +28,15 @@ parse_input_data = function(input_file, num_rows, num_columns) { # Read in the input temperature datafile into a data frame. + temperature_data_frame <- read.csv(file=input_file, header=T, strip.white=TRUE, sep=",") if (num_rows == 6) { # The input data has the following 6 columns: # LATITUDE, LONGITUDE, DATE, DOY, TMIN, TMAX - temperature_data_frame <- read.csv(file=input_file, header=T, strip.white=TRUE, sep=",") # Add a column containing the daylight length for each day. - temperature_data_frame <- add_daylight_length(latitude, temperature_data_frame, opt$num_days) - temperature_data_frame + temperature_data_frame <- add_daylight_length(latitude, temperature_data_frame, num_days) } + # Return the temperature_data_frame. + temperature_data_frame } add_daylight_length = function(latitude, temperature_data_frame, num_days) { @@ -55,7 +56,7 @@ } # Append daylight_length_vector as a new column to temperature_data_frame. temperature_data_frame[, 7] <- daylight_length_vector - # Return the altered temperature_data_frame. + # Return the temperature_data_frame. temperature_data_frame } @@ -200,7 +201,7 @@ return } -temperature_data_frame <- parse_input_data(opt$input, opt$num_rows, opt$num_columns) +temperature_data_frame <- parse_input_data(opt$input, opt$num_days, opt$num_columns) latitude <- temperature_data_frame[1, 1] cat("Number of days: ", opt$num_days, "\n")