comparison extract_ipm_date_interval.R @ 8:cf6a06a2346c draft

Uploaded
author greg
date Wed, 01 Aug 2018 09:17:15 -0400
parents 869e7d06bdf3
children fd41f452c9fe
comparison
equal deleted inserted replaced
7:869e7d06bdf3 8:cf6a06a2346c
14 args <- parse_args(parser, positional_arguments=TRUE); 14 args <- parse_args(parser, positional_arguments=TRUE);
15 opt <- args$options; 15 opt <- args$options;
16 16
17 get_new_temperature_data_frame = function(input_file) { 17 get_new_temperature_data_frame = function(input_file) {
18 temperature_data_frame = read.csv(file=input_file, header=T, strip.white=TRUE, stringsAsFactors=FALSE, sep=","); 18 temperature_data_frame = read.csv(file=input_file, header=T, strip.white=TRUE, stringsAsFactors=FALSE, sep=",");
19 colnames(temperature_data_frame) = c("LATITUDE", "LONGITUDE", "DATE", "DOY", "TMIN", "TMAX");
20 return(temperature_data_frame); 19 return(temperature_data_frame);
21 } 20 }
22 21
23 # Import the shared utility functions. 22 # Import the shared utility functions.
24 utils_path <- paste(opt$script_dir, "utils.R", sep="/"); 23 utils_path <- paste(opt$script_dir, "utils.R", sep="/");
63 ticks_and_labels = get_x_axis_ticks_and_labels(temperature_data_frame, date_interval=TRUE); 62 ticks_and_labels = get_x_axis_ticks_and_labels(temperature_data_frame, date_interval=TRUE);
64 ticks = c(unlist(ticks_and_labels[1])); 63 ticks = c(unlist(ticks_and_labels[1]));
65 date_labels = c(unlist(ticks_and_labels[2])); 64 date_labels = c(unlist(ticks_and_labels[2]));
66 # All latitude values are the same, so get the value 65 # All latitude values are the same, so get the value
67 # for plots from the first row. 66 # for plots from the first row.
68 latitude = temperature_data_frame$LATITUDE[1]; 67 latitude = temperature_data_frame$LATITUDE[1];
69 # Save the date interval data into an output file 68 # Save the date interval data into an output file
70 # named the same as the input. 69 # named the same as the input.
71 file_path = paste("output_data_dir", input_file, sep="/"); 70 file_path = paste("output_data_dir", basename(input_file), sep="/");
72 write.csv(temperature_data_frame, file=file_path, row.names=F); 71 write.csv(temperature_data_frame, file=file_path, row.names=F);
73 # TODO: Save the datE interval plots... 72 # TODO: Save the date interval plots...
74 } 73 }