createHor()

Scientific results for this function.

H03 examines DEM sampling against an analytic ridge and a level spherical surface. H03 study and results.

Intervals estimated from other observing groups covered 91.0 and 88.8 percent of bearings in two terrain-radius selections. H01 validation study.

Thin-wall and partial-occlusion fixtures distinguish numerical altitude error from the visible width in a panorama. H04 validation study.

Relief lighting blends 75% observer-facing and 25% directional illumination. With the blended illumination floored at 0.15, the relief brightness multiplier is min(1, ambient + contrast * illumination), with defaults 0.40 and 0.70. Terrain and visible reconstructed features receive the same shading. Directional mode uses ambient + (1 - ambient) * illumination. The selected lighting is applied when the PNG is generated. The numerical skyline is calculated separately.

Function index · H01 field validation · H02 skyline comparison

Measured bearings. To evaluate sightlines between measured bearings, the constructor repeats the azimuths one turn in each direction, removes duplicate azimuth entries and linearly interpolates altitude and altitude uncertainty onto a 0.01-degree grid from -90 to 450 degrees. Scalar uncertainty is repeated. Optional smoothing applies a running mean over the specified number of grid samples to both series, with zero fill at the outer ends. Latitude, longitude and elevation identify the observer; omitted elevation defaults to zero. Interpolation cannot recover narrow features between measurements.

Observer and DEM coverage. For a DEM, supply a point with a CRS, projected x and y with loc.crs, or WGS84 latitude and longitude. The optional third coordinate is ground elevation in metres in the DEM's vertical datum. Otherwise ground elevation is bilinearly sampled at the site. Observer elevation in the returned georeference is ground elevation plus eye.height. A terrain model represents bare earth. A surface model includes the objects represented in its elevations. Use a single continuous band in metres with a defined horizontal CRS. Missing samples and terrain beyond the raster edge are skipped. A warning and the incomplete.bearings metadata identify incomplete coverage. Each bearing needs at least one usable sample.

Accuracy, uncertainty and reproducibility.

H01 compared 334 bearings at 31 observing setups. At the surveyed bearings, createHor() reproduced the observed terrain skyline to within half a degree in 91.9% of cases. See the H01 field validation in the skyscapeR technical manual for the survey protocol, station results and limitations.

With the same 1 m terrain, createHor() reproduced Horizon’s skylines to a mean absolute difference of 0.004 degrees at each of two English sites. Against field measurements at 344 Irish bearings, createHor() using SRTM had a mean absolute error of 0.328 degrees, lower than either HeyWhatsThat or PeakFinder on that sample. Field accuracy varied by site. See the H02 comparison in the skyscapeR technical manual.

The numerical skyline is a maximum over sampled terrain, not an accuracy certificate for the DEM. Horizontal and vertical datum differences, observer height, missing raster values, vegetation and buildings can exceed the sampling error. DEM elevations and a supplied observer ground elevation must use a compatible vertical datum. No geoid conversion or vertical-datum correction is performed automatically. Refine the angular and distance sampling and expand the radius until the relevant sightlines are stable. Compare with surveyed bearings and altitudes where available.

alt.unc is supplied by the user and is not estimated from DEM resolution, control residuals or atmospheric variability. Smoothing a measured profile can remove narrow notches or peaks. Adaptive panorama sampling and illustrative lighting concern the image; they do not increase numerical horizon precision. The terrestrial refraction approximation assumes the supplied atmosphere and cannot reproduce all near-ground gradients or mirage conditions.

Save the DEM provenance, observer location and datum, constructor arguments, feature objects, returned horizon and external PNG. Rebuilding from the same source is distinct from merely replotting the saved horizon.

Method references

Patat, F. (2011). Horizon synthesis for archaeo-astronomical purposes. Astronomische Nachrichten 332, 743-749. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/asna.201111570")}.

