Skip to content

Commit

Permalink
Merge pull request #46 from gagreene/main
Browse files Browse the repository at this point in the history
Update Slopecalc.r
  • Loading branch information
BadgerOnABike authored Sep 18, 2024
2 parents 7c9748a + e3d1797 commit 0d2ae9d
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions R/Slopecalc.r
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,8 @@ slope_adjustment <- function(
),
ISF
)
ifelse(
FUELTYPE %in% c("NF", "WA"),
{
return(list(
WSV = NA,
RAZ = NA
))
},
{
# Initialize RAZ and WSV
RAZ <- WSV <- rep(-99, length(FFMC))
# Eq. 46 (FCFDG 1992)
m <- FFMC_COEFFICIENT * (101 - FFMC) / (59.5 + FFMC)
# Eq. 45 (FCFDG 1992) - FFMC function from the ISI equation
Expand All @@ -314,17 +307,15 @@ slope_adjustment <- function(
WSY <- WS * cos(WAZ) + WSE * cos(SAZ)
# Eq. 49 (FCFDG 1992) - the net effective wind speed
WSV <- sqrt(WSX * WSX + WSY * WSY)
WSV <- ifelse(FUELTYPE %in% c("NF", "WA"), NA, WSV)
# Eq. 50 (FCFDG 1992) - the net effective wind direction (radians)
RAZ <- acos(WSY / WSV)
# Eq. 51 (FCFDG 1992) - convert possible negative RAZ into more understandable
# directions
RAZ <- ifelse(WSX < 0, 2 * pi - RAZ, RAZ)
return(list(
WSV = WSV,
RAZ = RAZ
))
}
)
RAZ <- ifelse(FUELTYPE %in% c("NF", "WA"), NA, RAZ)
return(list(WSV = WSV,
RAZ = RAZ))
}

.Slopecalc <- function(
Expand Down

0 comments on commit 0d2ae9d

Please sign in to comment.