From 77946d7906cc620b2e9cc4b24b662a4500e0169d Mon Sep 17 00:00:00 2001 From: Tianshu Chen Date: Wed, 8 Jul 2020 02:04:12 -0600 Subject: [PATCH] v1.0.1 updated tuv for dealing different resolution. --- DESCRIPTION | 2 +- NAMESPACE | 3 ++- R/tuv.R | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 83715dd..60d1334 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: foqat Type: Package Title: Field observation quick analysis tookit -Version: 1.0.0 +Version: 1.0.1 Author: Tianshu Chen Maintainer: Tianshu Chen Description: A quick analysis toolkits for atmospheric field observation. diff --git a/NAMESPACE b/NAMESPACE index dffed0a..0a64051 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,7 +11,8 @@ import(lubridate) import(magrittr) importFrom(dplyr,full_join) importFrom(lubridate,duration) -importFrom(lubridate,hour) +importFrom(lubridate,hours) +importFrom(lubridate,minutes) importFrom(rvest,html_nodes) importFrom(rvest,html_text) importFrom(stats,aggregate) diff --git a/R/tuv.R b/R/tuv.R index bcb1e09..27b1c00 100644 --- a/R/tuv.R +++ b/R/tuv.R @@ -21,7 +21,8 @@ #' @return dataframe of photolysis rate coefficients (J-values). #' @export #' @importFrom stringr str_split_fixed -#' @importFrom lubridate hour +#' @importFrom lubridate hours +#' @importFrom lubridate minutes tuv <- function(pathtuv, df, colid = 1){ outfile="usrout.txt" @@ -56,7 +57,9 @@ for(irow in 1:nrow(df)){ result_j <- data.frame(result[(which(grepl("deg.", result[,1]))[2]+1):(nrow(result)-1),]) result_j_df <- data.frame(str_split_fixed(result_j[,1], "\\s+", 10), stringsAsFactors = FALSE)[,2:10] colnames(result_j_df) <- c("time hrs.", "sza deg.", "1", "2", "3", "4", "5", "6", "7") - result_j_df[,1] <- as.character(hours(as.numeric(result_j_df[,1])) + as.Date(df[irow,1])) + hours_result = round(as.numeric(result_j_df[,1])) + minutes_result = round((as.numeric(result_j_df[,1])-round(as.numeric(result_j_df[,1])))*60) + result_j_df[,1] <- as.character(as.Date(df[irow,1]) + hours(hours_result) + minutes(minutes_result)) # Writes result data to the result df if(exists("result_j_df_all")){ result_j_df_all <- rbind(result_j_df_all, result_j_df)