malaria_or_ticks <- function(data, var.list, ssp){
    
    # define thresholds:
    if (tolower(ssp) == 'p.falciparum'){
        thrs_tas <- c(18,32)
        thrs_prlr <- c(80, Inf)
        thrs_hurs <- c(60, Inf)
        var.thrs.list <- c('tas' = 'thrs_tas', 'prlr' = 'thrs_prlr', 'hurs' = 'thrs_hurs')
        # check in prepare_outputs that variables in names(var.list) are requested
    } else if (tolower(ssp) == 'p.vivax'){
        thrs_tas <- c(14.5,33)
        thrs_prlr <- c(80, Inf)
        thrs_hurs <- c(60, Inf)
        var.thrs.list <- c('tas' = 'thrs_tas', 'prlr' = 'thrs_prlr', 'hurs' = 'thrs_hurs')
        # check in prepare_outputs that variables in names(var.list) are requested
    } else if (tolower(ssp) == 'i.ricinus'){
        thrs_tas <- c(10,26)
        thrs_hurs <- c(45, Inf)
        var.thrs.list <- c('tas' = 'thrs_tas', 'hurs' = 'thrs_hurs')
        # check in prepare_outputs that variables in names(var.list) are requested
    } else {
        var.thrs.list <- c() # no variables to comply thresholds
    }

    # obtain climatic suitability for obs, hcst and fcst (or elements of "data")
    result <- data
    for (ll in names(result)){
        data_element <- data[[ll]]
        if (!is.null(data_element)){
            # prepare data
            tas <- data_format_csindicators(data_element, vars = c('tas'), var.list =var.list,
                                                lat = data_element$coords$latitude,
                                                lon = data_element$coords$longitude,
                                                dates = data_element$attrs$Dates)[[1]]

            if ('hurs' %in% var.list){
                hurs <- data_format_csindicators(data_element, vars = c('hurs'), var.list = var.list,
                                                lat = data_element$coords$latitude,
                                                lon = data_element$coords$longitude,
                                                dates = data_element$attrs$Dates)[[1]]
            } else {
                tdps <- data_format_csindicators(data_element, vars = c('tdps'), var.list = var.list,
                                                lat = data_element$coords$latitude,
                                                lon = data_element$coords$longitude,
                                                dates = data_element$attrs$Dates)[[1]]
                hurs <- data_transform_hurs(tas, tdps)
            }
            if ('prlr' %in% var.list){
                prlr <- data_format_csindicators(data_element, vars = c('prlr'), var.list = var.list,
                                                lat = data_element$coords$latitude,
                                                lon = data_element$coords$longitude,
                                                dates = data_element$attrs$Dates)[[1]]
            }

            # create result object
            if (length(var.thrs.list > 0)){
                result_element <- eval(parse(text = names(var.thrs.list)[1])) # tas
                result_element$attrs$Units <- NULL
                result_element$data[which(!is.na(result_element$data))] <- 1
            } else {
                result_element <- NULL
            }

            # apply threholds
            if (length(var.thrs.list > 0)){
                for (var in names(var.thrs.list)){
                    thrs <- eval(parse(text = var.thrs.list[which(names(var.thrs.list) == var)]))
                    var.data <- eval(parse(text = var))
                    new.data <- array(0, dim = dim(result_element$data))
                    new.data[which(var.data$data >= thrs[1] & var.data$data <= thrs[2])] <- 1
                    result_element$data <- result_element$data * new.data
                    result_element$metadata <- append(result_element$metadata, paste0(var, ' suitability threshold: ', thrs[1], ' to ', thrs[2], ' (', var.data$attrs$Units, ')'))
                }
            }
        } # end "if (!is.null...)"
        result[[ll]] <- result_element
    } # end "for"
    return(result)
}