GLI Ray Analyzer

This program takes as input a set of trees and a set of light rays and determines, for each ray, which trees intersect it. Light rays are defined by an origin point (x, y, z), an azimuth, and an altitude. The calculations used to determine intersection are the same as used by SORTIE for GLI light calculations. The program takes three files as input: a file with a list of GLI rays for which to find intersecting trees, a file with a list of plot trees, and a file with the parameters for the allometric relationships. It returns an output file listing the intersecting trees for each GLI light ray. All files are tab-delimited text (in table format, with table columns separated by tab characters). All files can have any file extension desired. Header rows for input files are ignored; you can have any text you wish in the header row. However, the position of the columns must always be the same.

Deep calculation details on canopy intersection here.

Tree allometry

Trees are modeled as cylinders atop one-dimensional lines. These lines, the trunks, do not intersect light rays. The size and shape of the cylindrical canopy is controlled by the allometry equations. All dimensions are calculated, directly or indirectly, from DBH.

Equations:

Height = 1.35+((M-1.35)*(1-exp(-H*DBH)))

where Height is tree height, in meters, M is the maximum species tree height, in meters, and H is the height constant.

Canopy radius = R * (DBHG)

where Canopy radius is the radius of the canopy, in meters, R is the canopy radius coefficient, and G is the canopy radius exponent.

Height of canopy bottom = Height - (D * Height)

where Height of canopy bottom is the distance above the ground that the canopy cylinder starts, in meters, Height is tree height, in meters, and D is the canopy depth coefficient.

Input file: Tree file

The tree file is the list of plot trees. It has a header row at the top and six columns, which must be in the same order as the example below. Example:

TAGSPPDBHDAMCODEXY
1097ALCFLO351160.782.75
1262BUCCAP822155.6330.26
1360ANDINE17.70210.3933.21

TAG is an identifying code for the tree. It is ignored in the code but is written to the output file. SPP is the species name. It can be any combination of letters and/or numbers. DBH is the tree's DBH, in cm. DAMCODE is the tree's damage code, as an integer. It is ignored in the code but is written to the output file. X is the tree's coordinate along the plot X axis, in meters. Y is the tree's coordinate along the plot Y axis, in meters. The X and Y axes can have any orientation relative to true north, as long as the coordinates are consistent with the GLI light ray points as well.

Input file: GLI ray file

The GLI ray file is the list of light rays for which to find intersecting trees. It has a header row at the top and seven columns, which must be in the same order as the example below. Example:

AltAzimuthSubquadLightXYHeight
2053031101253251.25
51803031102254251.25
223453031102254251.25

Alt is the light ray's altitude angle, in degrees. Azimuth is the light ray's azimuth heading, in degrees. The positive Y axis is zero and azimuth increases in a clockwise direction. Subquad is a location identifier for the ray. It is ignored in the code but will be written to the output file. Light is the light ray's light level. It is ignored in the code but will be written to the output file. X is the light ray origin's coordinate along the X plot axis. Y is the light ray origin's coordinate along the Y plot axis. The X and Y coordinates must match the coordinate system of the trees. Height is the light ray origin's height above the ground, in meters.

Input file: Allometry

The allometry input file lists the contants to be used in the allometric relationships, above. The first two rows contain the X and Y plot lengths, respectively, in the second column. Then there is a header row. Then there are six columns of data, which must be in the same order as the example below. Example:

X plot length:320
Y plot length:500
SppRad CoeffRad ExpMaxHtHtConstDepth coeff
ALCLAT0.0731.027.30.0250.477
BUCCAP0.060.924.570.0480.55
CASARB0.090.8300.0290.54
DACEXC0.0751.123.810.0610.576
OTHER0.0741.523.840.0490.497

The plot lengths in the first two rows are in meters. No tree or ray coordinate may be outside these dimensions. The Spp column is the species name. It should match the values in the SPP column of the tree input file. If you do not want to add a row for all possible tree species, you can put in a row with "OTHER" as the species name. This is the set of values that will be used for the allometric equations of tree species that are not explicitly defined in this file. If you do not add an "OTHER" row, you must add a row for every species that appears in the tree input file. Rad Coeff is the tree canopy radius coefficient (R) in the canopy radius equation above. Rad Exp is the tree canopy radius exponent (G) in the canopy radius equation above. MaxHt is the maximum species tree height (M) in the height equation above. HtConst is the height constant (H) in the height equation above. Depth coeff is the canopy depth coefficient (D) in the canopy bottom height equation above.

Output file

The output file lists each GLI ray and all the trees that intersect it. Each GLI ray gets one row. The number of columns in the row varies according to the number of intercepting trees. Example:

ALTAZIMUTHSUBQUADLIGHTRAY XRAY YRAY HEIGHT# INTERCEPTORSTAGSPPDBHDAMCODE
2053031101253251.250
51803031102254251.25314691ALCLAT30.2014694ALCLAT18.8016675BUCCAP70
223453031102254251.25218275BUCCAP73.8218271BYRSPI80.12
6003031101604901.25216850ANDINE130018882BUCCAP145.50
251383031102254251.25117209CASARB302

The first seven columns are the same as the GLI ray input file. The rays should be listed in the same order as in that file, as well. The next column, # INTERCEPTORS, lists the number of intercepting trees for that ray. Each tree is identified by a quadruple of values. The value in the # INTERCEPTORS column is how many quadruples follow. The quadruples are the same as the first four columns in the tree input file.