The credentials of the user are stored using the keyring
package. With the following command a user can be added to the keyring.
Run this line once, it will store your credentials in keyring. After
that every time you load move2
and execute a download
function from movebank, these functions will retrieve your credentials
from keyring.
movebank_store_credentials("myUserName", "myPassword")
movebank_remove_credentials()
#> There is 1 key removed from the keyring.
The keyring
package can use several mechanisms to store
credentials, these are called backends. Some of these backends are
operating system dependent, others are more general. Some of the
operating systems dependent backends have the advantage that they do not
require providing credentials when opening a new R session.
The move2
package uses the default backend as is
returned by keyring::default_backend()
, this function thus
shows the backend move2
is using. If you want to change the
default you can use the keyring_backend
option, for more
details see the documentation in the keyring package.
macOS and Windows generally do not
require entering an extra password for keyring. The default in
Linux is often the file
backend which can
be confusing as it creates an encrypted file with credentials that need
a password to unlock. In this case a separate password for the keyring
file has to be entered for each new R session before the movebank
password can be accessed. To avoid having to enter each time a keyring
password the Secret Service API can be used by installing the
libsecret
library. (Debian/Ubuntu:
libsecret-1-dev
; Recent RedHat, Fedora and CentOS systems:
libsecret-devel
)
key_name
If you have multiple user accounts on movebank, the easiest way is to
give each of them a key name with the argument key_name
.
For the most used account also the default option can be used. The
movebank_store_credentials()
only has to be executed once
for each account. After that the credentials will be retrieved from
keyring.
## store credentials for the most used account.
movebank_store_credentials("myUserName", "myPassword")
## store credentials for another movebank account
movebank_store_credentials("myUserName_2", "myPassword_2", key_name = "myOtherAccount")
When you want to download from Movebank using your default movebank account, nothing has to be specified before the download functions. If you want to download from Movebank with another account, than you should execute the line below, specifying the key name of the account to use, before the download functions are executed.
options("move2_movebank_key_name" = "myOtherAccount")
If in one script/Rsession you are using several accounts, to use the credentials of the default account execute the line below:
options("move2_movebank_key_name" = "movebank")
To check which accounts are stored in keyring:
keyring::key_list()
# service username
# 1 movebank myUserName
# 2 myOtherAccount myUserName_2
The service
column corresponds to the names provided in
key_name
. The account entered without a key name (the
default) will be called movebank
. Note that the key names
have to be unique, if there are several usernames with the same key name
(service), it will cause an error.
To deleted credentials from keyring:
## for the default account
movebank_remove_credentials()
#> There is 1 key removed from the keyring.
## for an account with a key name
movebank_remove_credentials(key_name = "myOtherAccount")
#> There is 1 key removed from the keyring.
Next we can check if the keys are successfully removed:
keyring::key_list()
Here you can check if the movebank
service is
successfully removed.
Using the function movebank_download_study_info
it is
possible to download information for all studies, for all studies that
have certain property or for a single study. Any column of the table can
be used to download only the information of the studies that comply with
the selected property. This table contains all the information that can
be seen on the “Study page” on the Movebank webpage, plus additional
information about download rights and ownership.
NOTE: due to incorrect timestamps in some Movebank studies, the
function movebank_download_study_info()
sometimes returns a
Warning message as the one in the example below. You can ignore
this (see issue #17).
movebank_download_study_info()
#> Warning: `vroom()` finds reading problems with the movebank specification.
#> ℹ This might relate to the returned data not fitting the expectation of the
#> movebank data format specified in the package.
#> ℹ For retrieving the specific problem you can enable `global_entrace` using
#> `rlang::global_entrace()` then run the command and use
#> `rlang::last_warnings()[[1]]$problems` to retrieve the problems.
#> ℹ The requested url can then be retrieved with:
#> `rlang::last_warnings()[[1]]$url`
#> ℹ Alternatively in some cases you might be able to retrieve the problems
#> calling `vroom::problems()` on the result of the function call that produced
#> the warning.
#> # A tibble: 7,136 × 31
#> acknowledgements citation go_public_date grants_used has_quota
#> <chr> <chr> <dttm> <chr> <lgl>
#> 1 NA NA NA NA TRUE
#> 2 NA NA NA NA TRUE
#> 3 "Supported by the Max-Pla… NA NA NA TRUE
#> 4 NA NA NA NA TRUE
#> 5 "Graduate students in the… MCKINNO… NA "Natural Scienc… TRUE
#> 6 NA NA NA NA TRUE
#> 7 "Universidad Estatal de S… NA NA "Comisión Feder… TRUE
#> 8 NA NA NA NA TRUE
#> 9 NA NA NA NA TRUE
#> 10 NA NA NA NA TRUE
#> # ℹ 7,126 more rows
#> # ℹ 26 more variables: i_am_owner <lgl>, id <int64>, is_test <lgl>,
#> # license_terms <chr>, license_type <fct>, name <fct>,
#> # number_of_individuals [count], number_of_tags [count],
#> # principal_investigator_address <chr>, principal_investigator_email <chr>,
#> # principal_investigator_name <chr>, study_objective <chr>, study_type <fct>,
#> # suspend_license_terms <lgl>, i_can_see_data <lgl>, …
movebank_download_study_info(i_have_download_access = TRUE)
movebank_download_study_info(i_am_owner = TRUE)
movebank_download_study_info(license_type = "CC_0")
movebank_download_study_info(id = 2911040)
The function movebank_download_deployment
downloads a
table with the associated information to individuals, tags and
deployments. This table reassembles the “Reference Data” table that can
be downloaded from the Movebank webpage.
movebank_download_deployment("Galapagos Albatrosses")
#> # A tibble: 28 × 26
#> deployment_id tag_id individual_id animal_life_stage attachment_type
#> <int64> <int64> <int64> <fct> <fct>
#> 1 2911170 2911124 2911090 adult tape
#> 2 2911150 2911126 2911091 adult tape
#> 3 2911167 2911127 2911092 adult tape
#> 4 2911168 2911129 2911093 adult tape
#> 5 2911178 2911132 2911094 adult tape
#> 6 2911163 2911133 2911095 adult tape
#> 7 9472225 2911114 2911061 adult tape
#> 8 9472224 2911120 2911062 adult tape
#> 9 9472223 2911121 2911086 adult tape
#> 10 9472222 2911134 2911065 adult tape
#> # ℹ 18 more rows
#> # ℹ 21 more variables: deployment_comments <chr>, deploy_on_timestamp <dttm>,
#> # duty_cycle <chr>, deployment_local_identifier <fct>,
#> # manipulation_type <fct>, study_site <chr>, tag_readout_method <fct>,
#> # sensor_type_ids <chr>, capture_location <POINT [°]>,
#> # deploy_on_location <POINT [°]>, deploy_off_location <POINT [°]>,
#> # individual_comments <chr>, individual_local_identifier <fct>, …
With the function movebank_download_study
the complete
study from Movebank can be downloaded. There are many options to
download a subset of the complete study. The study_id
can
either be specified either as an integer
or
character
with respectively the id or name of the
study.
To get the study ID of a Movebank study use
movebank_get_study_id
movebank_get_study_id(study_id = "Galapagos Albatrosses")
#> integer64
#> [1] 2911040
movebank_download_study_info(study_id = 2911040)$sensor_type_ids
#> [1] "GPS,Acceleration"
movebank_download_study(
study_id = 2911040,
sensor_type_id = c("gps", "acceleration")
)
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 28 tracks lasting on average 37.1 days in a
#> Simple feature collection with 114929 features and 21 fields (with 98901 geometries empty)
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -91.3732 ymin: -12.79464 xmax: -77.51874 ymax: 0.1821983
#> Geodetic CRS: WGS 84
#> # A tibble: 114,929 × 22
#> sensor_type_id individual_local_identifier eobs_battery_voltage
#> <int64> <fct> [mV]
#> 1 653 4264-84830852 3686
#> 2 653 4264-84830852 3701
#> 3 653 4264-84830852 3701
#> 4 653 4264-84830852 3691
#> 5 653 4264-84830852 3691
#> 6 653 4264-84830852 3696
#> 7 653 4264-84830852 3696
#> 8 653 4264-84830852 3691
#> 9 653 4264-84830852 3693
#> 10 653 4264-84830852 3696
#> # ℹ 114,919 more rows
#> # ℹ 19 more variables: eobs_fix_battery_voltage [mV],
#> # eobs_horizontal_accuracy_estimate [m], eobs_key_bin_checksum <int64>,
#> # eobs_speed_accuracy_estimate [m/s], eobs_start_timestamp <dttm>,
#> # eobs_status <ord>, eobs_temperature [°C], eobs_type_of_fix <fct>,
#> # eobs_used_time_to_get_fix [s], ground_speed [m/s], heading [°],
#> # height_above_ellipsoid [m], timestamp <dttm>, visible <lgl>, …
#> First 10 track features:
#> # A tibble: 28 × 52
#> deployment_id tag_id individual_id animal_life_stage attachment_type
#> <int64> <int64> <int64> <fct> <fct>
#> 1 2911170 2911124 2911090 adult tape
#> 2 2911150 2911126 2911091 adult tape
#> 3 2911167 2911127 2911092 adult tape
#> 4 2911168 2911129 2911093 adult tape
#> 5 2911178 2911132 2911094 adult tape
#> 6 2911163 2911133 2911095 adult tape
#> 7 9472225 2911114 2911061 adult tape
#> 8 9472224 2911120 2911062 adult tape
#> 9 9472223 2911121 2911086 adult tape
#> 10 9472222 2911134 2911065 adult tape
#> # ℹ 18 more rows
#> # ℹ 47 more variables: deployment_comments <chr>, deploy_on_timestamp <dttm>,
#> # duty_cycle <chr>, deployment_local_identifier <fct>,
#> # manipulation_type <fct>, study_site <chr>, tag_readout_method <fct>,
#> # sensor_type_ids <chr>, capture_location <POINT [°]>,
#> # deploy_on_location <POINT [°]>, deploy_off_location <POINT [°]>,
#> # individual_comments <chr>, individual_local_identifier <fct>, …
movebank_download_study(
study_id = "Galapagos Albatrosses",
sensor_type_id = "gps",
individual_local_identifier = "unbanded-160"
)
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 1 track lasting 13.3 days in a
#> Simple feature collection with 213 features and 18 fields (with 4 geometries empty)
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -81.20167 ymin: -1.829105 xmax: -80.93177 ymax: -1.11206
#> Geodetic CRS: WGS 84
#> # A tibble: 213 × 19
#> sensor_type_id individual_local_identifier eobs_battery_voltage
#> <int64> <fct> [mV]
#> 1 653 unbanded-160 3754
#> 2 653 unbanded-160 3701
#> 3 653 unbanded-160 3754
#> 4 653 unbanded-160 3759
#> 5 653 unbanded-160 3732
#> 6 653 unbanded-160 3750
#> 7 653 unbanded-160 3750
#> 8 653 unbanded-160 3752
#> 9 653 unbanded-160 3752
#> 10 653 unbanded-160 3754
#> # ℹ 203 more rows
#> # ℹ 16 more variables: eobs_fix_battery_voltage [mV],
#> # eobs_horizontal_accuracy_estimate [m], eobs_key_bin_checksum <int64>,
#> # eobs_speed_accuracy_estimate [m/s], eobs_start_timestamp <dttm>,
#> # eobs_status <ord>, eobs_temperature [°C], eobs_type_of_fix <fct>,
#> # eobs_used_time_to_get_fix [s], ground_speed [m/s], heading [°],
#> # height_above_ellipsoid [m], timestamp <dttm>, visible <lgl>, …
#> Track features:
#> # A tibble: 1 × 52
#> deployment_id tag_id individual_id animal_life_stage attachment_type
#> <int64> <int64> <int64> <fct> <fct>
#> 1 2911163 2911133 2911095 adult tape
#> # ℹ 47 more variables: deployment_comments <chr>, deploy_on_timestamp <dttm>,
#> # duty_cycle <chr>, deployment_local_identifier <fct>,
#> # manipulation_type <fct>, study_site <chr>, tag_readout_method <fct>,
#> # sensor_type_ids <chr>, capture_location <POINT [°]>,
#> # deploy_on_location <POINT [°]>, deploy_off_location <POINT [°]>,
#> # individual_comments <chr>, individual_local_identifier <fct>,
#> # taxon_canonical_name <fct>, individual_number_of_deployments <int>, …
movebank_download_study(
study_id = 2911040,
sensor_type_id = "gps",
individual_local_identifier = c("1094-1094", "1103-1103")
)
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 2 tracks lasting on average 10.3 days in a
#> Simple feature collection with 289 features and 18 fields (with 59 geometries empty)
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -89.96382 ymin: -1.502011 xmax: -89.59216 ymax: -0.7981921
#> Geodetic CRS: WGS 84
#> # A tibble: 289 × 19
#> sensor_type_id individual_local_identifier eobs_battery_voltage
#> <int64> <fct> [mV]
#> 1 653 1103-1103 3671
#> 2 653 1103-1103 3615
#> 3 653 1103-1103 3662
#> 4 653 1103-1103 3662
#> 5 653 1103-1103 3662
#> 6 653 1103-1103 3662
#> 7 653 1103-1103 3671
#> 8 653 1103-1103 3666
#> 9 653 1103-1103 3666
#> 10 653 1103-1103 3663
#> # ℹ 279 more rows
#> # ℹ 16 more variables: eobs_fix_battery_voltage [mV],
#> # eobs_horizontal_accuracy_estimate [m], eobs_key_bin_checksum <int64>,
#> # eobs_speed_accuracy_estimate [m/s], eobs_start_timestamp <dttm>,
#> # eobs_status <ord>, eobs_temperature [°C], eobs_type_of_fix <fct>,
#> # eobs_used_time_to_get_fix [s], ground_speed [m/s], heading [°],
#> # height_above_ellipsoid [m], timestamp <dttm>, visible <lgl>, …
#> Track features:
#> # A tibble: 2 × 52
#> deployment_id tag_id individual_id animal_life_stage attachment_type
#> <int64> <int64> <int64> <fct> <fct>
#> 1 9472225 2911114 2911061 adult tape
#> 2 9472212 2911119 2911080 adult tape
#> # ℹ 47 more variables: deployment_comments <chr>, deploy_on_timestamp <dttm>,
#> # duty_cycle <chr>, deployment_local_identifier <fct>,
#> # manipulation_type <fct>, study_site <chr>, tag_readout_method <fct>,
#> # sensor_type_ids <chr>, capture_location <POINT [°]>,
#> # deploy_on_location <POINT [°]>, deploy_off_location <POINT [°]>,
#> # individual_comments <chr>, individual_local_identifier <fct>,
#> # taxon_canonical_name <fct>, individual_number_of_deployments <int>, …
## it is also possible to use the numerical identifiers
movebank_download_study(
study_id = 2911040,
sensor_type_id = "gps",
individual_id = c(2911086, 2911065)
)
movebank_download_study(2911040,
sensor_type_id = "acceleration",
individual_local_identifier = "1094-1094"
)
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 1 track lasting 3.05 days in a
#> Simple feature collection with 291 features and 10 fields (with 291 geometries empty)
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
#> Geodetic CRS: WGS 84
#> # A tibble: 291 × 11
#> sensor_type_id individual_local_identifier eobs_acceleration_axes
#> <int64> <fct> <fct>
#> 1 2365683 1094-1094 XY
#> 2 2365683 1094-1094 XY
#> 3 2365683 1094-1094 XY
#> 4 2365683 1094-1094 XY
#> 5 2365683 1094-1094 XY
#> 6 2365683 1094-1094 XY
#> 7 2365683 1094-1094 XY
#> 8 2365683 1094-1094 XY
#> 9 2365683 1094-1094 XY
#> 10 2365683 1094-1094 XY
#> # ℹ 281 more rows
#> # ℹ 8 more variables: eobs_acceleration_sampling_frequency_per_axis [Hz],
#> # eobs_accelerations_raw <chr>, eobs_key_bin_checksum <int64>,
#> # eobs_start_timestamp <dttm>, timestamp <dttm>, visible <lgl>,
#> # event_id <int64>, geometry <POINT [°]>
#> Track features:
#> # A tibble: 1 × 52
#> deployment_id tag_id individual_id animal_life_stage attachment_type
#> <int64> <int64> <int64> <fct> <fct>
#> 1 9472212 2911119 2911080 adult tape
#> # ℹ 47 more variables: deployment_comments <chr>, deploy_on_timestamp <dttm>,
#> # duty_cycle <chr>, deployment_local_identifier <fct>,
#> # manipulation_type <fct>, study_site <chr>, tag_readout_method <fct>,
#> # sensor_type_ids <chr>, capture_location <POINT [°]>,
#> # deploy_on_location <POINT [°]>, deploy_off_location <POINT [°]>,
#> # individual_comments <chr>, individual_local_identifier <fct>,
#> # taxon_canonical_name <fct>, individual_number_of_deployments <int>, …
Note that the sensor_type_id
can either be specified
either as an integer
or character
with
respectively the ‘id’ or ‘external_id’ of the sensor. Here is how you
get the correspondence table of sensor name and id:
movebank_retrieve(entity_type = "tag_type")
#> # A tibble: 23 × 5
#> description external_id id is_location_sensor name
#> <chr> <chr> <int64> <lgl> <fct>
#> 1 NA bird-ring 397 TRUE Bird Ring
#> 2 NA gps 653 TRUE GPS
#> 3 NA radio-transmitter 673 TRUE Radio Transmi…
#> 4 NA argos-doppler-shift 82798 TRUE Argos Doppler…
#> 5 NA natural-mark 2365682 TRUE Natural Mark
#> 6 NA acceleration 2365683 FALSE Acceleration
#> 7 NA solar-geolocator 3886361 TRUE Solar Geoloca…
#> 8 NA accessory-measurements 7842954 FALSE Accessory Mea…
#> 9 NA solar-geolocator-raw 9301403 FALSE Solar Geoloca…
#> 10 NA barometer 77740391 FALSE Barometer
#> # ℹ 13 more rows
timestamp_*
arguments can either be formatted as a
POSIXct
timestamp, Date
or a character string
(e.g. "20080604133046000"
(yyyyMMddHHmmssSSS)). The
timestamp_*
arguments can also be used separately.
movebank_download_study(2911040,
sensor_type_id = "gps",
timestamp_start = as.POSIXct("2008-08-01 00:00:00"),
timestamp_end = as.POSIXct("2008-08-02 00:00:00")
)
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 9 tracks lasting on average 22.5 hours in a
#> Simple feature collection with 144 features and 18 fields (with 4 geometries empty)
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -90.0103 ymin: -5.245627 xmax: -80.94916 ymax: -0.6785461
#> Geodetic CRS: WGS 84
#> # A tibble: 144 × 19
#> sensor_type_id individual_local_identifier eobs_battery_voltage
#> <int64> <fct> [mV]
#> 1 653 4266-84831108 3754
#> 2 653 4266-84831108 3754
#> 3 653 4266-84831108 3759
#> 4 653 4266-84831108 3759
#> 5 653 4266-84831108 3759
#> 6 653 4266-84831108 3754
#> 7 653 4266-84831108 3756
#> 8 653 4266-84831108 3754
#> 9 653 4266-84831108 3754
#> 10 653 4266-84831108 3752
#> # ℹ 134 more rows
#> # ℹ 16 more variables: eobs_fix_battery_voltage [mV],
#> # eobs_horizontal_accuracy_estimate [m], eobs_key_bin_checksum <int64>,
#> # eobs_speed_accuracy_estimate [m/s], eobs_start_timestamp <dttm>,
#> # eobs_status <ord>, eobs_temperature [°C], eobs_type_of_fix <fct>,
#> # eobs_used_time_to_get_fix [s], ground_speed [m/s], heading [°],
#> # height_above_ellipsoid [m], timestamp <dttm>, visible <lgl>, …
#> Track features:
#> # A tibble: 9 × 52
#> deployment_id tag_id individual_id animal_life_stage attachment_type
#> <int64> <int64> <int64> <fct> <fct>
#> 1 2911150 2911126 2911091 adult tape
#> 2 2911167 2911127 2911092 adult tape
#> 3 2911168 2911129 2911093 adult tape
#> 4 2911178 2911132 2911094 adult tape
#> 5 9472222 2911134 2911065 adult tape
#> 6 9472220 2911111 2911067 adult tape
#> 7 9472218 2911109 2911060 adult tape
#> 8 9472214 2911130 2911066 adult tape
#> 9 9472208 2911108 2911074 adult tape
#> # ℹ 47 more variables: deployment_comments <chr>, deploy_on_timestamp <dttm>,
#> # duty_cycle <chr>, deployment_local_identifier <fct>,
#> # manipulation_type <fct>, study_site <chr>, tag_readout_method <fct>,
#> # sensor_type_ids <chr>, capture_location <POINT [°]>,
#> # deploy_on_location <POINT [°]>, deploy_off_location <POINT [°]>,
#> # individual_comments <chr>, individual_local_identifier <fct>,
#> # taxon_canonical_name <fct>, individual_number_of_deployments <int>, …
attributes = NULL
can be used as it reduces the
columns to download to the bare minimum. All individual attributes are
downloaded as this does not take much time. Note that this option should
only be used when downloading location data (by specifying the sensor),
as only timestamps, location and track id is downloaded.
movebank_download_study(1259686571, sensor_type_id = 653, attributes = NULL)
#> ℹ In total 299490 records were omitted as they were not deployed (the
#> `deployment_id` was `NA`).
#> A <move2> with `track_id_column` "deployment_id" and `time_column` "timestamp"
#> Containing 92 tracks lasting on average 156 days in a
#> Simple feature collection with 867718 features and 2 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -9.097052 ymin: 34.82506 xmax: 10.34339 ymax: 52.88891
#> Geodetic CRS: WGS 84
#> # A tibble: 867,718 × 3
#> deployment_id timestamp geometry
#> <int64> <dttm> <POINT [°]>
#> 1 3029108353 2021-08-19 21:16:35 (2.84631 51.19662)
#> 2 3029108353 2021-08-20 09:16:35 (2.846492 51.19654)
#> 3 3029108353 2021-08-20 21:16:29 (2.847637 51.20317)
#> 4 3029108353 2021-08-21 09:16:35 (2.849055 51.20314)
#> 5 3029108353 2021-08-21 21:16:35 (2.846533 51.2034)
#> 6 3029108353 2021-08-21 21:36:03 (2.846752 51.20317)
#> 7 3029108353 2021-08-21 21:56:03 (2.847032 51.20299)
#> 8 3029108353 2021-08-21 22:16:04 (2.847138 51.20277)
#> 9 3029108353 2021-08-21 22:36:03 (2.846965 51.20244)
#> 10 3029108353 2021-08-21 22:56:06 (2.847517 51.20273)
#> # ℹ 867,708 more rows
#> First 10 track features:
#> # A tibble: 92 × 56
#> deployment_id tag_id individual_id alt_project_id animal_life_stage
#> <int64> <int64> <int64> <fct> <fct>
#> 1 3029108356 3029107937 3029107890 LBBG_JUVENILE juvenile
#> 2 3029108353 3029107972 3029107816 LBBG_JUVENILE juvenile
#> 3 3029108347 3029107959 3029107819 LBBG_JUVENILE juvenile
#> 4 3029108346 3029107996 3029107822 LBBG_JUVENILE juvenile
#> 5 3029108345 3029107925 3029107891 LBBG_JUVENILE juvenile
#> 6 3029108344 3029107921 3029107854 LBBG_JUVENILE juvenile
#> 7 3029108343 3029107965 3029107826 LBBG_JUVENILE juvenile
#> 8 3029108341 3029107980 3029107842 LBBG_JUVENILE juvenile
#> 9 3029108338 3029107976 3029107847 LBBG_JUVENILE juvenile
#> 10 3029108337 3029107960 3029107844 LBBG_JUVENILE juvenile
#> # ℹ 82 more rows
#> # ℹ 51 more variables: animal_mass [g], attachment_type <fct>,
#> # deployment_comments <chr>, deploy_off_timestamp <dttm>,
#> # deploy_on_timestamp <dttm>, deployment_end_type <fct>,
#> # manipulation_type <fct>, study_site <chr>, tag_readout_method <fct>,
#> # sensor_type_ids <chr>, capture_location <POINT [°]>,
#> # deploy_on_location <POINT [°]>, deploy_off_location <POINT [°]>, …
## get all attributes available for a specific study and sensor
movebank_retrieve(
entity_type = "study_attribute",
study_id = 2911040,
sensor_type_id = "gps"
)$short_name
#> [1] "eobs_battery_voltage" "eobs_fix_battery_voltage"
#> [3] "eobs_horizontal_accuracy_estimate" "eobs_key_bin_checksum"
#> [5] "eobs_speed_accuracy_estimate" "eobs_start_timestamp"
#> [7] "eobs_status" "eobs_temperature"
#> [9] "eobs_type_of_fix" "eobs_used_time_to_get_fix"
#> [11] "ground_speed" "heading"
#> [13] "height_above_ellipsoid" "location_lat"
#> [15] "location_long" "timestamp"
#> [17] "update_ts" "visible"
movebank_download_study(
study_id = 2911040,
sensor_type_id = "gps",
attributes = c("height_above_ellipsoid", "eobs_temperature")
)
#> A <move2> with `track_id_column` "deployment_id" and `time_column` "timestamp"
#> Containing 28 tracks lasting on average 37.1 days in a
#> Simple feature collection with 16414 features and 4 fields (with 386 geometries empty)
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -91.3732 ymin: -12.79464 xmax: -77.51874 ymax: 0.1821983
#> Geodetic CRS: WGS 84
#> # A tibble: 16,414 × 5
#> height_above_ellipsoid eobs_temperature deployment_id timestamp
#> [m] [°C] <int64> <dttm>
#> 1 16.5 12 9472219 2008-05-31 13:30:02
#> 2 12.6 19 9472219 2008-05-31 15:00:44
#> 3 17.4 24 9472219 2008-05-31 16:30:39
#> 4 24.8 18 9472219 2008-05-31 18:00:49
#> 5 19 22 9472219 2008-05-31 19:30:18
#> 6 11.4 26 9472219 2008-05-31 21:00:20
#> 7 13.4 20 9472219 2008-05-31 22:30:44
#> 8 14.8 15 9472219 2008-06-01 00:00:43
#> 9 10.5 15 9472219 2008-06-01 01:30:24
#> 10 15.3 13 9472219 2008-06-01 03:00:10
#> # ℹ 16,404 more rows
#> # ℹ 1 more variable: geometry <POINT [°]>
#> First 10 track features:
#> # A tibble: 28 × 52
#> deployment_id tag_id individual_id animal_life_stage attachment_type
#> <int64> <int64> <int64> <fct> <fct>
#> 1 2911170 2911124 2911090 adult tape
#> 2 2911150 2911126 2911091 adult tape
#> 3 2911167 2911127 2911092 adult tape
#> 4 2911168 2911129 2911093 adult tape
#> 5 2911178 2911132 2911094 adult tape
#> 6 2911163 2911133 2911095 adult tape
#> 7 9472225 2911114 2911061 adult tape
#> 8 9472224 2911120 2911062 adult tape
#> 9 9472223 2911121 2911086 adult tape
#> 10 9472222 2911134 2911065 adult tape
#> # ℹ 18 more rows
#> # ℹ 47 more variables: deployment_comments <chr>, deploy_on_timestamp <dttm>,
#> # duty_cycle <chr>, deployment_local_identifier <fct>,
#> # manipulation_type <fct>, study_site <chr>, tag_readout_method <fct>,
#> # sensor_type_ids <chr>, capture_location <POINT [°]>,
#> # deploy_on_location <POINT [°]>, deploy_off_location <POINT [°]>,
#> # individual_comments <chr>, individual_local_identifier <fct>, …
For specific request it might be useful to directly retrieve
information from the Movebank API. The movebank_retrieve
function provides this functionality. The first argument is the entity
type you would like to retrieve information for (e.g. tag
or event
). A study id is always required and other
arguments make it possible to select. For more details how to use the
api see the documentation.
One common reason to use this options is to retrieve undeployed
locations. In some cases a set of locations is collected before the tag
attached to the animal for quality control or error measurements. The
example below shows how all records for a specific tag can be retrieved.
Filtering for locations where the deployment_id
is
NA
, returns those locations that were collected while the
tag was not deployed. The timestamp_start
and
timestamp_end
might be good argument to filter down the
data even more in the call to movebank_retrieve
. By
omitting the argument tag_local_identifier
the entire study
can downloaded. With the argument sensor_type_id
the
sensors can be specified.
movebank_retrieve("event",
study_id = 1259686571,
tag_local_identifier = "193967",
attributes = "all"
) %>%
filter(is.na(deployment_id))
#> # A tibble: 57 × 33
#> individual_id deployment_id tag_id study_id sensor_type_id
#> <int64> <int64> <int64> <int64> <int64>
#> 1 NA NA 3029107920 1259686571 653
#> 2 NA NA 3029107920 1259686571 653
#> 3 NA NA 3029107920 1259686571 653
#> 4 NA NA 3029107920 1259686571 653
#> 5 NA NA 3029107920 1259686571 653
#> 6 NA NA 3029107920 1259686571 653
#> 7 NA NA 3029107920 1259686571 653
#> 8 NA NA 3029107920 1259686571 653
#> 9 NA NA 3029107920 1259686571 653
#> 10 NA NA 3029107920 1259686571 653
#> # ℹ 47 more rows
#> # ℹ 28 more variables: individual_local_identifier <fct>,
#> # tag_local_identifier <fct>, individual_taxon_canonical_name <fct>,
#> # acceleration_raw_x <dbl>, acceleration_raw_y <dbl>,
#> # acceleration_raw_z <dbl>, barometric_height [m],
#> # battery_charge_percent [%], battery_charging_current [mA],
#> # external_temperature [°C], gps_hdop [1], gps_satellite_count [count], …