extract_precip: Produces daily or hourly precipitation data for a single...

Description Usage Arguments Value

View source: R/extract_precip.R

Description

'extract_precip' takes an nc file containing hourly ERA5 climate data, and for a given set of coordinates, produces an (optionally) inverse distance weighted mean of precipitation (at daily or hourly resolution) ready for use with 'microclima::runauto'.

Usage

1
2
3
4
5
6
7
8
9
extract_precip(
  nc,
  long,
  lat,
  start_time,
  end_time,
  d_weight = TRUE,
  convert_daily = TRUE
)

Arguments

nc

character vector containing the path to the nc file. Use the 'build_era5_request' and 'request_era5' functions to acquire an nc file with the correct set of variables. Data within nc file must span the period defined by start_time and end_time.

long

longitude of the location for which data are required (decimal degrees, -ve west of Greenwich Meridian).

lat

latitude of the location for which data are required (decimal degrees, -ve south of the equator).

start_time

a POSIXlt object indicating the first hour for which data are required.

end_time

a POSIXlt object indicating the last hour for which data are required.

d_weight

logical value indicating whether to apply inverse distance weighting using the 4 closest neighbouring points to the location defined by 'long' and 'lat'. Default = 'TRUE'.

convert_daily

a flag indicating whether the user desires to convert the precipitation vector from hourly to daily averages (TRUE) or remain as hourly values (FALSE). Only daily precipitation will be accepted by 'microclima::runauto'.

Value

a numeric vector of daily or hourly precipitation (mm).


dklinges9/mcera5 documentation built on Jan. 14, 2022, 9:42 p.m.