interpolate_air_pressure: Interpolate air pressure for metabolism models

Description Usage Arguments Details Value

View source: R/data.r

Description

In many cases we don't have air pressure precisely at the locations where other stream metabolism measurements are made. This function takes as input pressure readings from weather stations, along with desired output locations and times. Output is matrix, with output sites in the rows, output times in the columns.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
interpolate_air_pressure(
  pressure,
  stations,
  out_sites,
  out_times,
  parallel = TRUE,
  stn_id = "station",
  site_id = "site",
  ...
)

Arguments

pressure

Data.frame required columns are 'station' 'pressure' (hPa), 'time' (see details)

stations

Spatial (sp or sf), station locations where pressure was recorded (see details)

out_sites

Spatial (sp or sf) object with output locations, 'elevation' is a required column

out_times

A list, with one element per out_site; each element is a vector of type POSIXct giving times at which to compute pressure

parallel

Boolean, should we use multiple threads to speed computation? Mac/Linux only

stn_id

Character, the column name where pressure station names are stored in both pressure and stations

site_id

Character or numeric, the column in out_sites where site names are stored

...

Additional parameters to pass to approx().

Details

pressure must be a data.frame with at least 3 columns, named: * 'station' (by default, or the value assigned to stn_id), station name * 'pressure', pressure observations (hPa) * 'time', a POSIXct column giving the times of measurements

stations: Spatial object, in addition to locations has at least 2 columns, named: * 'station' (by default, or the value assigned to stn_id), station name * 'elevation', Elevation (m) of the station

It is recommended that the input air pressure data represent a continuous record with no substantial gaps in the time series. If this is not the case, interpolation may be unreliable.

Elevation is required for both control and output points so that corrections to air pressure can be applied.

Value

A data frame with three columns: site name, time, and interpolated pressure


mtalluto/NSmetabolism documentation built on May 3, 2021, 7:51 p.m.