Interpretation and limits. A feature height is additional relief on the supplied surface. A bank can be visible below the terrain skyline, so inspect the numerical profile and panorama separately. The H01 field residuals quantify agreement at surveyed terrain bearings. Reconstructed features need their own reference measurements.

Implementation arguments, return value and documented modes
Argument Formal default Behaviour in this interface
az —

Array of azimuth values

alt —

Array of altitude values.

loc —

Observer location. For DEMs, pass a single CRS-bearing terra SpatVector point directly as loc, or a numeric latitude and longitude. Ground elevation is read from the DEM unless supplied as a third numeric value. Measured horizons take latitude, longitude and elevation.

dem NULL

Optional single-band terra SpatRaster or local raster filename. Supply dem in place of az and alt. Requires the optional terra package.

loc.crs NULL

CRS for numeric DEM observer coordinates in x,y order (easting, northing or longitude, latitude). Without it, numeric loc uses latitude, longitude in WGS84. A single terra SpatVector point carries its own CRS. An optional third numeric coordinate is ground elevation in metres.

name ""

Name of site.

alt.unc 0.5

Either a single value or an array of altitude uncertainty.

smooth F

Logical to control whether to smooth horizon profile using rolling mean. Defaults to FALSE

.scale 1000

Number of samples in the rolling mean when smooth = TRUE. The grid spacing is 0.01 degrees, so 1000 samples span approximately 10 degrees.

eye.height 1.6

Observer height above the selected ground elevation in metres.

max.distance 10000

DEM search radius in metres, default 10000. Include any distant terrain that could form the horizon within the DEM coverage.

az.step 0.25

Maximum spacing of numerical DEM rays in degrees. The default is 0.25. An equal number of steps fills the circle.

distance.step NULL

Maximum spacing of samples along each ray in metres. By default use half the smaller native cell dimension estimated at the site.

features NULL

Optional horFeature object or list of such objects describing reconstructed or highlighted structures. Requires dem. Elevations are additive, with the largest positive and deepest negative contributions combined at overlaps. Later footprints take colour precedence. Features affect both numerical horizon and visible terrain. Their geometry is kept out of the returned horizon; save the feature objects separately.

curvature TRUE

Apply Earth curvature to DEM sightlines. Default TRUE.

refraction.k NULL

Default NULL applies Patat when curvature is enabled. Set zero for geometric curvature without terrestrial refraction, or supply a coefficient below one for the effective-radius model.

atm skyscapeR.env$atm

Ground atmospheric pressure in millibars for Patat terrestrial refraction.

temp skyscapeR.env$temp

Ground air temperature in degrees Celsius.

tempgrad -10

Vertical temperature gradient in kelvins per kilometre (default -10).

panorama TRUE

Render an external terrain PNG for a DEM. Default TRUE. Set FALSE for the numerical horizon alone.

width 4096

DEM panorama width in pixels, an even integer from 32 to 81920. Default 4096 by 2048 pixels. Height is half the width. Widths above 8192 are assembled from temporary image tiles. Both dimensions grow with width, so a tenfold increase generates 100 times as many pixels.

panorama.distance.step "adaptive"

The default, "adaptive", starts at one local DEM cell and increases radial spacing with distance using the larger of the requested angular acuity and one horizontal PNG pixel. This transverse footprint is a proxy for radial detail. A narrow ridge may fall between samples. Use a positive number for fixed spacing in metres or NULL to reuse distance.step. The numerical horizon uses distance.step independently. Inspect metadata$image$sampling for the effective angle, sample count and actual step range. On large DEM-only panoramas, the renderer checks near terrain against a conservative upper bound for the remaining terrain on each ray. It skips distant samples only where all remaining elevations are hidden and keeps neighbours for surface shading. Terrain with added archaeological features uses the full sampling path.

panorama.acuity 1

Angular detail target in arcminutes for adaptive PNG sampling. Defaults to 1 (nominal 20/20 acuity). Larger values coarsen distant terrain.

terrain.palette "temperate"

