extract_clima: Produces hourly data across a grid ready for use with several...

View source: R/extract_clima.R

extract_climaR Documentation

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

Description

'extract_clima' takes an nc file containing hourly ERA5 climate data, and for a given set of coordinates, reconverts climate variables to make ready for use with 'microclimf::modelina' by default. Also provides the option to implement a diurnal temperature range correction to air temperatures.

Usage

extract_clima(
  nc,
  long_min,
  long_max,
  lat_min,
  lat_max,
  start_time,
  end_time,
  dtr_cor = TRUE,
  dtr_cor_fac = 1.285,
  format = "microclimf"
)

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.

dtr_cor

logical value indicating whether to apply a diurnal temperature range correction to air temperature values. Default = 'TRUE'.

dtr_cor_fac

numeric value to be used in the diurnal temperature range correction. Default = 1.285, based on calibration against UK Met Office observations.

format

specifies what microclimate package extracted climate data will be used for. Data will be formatted accordingly. Default is "microclimf". Options: "microclima", "NicheMapR", "microclimc", "microclimf", "micropoint". Note: of these options, only "microclimf" accepts as input an array of climate variables. For all other models you will need to iterate through each spatial point to run the model

Value

Returns a list of wrapped spatRasters containing hourly values for a suite of climate variables. The returned climate variables depends on the value of argument 'format'.

If format is "microclima" or "NicheMapR":

'obs_time' | the date-time (timezone specified in col timezone)

'temperature' | (degrees celsius)

'humidity' | specific humidity (kg / kg)

'pressure' | (Pa)

'windspeed' | (m / s)

'winddir' | wind direction, azimuth (degrees from north)

'emissivity' | downward long wave radiation flux divided by the sum of net long-wave radiation flux and downward long wave radiation flux (unitless)

'netlong' | Net longwave radiation (MJ / m2 / hr)

'uplong' | Upward longwave radiation (MJ / m2 / hr)

'downlong' | Downward longwave radiation (MJ / m2 / hr)

'rad_dni' | Direct normal irradiance (MJ / m2 / hr)

'rad_dif' | Diffuse normal irradiance (MJ / m2 / hr)

'szenith' | Solar zenith angle (degrees from a horizontal plane)

'cloudcover' | (percent)

'timezone' | (unitless)

If format is "microclimc":

'obs_time' | POSIXlt object of dates and times

'temp' | temperature (degrees C)

'relhum' | relative humidity (percentage)

'pres' | atmospheric press (kPa)

'swrad' | Total incoming shortwave radiation (W / m^2)

'difrad' | Diffuse radiation (W / m^2)

'skyem' | Sky emissivity (0-1)

'windspeed' | Wind speed (m/s)

'winddir' | Wind direction (decimal degrees)

'precip' | precipitation (mm)

If format is "micropoint" or "microclimf":

'obs_time' | POSIXlt object of dates and times

'temp' | temperature (degrees C)

'relhum' | relative humidity (percentage)

'pres' | atmospheric press (kPa)

'swdown' | Total incoming shortwave radiation (W / m^2)

'difrad' | Diffuse radiation (W / m^2)

'skyem' | Sky emissivity (0-1)

'lwdown' | Total downward longwave radiation (W / m^2)

'windspeed' | Wind speed (m/s)

'winddir' | Wind direction (decimal degrees)

'precip' | precipitation (mm)


everydayduffy/mcera5 documentation built on Feb. 15, 2025, 11:33 p.m.