Skip to contents

This function download data associated to each flight from the ERA5 hourly pressure levels with the Climate Data Store (CDS) and through the ecmwfr R package.

Any variable available from the ERA5 pressure level can be downloaded.

The flights are determined from the stationary periods classified tag$stap. It request a single file for each flight using the exact time (hourly basis) and pressure (altitude). To make the download more efficient, wf_request_batch() is used to download all files at the same time (up to 20 requests in parallel).

To be able to download data from the Climate Data Store (CDS), you will need to create an ECMWF account on https://www.ecmwf.int/. 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}"

Usage

tag_download_wind(
  tag,
  extent = tag$param$tag_set_map$extent,
  include_stap_id = NULL,
  variable = c("u_component_of_wind", "v_component_of_wind"),
  cds_token = Sys.getenv("cds_token"),
  file = function(stap_id)
    glue::glue("./data/wind/{tag$param$id}/{tag$param$id}_{stap_id}.nc"),
  overwrite = FALSE,
  workers = 19,
  ...
)

Arguments

tag

a GeoPressureR tag object.

extent

geographical extent of the map on which the likelihood will be computed. Vector of length 4 c(xmin, xmax, ymin, ymax) or c(W, E, S, N).

include_stap_id

stationary period identifiers of the start of the flight to download. Default is to download all flights.

variable

list of variables to download from the ERA5 pressure level : "u_component_of_wind", "v_component_of_wind", "temperature", "fraction_of_cloud_cover", "relative_humidity", , "vertical_velocity", "specific_cloud_ice_water_content", "specific_cloud_liquid_water_content", "specific_humidity", "specific_rain_water_content", "specific_snow_water_content", "divergence", "geopotential", "ozone_mass_mixing_ratio", "potential_vorticity", 'vorticity".

cds_token

CDS Personal Access Token available from your user page . See wf_set_key().

file

absolute or relative path of the ERA5 wind data file to be downloaded. Function taking as single argument the stationary period identifier.

overwrite

logical. If TRUE, file is overwritten.

workers

maximum number of simultaneous request that will be submitted to the service. Most ECMWF services are limited to 20 concurrent requests (default = 2).

...

Arguments passed on to ecmwfr::wf_request_batch

user

user (default = "ecmwf") provided by the ECMWF data service, used to retrieve the token set by wf_set_key

path

path were to store the downloaded data

time_out

how long to wait on a download to start (default = 3*3600 seconds).

retry

polling frequency of submitted request for downloading (default = 30 seconds).

request_list

a list of requests that will be processed in parallel.

total_timeout

overall timeout limit for all the requests in seconds.

Value

the path of the downloaded (requested file) or the an R6 object with download/transfer information