Skip to contents

Compute azimuth interval for a theoretical hour based on sun position and apply a rolling mean with this computed window size on horizon height.

Usage

compute_horizon_rollmean(stn = NULL, horizon = NULL)

Arguments

stn

A SpatVector with station attributes from "get_latlon_frost"

horizon

A data.frame with horizon distribution from "compute_horizon_max"

Value

an array of horizon height in degrees

Examples

# Load the station metadata including location and level
stn <- get_metadata_frost(stationid = 18700)

# Compute maximum horizon
horizon <- compute_horizon_max(stn, step = 1, f_plot_polygon = FALSE)
#> [1] "Process: 18700 - 260966.8/6652718.0 - dtm - 100/1 - path: data/dem"
#> [1] "Load demo file: data/dem/18700_dtm_25833_d00100m_1.0m.tif"
#> [1] "Process: 18700 - 260966.8/6652718.0 - dom - 100/1 - path: data/dem"
#> [1] "Load demo file: data/dem/18700_dom_25833_d00100m_1.0m.tif"
#> [1] "Process: 18700 - 260966.8/6652718.0 - dtm - 20000/20 - path: data/dem"
#> [1] "Load demo file: data/dem/18700_dtm_25833_d20000m_20.0m.tif"
#> Over-riding projection check
#> Importing raster map <elev>...
#>    0%   3%   6%   9%  12%  15%  18%  21%  24%  27%  30%  33%  36%  39%  42%  45%  48%  51%  54%  57%  60%  63%  66%  69%  72%  75%  78%  81%  84%  87%  90%  93%  96%  99% 100%
#> SpatRaster read into GRASS using r.in.gdal from memory
#> Over-riding projection check
#> Importing raster map <elev>...
#>    0%   3%   6%   9%  12%  15%  18%  21%  24%  27%  30%  33%  36%  39%  42%  45%  48%  51%  54%  57%  60%  63%  66%  69%  72%  75%  78%  81%  84%  87%  90%  93%  96%  99% 100%
#> SpatRaster read into GRASS using r.in.gdal from memory
#> Over-riding projection check
#> Importing raster map <elev>...
#>    0%   3%   6%   9%  12%  15%  18%  21%  24%  27%  30%  33%  36%  39%  42%  45%  48%  51%  54%  57%  60%  63%  66%  69%  72%  75%  78%  81%  84%  87%  90%  93%  96%  99% 100%
#> SpatRaster read into GRASS using r.in.gdal from memory

# Apply rolling mean to horizon height with a computed hourly window
horizon["horizon_mean"] <- compute_horizon_rollmean(stn, horizon)