12  Download wind

This script will help you download the wind data for a tag and define the movement model.

Tip

Delete this block when you have read!

  • These scripts should be adapted based on your project, but the same script should run for all your tags. You can always check the original version online.
  • Make sure you’ve read the GeoPressureManual, in particular the instructions on wind data, before running this script
  • Nothing is saved at the end of the script and it is meant to be like that. Only wind file and config.yml should be edited. Use geopressure.R for the final run.
id <- "18LX"

knitr::opts_knit$set(root.dir = here::here())
library(GeoPressureR)
library(job)

12.1 Set Copernicus credentials

Caution

Delete this block when you have read!

  1. If you don’t yet have one, create a ECMWF account at https://www.ecmwf.int/.

  2. Accept the licence agreement on cds.climate.copernicus.eu/profile going on the “Licences” tab and select the “Licence to use Copernicus Products”.

  3. Retrieve your API Token on https://cds.climate.copernicus.eu/profile.

  4. Saves the token to your local keychain with ecmwfr (which calls the API Token key) :

ecmwfr::wf_set_key("abcd1234-foo-bar-98765431-XXXXXXXXXX")

For more information visit the ecmwfr documentation.

12.2 Create tag

Make sure you have already created the label file with the “1-label.qmd” script.

tag <- geopressuretemplate_tag(id, quiet=F)

12.3 Download wind data

The job package allows to download the wind data in the background and let your R console free to use.

Check requests at https://cds.climate.copernicus.eu/requests

12.4 Define movement model

12.4.1 Add wind data

graph <- graph_create(
  tag,
  thr_likelihood = config::get("graph_create", id)$thr_likelihood,
  thr_gs = config::get("graph_create", id)$thr_gs
)
ℹ Check data input
✔ Check data input [378ms]
ℹ Create graph from maps
✔ Create graph from maps [502ms]
ℹ Compute the groundspeed for stationary period 0/28 (0% of nodes)
ℹ Compute the groundspeed for stationary period 1/28 (15% of nodes)
ℹ Compute the groundspeed for stationary period 2/28 (27% of nodes)
ℹ Compute the groundspeed for stationary period 4/28 (52% of nodes)
ℹ Compute the groundspeed for stationary period 6/28 (65% of nodes)
ℹ Compute the groundspeed for stationary period 10/28 (84% of nodes)
ℹ Compute the groundspeed for stationary period 22/28 (99% of nodes)
✔ Compute the groundspeed [18.1s]
ℹ Prune the graph 0/54 
✔ Prune the graph [1.8s]
ℹ Format graph output
✔ Format graph output [21.3s]
graph <- graph_add_wind(
  graph,
  pressure = tag$pressure,
  thr_as = config::get("graph_add_wind", id)$thr_as
)
ℹ Compute wind speed for edges of stationary period:  1/28 ■                   …
ℹ Compute wind speed for edges of stationary period:  2/28 ■■                  …
ℹ Compute wind speed for edges of stationary period:  3/28 ■■■■                …
ℹ Compute wind speed for edges of stationary period:  4/28 ■■■■                …
ℹ Compute wind speed for edges of stationary period:  5/28 ■■■■                …
ℹ Compute wind speed for edges of stationary period:  6/28 ■■■■                …
ℹ Compute wind speed for edges of stationary period:  7/28 ■■■■■■              …
ℹ Compute wind speed for edges of stationary period:  8/28 ■■■■■■■             …
ℹ Compute wind speed for edges of stationary period:  9/28 ■■■■■■■■■           …
ℹ Compute wind speed for edges of stationary period:  10/28 ■■■■■■■■■■■■■      …
ℹ Compute wind speed for edges of stationary period:  11/28 ■■■■■■■■■■■■■■■■   …
ℹ Compute wind speed for edges of stationary period:  12/28 ■■■■■■■■■■■■■■■■■  …
ℹ Compute wind speed for edges of stationary period:  13/28 ■■■■■■■■■■■■■■■■■  …
ℹ Compute wind speed for edges of stationary period:  14/28 ■■■■■■■■■■■■■■■■■■ …
ℹ Compute wind speed for edges of stationary period:  15/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  16/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  17/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  18/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  19/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  20/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  21/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  22/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  23/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  24/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  25/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  26/28 ■■■■■■■■■■■■■■■■■■■…
ℹ Compute wind speed for edges of stationary period:  27/28 ■■■■■■■■■■■■■■■■■■■…
✔ Compute wind speed for edges of stationary periods [24.5s]

12.4.2 Set movement model

Check that the movement model defined in config.yml is adequate.

graph <- graph_set_movement(graph,
  bird = bird_create(config::get("bird_create", id)$scientific_name)
)

Check the movement model