Skip to content

Commit

Permalink
Update FHD calculation and documentation
Browse files Browse the repository at this point in the history
Change the term from Frequency Histogram Diversity to Foliage Height Diversity for clarity. Enhanced function documentation to better explain the input parameters and the output format while highlighting areas with no voxel returns resulting in NaN values.
  • Loading branch information
iosefa committed Sep 26, 2024
1 parent 7f2226b commit 0c2d65e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pyforestscan/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,20 @@ def calculate_pai(pad, min_height=1, max_height=None):

def calculate_fhd(voxel_returns):
"""
Calculate the Frequency Histogram Diversity (FHD) for a given set of voxel returns.
Calculate the Foliage Height Diversity (FHD) for a given set of voxel returns.
This function computes the Frequency Histogram Diversity by calculating the entropy
of the voxel return proportions along the z-axis.
This function computes Foliage Height Diversity by calculating the entropy
of the voxel return proportions along the z-axis, which represents vertical structure
in the canopy.
:param voxel_returns:
A numpy array of shape (x, y, z) representing voxel returns.
A numpy array of shape (x, y, z) representing voxel returns, where x and y are spatial
dimensions, and z represents height bins (or layers along the vertical axis).
:return:
A numpy array of shape (x, y"""
A numpy array of shape (x, y) representing the FHD values for each (x, y) location.
Areas with no voxel returns will have NaN values.
"""
sum_counts = np.sum(voxel_returns, axis=2, keepdims=True)

with np.errstate(divide='ignore', invalid='ignore'):
Expand Down

0 comments on commit 0c2d65e

Please sign in to comment.