Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CFFDRS R Bug]: Slopecalc.R Throwing NaNs, likely to be rejected by CRAN for this. #31

Open
2 tasks
BadgerOnABike opened this issue Dec 20, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@BadgerOnABike
Copy link
Collaborator

Contact Details

No response

What happened?

NaNs being thrown from

cffdrs_r/R/Slopecalc.r

Lines 95 to 105 in e4ae568

ISF <- ifelse(
FUELTYPE %in% c(
"C1", "C2", "C3", "C4", "C5", "C6", "C7", "D1", "S1", "S2", "S3"
),
ifelse(
(1 - (RSF / a[FUELTYPE])**(1 / c0[FUELTYPE])) >= 0.01,
log(1 - (RSF / a[FUELTYPE])**(1 / c0[FUELTYPE])) / (-b[FUELTYPE]),
log(0.01) / (-b[FUELTYPE])
),
ISF
)

It seems like the if else isn't being respected?

I'm pretty sure its because the Fueltype is being trimmed but the RSF isn't.

Any ideas @jordan-evens? I'll keep prodding.

Relevant log output

ISF <- ifelse(
     FUELTYPE %in% c(
       "C1", "C2", "C3", "C4", "C5", "C6", "C7", "D1", "S1", "S2", "S3"
     ),
     ifelse(
       (1 - (RSF / a[FUELTYPE])**(1 / c0[FUELTYPE])) >= 0.01,
       log(1 - (RSF / a[FUELTYPE])**(1 / c0[FUELTYPE])) / (-b[FUELTYPE]),
       log(0.01) / (-b[FUELTYPE])
     ),
     ISF
   )
Warning in log(1 - (RSF/a[FUELTYPE])^(1/c0[FUELTYPE])) : NaNs produced

Approvals Process

  • Testing For Issue
  • Merge
@BadgerOnABike BadgerOnABike added the bug Something isn't working label Dec 20, 2023
@BadgerOnABike
Copy link
Collaborator Author

ifelse(FUELTYPE %in% c("C1", "C2", "C3", "C4", "C5", "C6", "C7", "D1", "S1", "S2", "S3"), 
print(RSF), 
"what is happening")

 [1]   0.22117729 157.59492225   3.57139293  16.09203015   0.08928563   3.48303960   0.70153699   9.44993112   5.14183700   9.75228357   6.95070765  33.63871789  93.31758536   0.38545877   2.32371542
[16]  18.17252958   1.01076009   1.80172101   0.91589852   2.40384829

 [1] "0.221177292533175"  "157.594922253295"   "3.57139293408702"   "16.0920301545284"   "0.0892856266010389" "3.4830396007684"    "0.70153698952755"   "9.4499311236549"    "what is happening" 
[10] "what is happening"  "what is happening"  "what is happening"  "what is happening"  "what is happening"  "what is happening"  "18.1725295809577"   "1.01076009037511"   "1.80172101134922"  
[19] "0.915898523680011"  "2.40384828885359" 

FUELTYPE  [1] "C1"  "C2"  "C3"  "C4"  "C5"  "C6"  "C7"  "D1"  "M1"  "M2"  "M3"  "M4"  "O1A" "O1B" "O1B" "S1"  "S2"  "S3"  "C6"  "C6"

So what I would want, is for it to drop RSF values that are false in the condition and then have a "what is happening" for all the falsey conditions. yet i get all for both in both (with the falseys replaced in the false)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants