RatioRMS <- function(ens, ens.ref, obs, pval = TRUE) {

  #
  #  RMS ratio and its pvalue computation
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #
  
  
  dif1 <- rowMeans(ens, na.rm = TRUE) - obs
  dif2 <- rowMeans(ens.ref, na.rm = TRUE) - obs
  rms1 <- mean(dif1 ** 2, na.rm = TRUE) ** 0.5
  rms2 <- mean(dif2 ** 2, na.rm = TRUE) ** 0.5
  rms2[which(abs(rms2) <= (max(abs(rms2), na.rm = TRUE) / 1000))] <- max(
    abs(rms2), na.rm = TRUE) / 1000
  enlratiorms <- (rms1 / rms2)
  if (pval) {
    eno1 <- Eno(dif1, 1)
    eno2 <- Eno(dif2, 1)
    F <- (eno1 * (rms1) ** 2 / (eno1 - 1)) / (eno2 * (rms2) ** 2 / (eno2 - 1))
    F[which(F < 1)] <- 1 / F[which(F < 1)]
  
   
                      if (!is.na(eno1) && !is.na(eno2) && eno1 > 2 && eno2 > 2) {
                        p.val <- (1 - pf(F, 
                                   eno1 - 1, eno2 - 1)) * 2
                      
                      } 
  
  }
  
  # Output
  list(ratiorms = enlratiorms,p.val =p.val)
}
