Closed geanders closed 8 years ago
Got it! The IDHeatwaves
now uses a do.call
to direct to the desired function to ID heatwaves. I made a wrapper function for the C++ function (IDHeatwavesCPPwrapper
), so now to call the C++ function, you would just specify IDheatwavesReplacement = "IDHeatwavesCPPwrapper"
in the gen_hw_set
function. That means we don't need the RorCPP
specification anymore, so I took that out. The default for the IDheatwavesReplacement
is currently the "IDHeatwavesR" function. Once we get the C++ function de-bugged, we could use that as the default. As a note, the function name needs to be in quotation marks for the IDheatwavesReplacement
argument.
I think that there are a couple problems with getting it to work right now:
custom["IDheatwaves"] == TRUE
inIDheatwaves
won't work. If you didn't put a custom heatwave definition in here, it would be fine, because it would keep the default FALSE. However, if you did put a custom definition in, R would not evaluate this statement as now being TRUE. We'll need to fix this logic once figure out how to pass the custom function through. That leads to...custom
converts it to a list, so it can't evaluate as a function. There may be a way to then useas.function
to pull it back into a function form. If not, we will probably want to go more the route of usingdo.call
within this part ofIDheatwaves
and just passing the name of the function, rather than the full function, through incustom
.