Named land/water pair from demPalettes. Options are temperate (default), standalone, arid, alpine, coastal and relief.

land_cols NULL

Opaque R colour names or hex colours in increasing elevation order. NULL inherits the respective ramp from terrain.palette. Supply either vector to override just that ramp. One colour gives a uniform base. Colours interpolate in Lab space.

sea_cols NULL

Opaque R colour names or hex colours in increasing elevation order. NULL inherits the respective ramp from terrain.palette. Supply either vector to override just that ramp. One colour gives a uniform base. Colours interpolate in Lab space.

sea_level 0

DEM elevation in metres at or below which the sea colour ramp is used. Default 0. A level water surface uses the shallow colour. This is an elevation threshold. Use NULL to apply the land palette over the whole visible elevation range, including depressions. The temperate land ramp starts at the lowest visible land level or sea threshold, whichever is higher. Other palettes with a threshold start at sea_level. The ramp ends at the highest visible elevation. The sea ramp starts at the lowest visible elevation.

n_sea 3L

Number of entries reserved for the sea ramp, leaving at least two land colours. Default 3.

palette_n 256L

Total number of palette entries, from 4 to 65536. Default 256.

lighting c("relief", "directional")

Relief lighting (default) blends a light at the observer (75 percent) with the directional source (25 percent). It shades both sides of a slope and lifts deep shadows. The standalone renderer brightness response is min(1, ambient + contrast * illumination), with illumination floored at 0.15. Terrain and visible horFeature surfaces use the same lighting. Choose "directional" for one-sided hillshade. Lighting affects the PNG only.

light.azimuth 315

Direction towards the illustrative light source in degrees clockwise from true north and above the horizon. Defaults are 315 and 45 degrees. Hillshading uses upward surface normals in metric east, north and vertical coordinates. This is local illumination without cast shadows from other terrain.

light.altitude 45

Direction towards the illustrative light source in degrees clockwise from true north and above the horizon. Defaults are 315 and 45 degrees. Hillshading uses upward surface normals in metric east, north and vertical coordinates. This is local illumination without cast shadows from other terrain.

ambient 0.4

Fraction of illumination retained on slopes facing away from the light (0 to 1). Default 0.40. Use 1 for unshaded palette colours.

haze 0.65

Maximum fraction of distance haze (0 to 1). Default 0.65. Set haze=0 and ambient=1 to inspect the colour mapping alone.

image.dir getwd()

Directory for the DEM PNG. Defaults to the working directory. Site names form the filename; different images with the same name receive a checksum suffix.

attribution "User-supplied DEM"

Credit for the DEM, included in plots and exports. The generic default credit is omitted from plots.

license "See source DEM terms"

Source licence or terms for the DEM, included in exports.

ncores NULL

Maximum DEM tracing workers. Defaults to half the available logical cores, rounded down with a minimum of one. The startup message reports used and available cores. Workers share file-backed DEM data and process separate bearings.

verbose TRUE

Announce the DEM radius, sampling and rendering stages.

progress interactive() && verbose

Show a progress bar for each tracing stage. Default on in interactive verbose sessions.

contrast 0.7

Relief-light contrast (0 to 1), default 0.70, following the standalone renderer. It controls slope detail independently of ambient brightness. Ignored for directional lighting, which retains ambient + (1 - ambient) * illumination. Regenerate existing panoramas to apply new settings.

Return value

A skyscapeR.horizon list with metadata (site name and georeference) and a data frame named data. Its az, alt and alt.unc columns contain azimuth, horizon altitude and altitude uncertainty, all in degrees.

Implementation. R/horizon.R. Full function help · Terrain horizons · Stellar visibility · Sky reconstruction · Terrain horizons and panoramas outline · From a measured orientation to a declination distribution · Terrain crossings and event searches · Identifying celestial candidates and limiting declinations · Photographic calibration and interchange · Generating a terrain panorama · Importing site horizons