Closed peterdesmet closed 2 years ago
It looks like this type of data can be uploaded to Movebank, as two fields:
roosting
, foraging
, running
Behavior was derived using acceleration data and an automated algorithm calibrated using field observations.
The data itself should then be linked to the position record.
@henkjanvdkolk
Update:
start-timestamp
in acceleration data (although some years or not fully covered).start-timestamp
s (8,021,727 records) then positions were recorded (4,829,950
)After talking with @sarahcd:
start-timestamp
) and make it harder for users to download that dataCode that was used to clean up the behaviour data, ending up with 6977784 records.
library(tidyverse)
library(here)
library(lubridate)
# Load behaviour data
beh <- read_csv("data/processed/O_VLIELAND/bird_ACC_2_v2.csv")
#> Rows: 7077471 Columns: 7
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): class_name
#> dbl (5): device_info_serial, longitude, latitude, altitude, gpsspeed
#> dttm (1): date_time
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
nrow(beh)
#> [1] 7077471
# Remove duplicate rows
beh <- beh %>% distinct(.keep_all = TRUE)
nrow(beh)
#> [1] 7038045
# Create standardized values and column names
beh <-
beh %>%
mutate(
`tag-id` = device_info_serial,
timestamp = paste0(str_replace(date_time, " ", "T"), "Z"),
timestamp_dttm = ymd_hms(timestamp),
`behaviour-classification` = tolower(class_name)
) %>%
select(`tag-id`, timestamp, timestamp_dttm, `behaviour-classification`)
# Load reference data and set future deploy-off-timestamp if NULL
ref <- read_csv("data/processed/O_VLIELAND/movebank_ref_data.csv")
#> Rows: 103 Columns: 25
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (13): animal-ring-id, animal-sex, animal-taxon, animal-life-stage, atta...
#> dbl (8): animal-id, animal-mass, deploy-on-latitude, deploy-on-longitude, ...
#> lgl (2): animal-comments, animal-nickname
#> dttm (2): deploy-off-timestamp, deploy-on-timestamp
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
ref <- ref %>%
mutate(`deploy-off-timestamp` = if_else(
is.na(`deploy-off-timestamp`),
as.POSIXct("2100-01-01T00:00:00Z", tz = "UTC"),
`deploy-off-timestamp`
))
# Join behaviour data with reference data
# Is initially going to increase number of records for tags associated with 2
# animals, but those will disappear when selecting on timestamp within session
beh_ref <- beh %>% left_join(ref, by = "tag-id")
beh_ref <- beh_ref %>% filter(
(timestamp_dttm >= `deploy-on-timestamp`) &
(timestamp_dttm <= `deploy-off-timestamp`)
)
nrow(beh_ref)
#> [1] 6977784
# Export data
beh_ref <- beh_ref %>% select(`tag-id`, `animal-id`, `timestamp`, `behaviour-classification`)
write_csv(beh_ref, here::here("data", "processed", "O_VLIELAND", "movebank_beh.csv"), na = "")
Behaviour data are now uploaded as Accessory Measurements
: https://www.movebank.org/cms/webapp?gwt_fragment=page=studies,path=study1605802367
From @henkjanvdkolk