Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
updated tuv for dealing different resolution.
  • Loading branch information
tianshu129 committed Jul 8, 2020
1 parent 6e73007 commit 77946d7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
Description: A quick analysis toolkits for atmospheric field observation.
Expand Down
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions R/tuv.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 77946d7

Please sign in to comment.