HiDef-Aerial-Surveying / stochLAB

The stochastic collision risk model toolbox
https://hidef-aerial-surveying.github.io/stochLAB/
Other
6 stars 2 forks source link

Error due to NAs in RotationSpeed and RotationSpeedSD #18

Open JannisLi opened 2 years ago

JannisLi commented 2 years ago

Hi,

when i try to add new (customnized) specification for the windspeed x rotationspeed x pitchangle it seems that it does nto work with NAs. And they valeus need to be doubles (not chr) which might be obvious but could be highlighted in the documentation still.

Please finde the errors listed below

Cheers Jannis

Error due to NAs in RotationSpeed and RotationSpeedSD

trb_pars <- turb_pars_wide %>%
+   dplyr::select(TurbineModel:windSpeedSD ) %>%
+   dplyr::relocate(RotorSpeedAndPitch_SimOption, .after = 1) %>%
+   tidyr::pivot_longer(RotorRadius:windSpeedSD) %>%
+   dplyr::mutate(
+     par = dplyr::if_else(grepl("SD|sd|Sd", name), "sd", "mean"),
+     feature = gsub("(SD|sd|Sd)|(Mean|MEAN|mean)","", name)
+   ) %>%
+   dplyr::select(-name) %>%
+   tidyr::pivot_wider(names_from = par, values_from = value) %>%
+   tidyr::nest(pars = c(mean, sd)) %>%
+   tidyr::pivot_wider(names_from = feature, values_from = pars) %>%
+   dplyr::left_join(., trb_opr_pars)
Error in `stop_vctrs()`:
! Can't combine `RotorRadius` <double> and `RotationSpeedSD` <character>.
Run `rlang::last_error()` to see where the error occurred. 

# Error in `stop_vctrs()`:
! Can't combine `RotorRadius` <double> and `Pitch` <character>.
Run `rlang::last_error()` to see where the error occurred.

# Error in `val_df_columns()`:
! Parameter inputs can't hold missing values.
x Column `rtn_speed` in `rtn_pitch_windspd_dt` contains NAs.
Run `rlang::last_error()` to see where the error occurred.

# Error in findInterval(sampled_pars$wind_speed, rtn_pitch_windspd_dt$wind_speed) : 
'vec' must be sorted non-decreasingly and not contain NAs