Mercurial > repos > greg > insect_phenology_model
changeset 80:b701a134d640 draft
Uploaded
author | greg |
---|---|
date | Tue, 14 Nov 2017 14:49:29 -0500 |
parents | 2448bca7eac6 |
children | 5729eb737082 |
files | insect_phenology_model.R |
diffstat | 1 files changed, 3 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/insect_phenology_model.R Tue Nov 14 14:49:23 2017 -0500 +++ b/insect_phenology_model.R Tue Nov 14 14:49:29 2017 -0500 @@ -11,7 +11,6 @@ make_option(c("-i", "--max_clutch_size"), action="store", dest="max_clutch_size", type="integer", help="Adjustment of maximum clutch size"), make_option(c("-j", "--nymph_mort"), action="store", dest="nymph_mort", type="integer", help="Adjustment rate for nymph mortality"), make_option(c("-k", "--old_nymph_accum"), action="store", dest="old_nymph_accum", type="integer", help="Adjustment of DD accumulation (young nymph->old nymph)"), - make_option(c("-m", "--num_columns"), action="store", dest="num_columns", type="integer", help="Total number of columns in the temperature dataset"), make_option(c("-n", "--num_days"), action="store", dest="num_days", type="integer", help="Total number of days in the temperature dataset"), make_option(c("-o", "--output"), action="store", dest="output", help="Output dataset"), make_option(c("-p", "--oviposition"), action="store", dest="oviposition", type="integer", help="Adjustment for oviposition rate"), @@ -26,10 +25,10 @@ args <- parse_args(parser, positional_arguments=TRUE) opt <- args$options -parse_input_data = function(input_file, num_rows, num_columns) { +parse_input_data = function(input_file, num_rows) { # 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_columns == 6) { + if (ncol(temperature_data_frame) == 6) { # The input data has the following 6 columns: # LATITUDE, LONGITUDE, DATE, DOY, TMIN, TMAX # Add a column containing the daylight length for each day. @@ -201,9 +200,7 @@ return } -cat("Number of columns: ", opt$num_columns, "\n") - -temperature_data_frame <- parse_input_data(opt$input, opt$num_days, opt$num_columns) +temperature_data_frame <- parse_input_data(opt$input, opt$num_days) print(temperature_data_frame) latitude <- temperature_data_frame[1, 1]