# HG changeset patch # User greg # Date 1510252360 18000 # Node ID 5517d380c337f43088ef2c6854d1d2383d2081b3 # Parent e56529d02c3ef6f553cbfe9ea8e2759223703fbf Uploaded diff -r e56529d02c3e -r 5517d380c337 insect_phenology_model.R --- a/insect_phenology_model.R Thu Nov 09 13:25:06 2017 -0500 +++ b/insect_phenology_model.R Thu Nov 09 13:32:40 2017 -0500 @@ -25,11 +25,8 @@ args <- parse_args(parser, positional_arguments=TRUE) opt <- args$options -convert_csv_to_rdata=function(data_matrix) +convert_csv_to_rdata=function(temperature_data, data_matrix) { - # Also stores the current year. - date <- data_matrix[1, 3] - year <- substr(date, 1, 4) # Integer day of the year. data_matrix[,1] <- c(1:opt$num_days) # Minimum @@ -203,6 +200,8 @@ # Read in the input temperature datafile into a Data Frame object. temperature_data <- read.csv(file=opt$input, header=T, sep=",") +date <- temperature_data[c(1:1), 3] +year <- substr(date, 1, 4) raw_data_matrix <- matrix(rep(0, opt$num_days * 6), nrow=opt$num_days) temperature_file_path <- convert_csv_to_rdata(raw_data_matrix) latitude <- temperature_data[1, 1]