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 an ECMWF account at https://www.ecmwf.int/.

  2. Accept the licence agreement on [ https://cds.climate.copernicus.eu/datasets/reanalysis-era5-pressure-levels?tab=download#manage-licences] 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. Save the token to your local keychain with ecmwfr (which calls the API Token key):

ecmwfr::wf_set_key("abcd1234-foo-bar-98765431-XXXXXXXXXX")
User ecmwfr for ecmwfr service added successfully in keychain

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 you 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

Make sure to update the type from "gs" to "as" in config.yml:

graph_set_movement:
  type: "as"

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
✔ Data input validated [298ms]
ℹ Create nodes from likelihood maps
✔ Nodes created from likelihood maps [247ms]
ℹ Filter nodes by binary distance
✔ Nodes filtered by binary distance [613ms]
ℹ Compute the groundspeed for stationary period 0/28: 0% of transitions done
ℹ Compute the groundspeed for stationary period 2/28: 2% of transitions done
ℹ Compute the groundspeed for stationary period 7/28: 13% of transitions done
ℹ Compute the groundspeed for stationary period 10/28: 37% of transitions done
ℹ Compute the groundspeed for stationary period 14/28: 57% of transitions done
ℹ Compute the groundspeed for stationary period 18/28: 62% of transitions done
ℹ Compute the groundspeed for stationary period 21/28: 77% of transitions done
ℹ Compute the groundspeed for stationary period 25/28: 100% of transitions done
✔ Compute the groundspeed [20.2s]
ℹ Pruning the graph: 0/54 transitions (forward and backward).
ℹ Pruning the graph: 35/54 transitions (forward and backward).
✔ Graph pruned [2.3s]
ℹ Format graph output
✔ Graph formatted [1.1s]
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 [40.6s]
ℹ Pruning the graph: 0/54 transitions (forward and backward).
ℹ Pruning the graph: 45/54 transitions (forward and backward).
✔ Graph pruned [1.2s]

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