• Non ci sono risultati.

Length of the depth data minus 30 data points

N/A
N/A
Protected

Academic year: 2022

Condividi "Length of the depth data minus 30 data points"

Copied!
3
0
0

Testo completo

(1)

Supplementary Appendix 1

####R code to fix the baseline of a TDR######

# Length of the depth data minus 30 data points. Dives were never over 120 seconds, so a conservative #cutoff of 180 seconds (6*30) was used to assess #baseline deviations length of the depth data minus 30 #data points

steps<-1:(length(data$depth)-30)

#A function to calculate mode mode <- function(j) {

unis <- unique(j)

unis[which.max(tabulate(match(j, unis)))]

}

#code to iterate through depth recordings and return them to the baseline.

for(i in (steps)){

#Find data where at least two thirds of the 30 recordings are below 0 and add the most

frequently #occurring number below zero (the current baseline) to all subsequent values. On all occasions of #testing this lead to a correct baseline change.

if (captureperiod$data[i] < 0 && length(which(captureperiod$data[i:(i+30)] < 0)) > 20){

captureperiod$depth[i:(length(steps)+30)]<-captureperiod$depth[i:(length(steps)+30)] - mode((captureperiod$depth[i:(i+30)])[captureperiod$depth[(i:(i+30))]< 0])

}

#detect deviations above 0 and add the minimum recorded value, which is the shifted

#downwards baseline.

else if (captureperiod$depth[i] > 0 && min(captureperiod$depth[i:(i+30)]) > 0){

captureperiod$depth[i:(length(steps)+30)]<-captureperiod$depth[i:(length(steps)+30)]

-min(captureperiod$depth[i:(i+30)]) }

(2)

else {NULL}

}

#Effectiveness of the code to fix the depth baseline may vary by device and species. For cases of more #frequent and sporadic baseline changes this code may be inappropriate. Always test the results against #the raw data to ensure validity of the method.

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~#

#####function to summarise dives#####

#dataday must be in POsiXt format; datadepth should be numeric and represent depth at a given time; #datastatus must be either "Dive" or "Surface"; rate should be the time in second between records; #temp is the recorded temperature at each dive and can be removed if unavailable by removing it from #divedata and the function arguments

divefunction <- function(dataday, datadepth, datastatus, rate, temp){

#sets up a data frame to receive dive information divedata <- data.frame(matrix(ncol = 7, nrow = 0))

colnames(divedata)<- c("divelength", "divemax", "divemaxtime", "enddivetime", "temp","desc",

"asc")

divedata$divelength <- as.numeric(divedata$divelength) divedata$divemax <- as.numeric(divedata$divemax)

divedata$divemaxtime <- as.numeric(divedata$divemaxtime) divedata$asc<-as.numeric(divedata$acs)

divedata$desc<-as.numeric(divedata$desc)

#numbers and objects to be used in the loop

(3)

numb <- 1 divetemp <- c()

#loop to calculate dive characteristics for (i in 1:length(datadepth)){

if (datastatus[i] == "Dive" && substr(dataday[i],0,10) == substr(dataday[i+1],0,10)){

divetemp <- c(divetemp, as.numeric(datadepth[i]))

divedata[numb,] <- c((as.numeric(length(divetemp))*rate), as.numeric(max(divetemp)),

as.numeric(length(divetemp[divetemp>max(divetemp)*0.75])*rate), dataday[i+1], temp[i],

divetemp[min(which(divetemp>max(divetemp)*0.75))]/

(min(which(divetemp>max(divetemp)*0.75))*6), divetemp[max(which(divetemp>max(divetemp)*0.75))]/

((length(divetemp)-max(which(divetemp>max(divetemp)*0.75)))*6)) }

else{

divetemp <- c()

numb <- ifelse(is.na(divedata[numb,1]), numb, numb+1)

} }

return(divedata) }

Riferimenti

Documenti correlati

 Funzionario del Ministero dell’Interno dal 22 ottobre 1990 al 16 luglio 2000 – servizio presso la Segreteria della Commissione di garanzia per l’attuazione della

amministrativo 8° livello presso IPSEMA

Altro (partecipazione a convegni, seminari, pubblicazioni, collaborazioni a riviste, ecc., ed ogni altra informazione che il dirigente ritiene di dover

Capacità linguistiche  Lingua - Inglese Livello parlato : scolastico Livello

 la registrazione dell’impegno di spesa di euro millesettecentosettantuno/50 a favore della Texmat di Nadia Gariazzo per l’acquisto dei testi sulla voce U.1.03.01.01.002 MP

76 del 16 luglio 2020 senza previa consultazione di due o più operatori economici per la fornitura di 3 cartucce EPSON T8651 per stampante EPSON WorkForce Pro WF-M5690 per il

01 produttività media (12.000 copie a trimestre) per la Sede di Cosenza, tutte con dispositivo opzionale fax CONVENZIONE CONSIP FOTOCOPIATRICI 28.. Lotto 2 (Multifunzione

Vista la determina n.13 del 16/03/2017 con la quale il Direttore Generale ha deliberato l’attribuzione delle risorse finanziarie per l’esercizio 2017 ai Dirigenti