extract_precipa: Produces daily or hourly precipitation data across a grid...

View source: R/extract_precipa.R

extract_precipaR Documentation

Produces daily or hourly precipitation data across a grid ready for use with several gridded microclimate models.

Description

'extract_precipa' takes an nc file containing hourly ERA5 climate data, and for a given set of coordinates, produces precipitation (at daily or hourly resolution) ready for use with 'microclimf::modelina'.

Usage

extract_precipa(
  nc,
  long_min,
  long_max,
  lat_min,
  lat_max,
  start_time,
  end_time,
  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_min

minimum longitude of the grid for which data are required (decimal

long_max

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

lat_min

minimum latitude of the grid for which data are required (decimal

lat_max

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

start_time

a POSIXlt or POSIXct object indicating the first day or hour for which data are required. Encouraged to specify desired timezone as UTC (ERA5 data are in UTC by default), but any timezone is accepted.

end_time

a POSIXlt or POSIXct object indicating the last day or hour for which data are required. Encouraged to specify desired timezone as UTC (ERA5 data are in UTC by default), but any timezone is accepted.

convert_daily

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

Value

a spatRaster of daily or hourly precipitation (mm).


dklinges9/mcera5 documentation built on March 1, 2024, 11:40 p.m.