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

Tip

Delete this block when you have read!

If you don’t yet have one, create a ECMWF account at https://www.ecmwf.int/ and retrieve your personal access token.

Once created, you can retrieve your Personal Access Token on https://cds.climate.copernicus.eu/profile and save them in your environment file (i.e., .Renviron). You can open this file with usethis::edit_r_environ() and add:

cds_token =  "{Personal Access Token}"

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 [287ms]
ℹ Create graph from maps
✔ Create graph from maps [429ms]
ℹ 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 9/28 (80% of nodes)
ℹ Compute the groundspeed for stationary period 27/28 (100% of nodes)
✔ Compute the groundspeed [12.6s]
ℹ Prune the graph 0/54 
✔ Prune the graph [972ms]
ℹ Format graph output
✔ Format graph output [10.9s]
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 [15s]

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