Skip to content

Commit

Permalink
Merge pull request #194 from tonygard-indecon/update_convertTemps
Browse files Browse the repository at this point in the history
Update convertTemps to handle variation in case of `from` arg
  • Loading branch information
knoiva-indecon authored Oct 24, 2024
2 parents 08ead1b + 0696172 commit ceac0c6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions FrEDI/R/convertTemps.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ convertTemps <- function(
c0 <- 0 ### Update
c1 <- 1.421 ### Update

toType <- from |> tolower()
if(from == "global"){
## Make "from" argument lowercase
fromType <- from |> tolower()

if(fromType == "global"){
temp_global <- temps
new_temps <- c1*temp_global + c0
} else{
} else if(fromType == "conus"){
temp_conus <- temps
new_temps <- (temp_conus - c0)/c1
} else {
stop("Warning! In convertTemps(): Invalid value provided to from argument. Please enter a valid value. Exiting...")
}

###### Return ######
Expand Down

0 comments on commit ceac0c6

Please sign in to comment.