NASA Logo
Ocean Color Science Software

ocssw V2022
vegetation_indices.c File Reference
#include "vegetation_indices.h"
#include <math.h>
Include dependency graph for vegetation_indices.c:

Go to the source code of this file.

vegetation_indices.c - Utility functions for vegetation index calculations

Functions useful to the implementation of vegetation index algorithms

Authors
Jakob Lindo (SSAI)
Date
Feb 2024
#define NUM_BANDS_TO_BE_HYPERSPECTRAL   50
 
const int32_t blu_min = 459
 
const int32_t blu_max = 479
 
const int32_t red_min = 620
 
const int32_t red_max = 670
 
const int32_t nir_min = 841
 
const int32_t nir_max = 876
 
const int32_t grn_min = 480
 
const int32_t grn_max = 537
 
const int32_t modis_b4_min = 545
 
const int32_t modis_b4_max = 565
 
const int32_t modis_b11_min = 526
 
const int32_t modis_b11_max = 536
 
float average_rhos_values (float rhos_values[], size_t length)
 
bool invalid_pixel (double pixel_elevation, double pixel_mask, double rhos_values[], int len_rhos_values)
 
float clamp (float pixel_value, int minimum, int maximum)
 
bool instrument_is_hyperspectral (int32_t num_bands)
 

Macro Definition Documentation

◆ NUM_BANDS_TO_BE_HYPERSPECTRAL

#define NUM_BANDS_TO_BE_HYPERSPECTRAL   50

Definition at line 11 of file vegetation_indices.c.

Function Documentation

◆ average_rhos_values()

float average_rhos_values ( float  rhos_values[],
size_t  length 
)

Get the average of rho_s values from a hyperspectral measurement to approximate a multi-band measurement.

Parameters
uint16_trho_s_values An array of rho_s values to average
size_tlength An integer indicating the size of wavelengths
Returns
the average value of the values in rho_s_values

Definition at line 27 of file vegetation_indices.c.

◆ clamp()

float clamp ( float  pixel_value,
int  minimum,
int  maximum 
)

Clamp the value of a pixel between minval and maxval.

Parameters
pixel_valueA float representing a the vegetation index
minimumLower bound to which pixel_value will be clamped
maximumUpper bound to which pixel_value will be clamped
Returns
pixel_value clamped between minimum and maximum

Definition at line 49 of file vegetation_indices.c.

◆ instrument_is_hyperspectral()

bool instrument_is_hyperspectral ( int32_t  num_bands)

Definition at line 53 of file vegetation_indices.c.

◆ invalid_pixel()

bool invalid_pixel ( double  pixel_elevation,
double  pixel_mask,
double  rhos_values[],
int  len_rhos_values 
)

Check pixel attributes for validity.

Parameters
pixel_elevationMeasured pixel elevation ASL
pixel_maskBitwise AND b/n this pixel's flags and a mask
rhos_valuesArray of doubles representing measured surface reflectances in a number of bands
len_rhos_valuesNumber of bands for which a rho_s value has been measured
Returns
true if there is something wrong with any of the given attributes, false otherwise

Definition at line 35 of file vegetation_indices.c.

Variable Documentation

◆ blu_max

const int32_t blu_max = 479

Definition at line 15 of file vegetation_indices.c.

◆ blu_min

const int32_t blu_min = 459

Definition at line 14 of file vegetation_indices.c.

◆ grn_max

const int32_t grn_max = 537

Definition at line 21 of file vegetation_indices.c.

◆ grn_min

const int32_t grn_min = 480

Definition at line 20 of file vegetation_indices.c.

◆ modis_b11_max

const int32_t modis_b11_max = 536

Definition at line 25 of file vegetation_indices.c.

◆ modis_b11_min

const int32_t modis_b11_min = 526

Definition at line 24 of file vegetation_indices.c.

◆ modis_b4_max

const int32_t modis_b4_max = 565

Definition at line 23 of file vegetation_indices.c.

◆ modis_b4_min

const int32_t modis_b4_min = 545

Definition at line 22 of file vegetation_indices.c.

◆ nir_max

const int32_t nir_max = 876

Definition at line 19 of file vegetation_indices.c.

◆ nir_min

const int32_t nir_min = 841

Definition at line 18 of file vegetation_indices.c.

◆ red_max

const int32_t red_max = 670

Definition at line 17 of file vegetation_indices.c.

◆ red_min

const int32_t red_min = 620

Definition at line 16 of file vegetation_indices.c.