Skip to contents

This function downloads data associated to each flight from the ERA5 hourly pressure levels (doi:10.24381/cds.bd0915c6 ) 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 requests 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 files in parallel. CDS queue limits vary with the current system workload. If CDS reports that queued requests are temporarily limited, reduce workers and try again.

More information in the GeoPressureManual.

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"),
  file = function(stap_id, tag_id) {
    
    glue::glue("./data/wind/{tag_id}/{tag_id}_{stap_id}.nc")
 },
  overwrite = FALSE,
  workers = 19,
  cds_token = lifecycle::deprecated(),
  ...
)

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". The same names are used by edge_add_wind().

file

absolute or relative path of the ERA5 wind data file to be downloaded. Function taking as arguments (1) the stationary period identifier and (2) the tag_id.

overwrite

logical. If TRUE, file is overwritten.

workers

maximum number of simultaneous requests submitted to CDS. Defaults to 19. CDS queue limits are dynamic; use a lower value if queued requests are temporarily limited.

cds_token

[Deprecated] Enter the API token with ecmwfr::wf_set_key()

...

Arguments passed on to ecmwfr::wf_request_batch

request

nested list with query parameters following the layout as specified on the ECMWF APIs page

user

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

transfer

logical, download data TRUE or FALSE (default = TRUE)

path

path were to store the downloaded data

time_out

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

retry

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

job_name

optional name to use as an RStudio job and as output variable name. It has to be a syntactically valid name.

verbose

show feedback on processing

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

ECMWF API key

ARCO access and CDS downloads use the same ECMWF Personal Access Token. Create an ECMWF account, copy the token from your Climate Data Store profile, accept the dataset licence terms, and store the token once in your system keyring:

ecmwfr::wf_set_key("your-personal-access-token")

Do not put the token in a script or commit it to version control. GeoPressureR retrieves the stored token with ecmwfr::wf_get_key() for all ECMWF-backed functions, including geopressure_timeseries(), pressurepath_create(), and tag_download_wind().

Examples

if (FALSE) {
  tag_download_wind(tag)
}