R/EagleWizard.R

#' @title Eagle Model Wizard (deprecated)
#' @author Joe Statwick (Arcadis)
#'
#' @description This function is a wizard for inputting data into the USFWS Eagle fatality models. Start here if you don't code. Deprecated. Use EagleModelGUI() or EagleModel() instead.
#' @export

EagleWizard<-function(){
  cProject<-readline(prompt = "What is the name of this project? ")
  Name<-readline(prompt = "What is your name? ")
  strata<-readline(prompt = "Would you like to perform separate estimates for different strata (seasons)? ")
  if(strata == "yes" || strata == "y"){
    stop("Please use EagleModel() manually; EagleWizard() does not yet support multiple strata.", silent = TRUE)}
  nTurbine<-as.numeric(readline(prompt = "Enter the number of turbines at this site: "))
  HazRadKm<-(as.numeric(readline(prompt = "Enter the blade diameter (meters) of a single turbine: "))/2/1000)
  HzKM2<-(nTurbine*pi*HazRadKm^2)
  Oprate<-as.numeric(readline(prompt = "Enter the annual operative rate of turbines at this site (just hit enter if you don't know): "))
  if(is.na(Oprate)){Oprate<-1}
  hours<-readline(prompt = "Do you know the annual number of daylight hours at your location? ")
  if(hours == "yes" || hours == "y"){
    DayLtHr<-as.numeric(readline(prompt = "Enter the annual number of daylight hours at your location: "))
  } else {
    Lng<-as.numeric(readline(prompt = "Enter the longitude at your location: "))
    Lat<-as.numeric(readline(prompt = "Enter the latitude at your location: "))
    DayLtHr<-DayLen(Lng,Lat)
    cat("Your annual daylight hours are", DayLtHr)
  }
  precon<-readline(prompt = "Were pre-construction eagle use surveys conducted? ")
  if(precon == "yes" || precon == "y"){
    CntHr<-(as.numeric(readline(prompt = "Enter the duration (minutes) of each pre-construction eagle use survey: "))/60)
    CntKM2<-pi*(as.numeric(readline(prompt = "Enter the radius (meters) of each pre-construction eagle use survey plot: "))/1000)^2
    EMin<-as.numeric(readline(prompt = "Enter the total number of eagle-minutes observed: "))
    nCnt<-as.numeric(readline(prompt = "Enter the total number of pre-construction surveys: "))
  } else {
    CntHr<-0
    CntKM2<-0
    Emin<- -1
    nCnt<-0
  }
  postcon<-readline(prompt = "Was post-construction mortality monitoring conducted? ")
  if(postcon == "yes" || postcon == "y"){
    carcasses<-as.numeric(readline(prompt = "Enter the total number of eagle carcasses observed: "))
    PCMMSurveys<-as.numeric(readline(prompt = "Enter the number of turbines surveyed during each survey (can be non-integer if turbines incompletely surveyed): "))
    FatEfficiency<-as.numeric(readline(prompt = "Enter the searcher efficiency rate for large birds (just hit enter if you don't know): "))
    if(is.na(FatEfficiency)){FatEfficiency<-1}
    FatRemoval<-as.numeric(readline(prompt = "Enter the carcass persistance rate for large birds at the search interval (just hit enter if you don't know): "))
    if(is.na(FatRemoval)){FatRemoval<-0.82}
    EOutMin<-FatEst(carcasses, FatEfficiency, FatRemoval)
    turbineKM2<-pi*(HazRadKm)^2 #hazardous area of one turbine
    PCMMhrs<-as.numeric(readline(prompt = "Enter the total number of daylight hours covered by the PCMM surveys: "))
    if(is.na(PCMMhrs)){
      stop("Please use DayLen() to manually calculate the number of daylight hours covered by PCMM surveys")
    }
    CprHrKM2<-(PCMMSurveys*PCMMhrs)*turbineKM2*Oprate
  } else {
    EOutMin<- -1
    CprHrKM2<-0
  }
  ExpSvy<-data.frame(
    row.names=c("Annual"),
    EMin=EMin,
    nCnt=nCnt,
    CntKM2=CntKM2,
    DayLtHr=DayLtHr)

  priors<-readline(prompt = "Would you like to use the default collision priors? ")
    if(hours == "yes" || hours == "y"){
      EagleModel(cProject=cProject, Name=Name, nTurbine=nTurbine, HzKM2=HzKM2, CntHr=CntHr, EOutMin=EOutMin, CprHrKM2=CprHrKM2, ExpSvy=ExpSvy)
    } else {
      CPrPriors<-readline(prompt = 'Would you like to use "Bay" priors or "custom" priors? ')
      if(CPrPriors == "Bay"){
        EagleModel(cProject=cProject, Name=Name, nTurbine=nTurbine, HzKM2=HzKM2, CntHr=CntHr, EOutMin=EOutMin, CprHrKM2=CprHrKM2, ExpSvy=ExpSvy, CPrPriors=CPrPriors)
      } else {
        aPriCPr<-as.numeric(readline(prompt = "Enter your alpha collision prior: "))
        bPriCPr<-as.numeric(readline(prompt = "Enter your beta collision prior: "))
        EagleModel(cProject=cProject, Name=Name, nTurbine=nTurbine, HzKM2=HzKM2, CntHr=CntHr, EOutMin=EOutMin, CprHrKM2=CprHrKM2, ExpSvy=ExpSvy, CPrPriors="USFWS", aPriCPr=aPriCPr, bPriCPr=bPriCPr)
      }
    }
}
josephstatwick/EagleModelCalc documentation built on May 16, 2019, 4:55 p.m.