changeset 32:5517d380c337 draft

Uploaded
author greg
date Thu, 09 Nov 2017 13:32:40 -0500
parents e56529d02c3e
children a374a8fab830
files insect_phenology_model.R
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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]