get_probRaster: get_probRaster

View source: R/get_probRaster.R

get_probRasterR Documentation

get_probRaster

Description

This is a function to extract footprint FP for inputs or outputs for the EC towers source area. It extracts the FP average (i.e. sum of probability) for inputs in a multilayer stack or brick raster, or in a data frame (timestamp, output values per "pixel number").

Usage

get_probRaster(
  fetch,
  zm,
  grid,
  speed,
  direction,
  uStar,
  zd,
  v_var,
  L,
  lon,
  lat,
  timestamp,
  FP_probs = 0.99,
  input_raster,
  prob = TRUE,
  resample = TRUE
)

Arguments

fetch

source area maximum distance in meters for the footprint (radious).

zm

EC measurement height above ground (in meter)

grid

the grid size (square)

speed

wind speed

direction

wind direction

uStar

friction velocity

zd

roughness length

v_var

sigma var

L

stability parameter

lon

longitude of the EC tower

lat

latitude of the EC tower

timestamp

datetime (Lubridate)

FP_probs

probability to keep as the main ellipse area - suggested 0.99

prob

default TRUE, if FALSE return the full fooprint

resample

default TRUE, if FALSE return the grid from the FP function

Value

It returns a data frame (or vector) with the FP average extracted from the tower's location.

Examples

## Examples of uses of the extract_fp probability raster
ROTH_Map <- raster::crop(atlas_maps[[1]], extent(c(385566.5-2000, 385566.5+2000, 5813229-2000, 5813229+2000)))

FP_ROTH_prob <- pbapply::pblapply(4501:4524, function(i)
  get_probRaster(
    fetch = 1000, zm = 39.75, grid = 200, lon = 385566.5, lat = 5813229,
    speed = zoo::na.approx(EC_DWD_ROTH$ws)[i], # FP input variables
    direction = zoo::na.approx(EC_DWD_ROTH$wd)[i],
    uStar = zoo::na.approx(EC_DWD_ROTH$u.)[i],
    zd = zoo::na.approx(EC_DWD_ROTH$zd)[i],
    v_var = zoo::na.approx(EC_DWD_ROTH$v_var)[i],
    L = zoo::na.approx(EC_DWD_ROTH$L)[i],
    timestamp = EC_DWD_ROTH$timestamp[i],
    FP_probs = 0.90,# FP probability
    prob = TRUE,
    resample = TRUE,
    input_raster = ROTH_Map # raster model inputs (utm)
  ))

FP_ROTH_prob <- stack(FP_ROTH_prob)

plot(FP_ROTH_prob[[c(1,6,12,18)]])

for (i in 1:24) {
  print(sum(raster::values(FP_ROTH_prob[[i]]), na.rm = TRUE))
}


AlbyDR/rSCOPE documentation built on Dec. 19, 2024, 7:29 p.m.