NASA Logo
Ocean Color Science Software

ocssw V2022
vegetation_indices.h File Reference
#include <stdlib.h>
#include <stdbool.h>
#include <genutils.h>
Include dependency graph for vegetation_indices.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

vegetation_indices.h - Utility functions for vegetation index calculations

Header file for funcitons useful to the implementation of vegetation index algorithms

Authors
Jakob Lindo (SSAI)
Date
Feb 2024
#define VI_MINVAL   -1000.0
 
#define VI_MAXVAL   1000.0
 
#define MIN_PIXEL_ELEVATION   -500
 
#define DEFAULT_BAND_INDEX   -0x444249
 
#define UNDEFINED   BAD_FLT
 
#define LAND_MASK   LAND
 
const int32_t blu_min
 
const int32_t blu_max
 
const int32_t red_min
 
const int32_t red_max
 
const int32_t nir_min
 
const int32_t nir_max
 
const int32_t grn_min
 
const int32_t grn_max
 
const int32_t modis_b11_min
 
const int32_t modis_b11_max
 
const int32_t modis_b4_min
 
const int32_t modis_b4_max
 
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

◆ DEFAULT_BAND_INDEX

#define DEFAULT_BAND_INDEX   -0x444249

Definition at line 15 of file vegetation_indices.h.

◆ LAND_MASK

#define LAND_MASK   LAND

Definition at line 17 of file vegetation_indices.h.

◆ MIN_PIXEL_ELEVATION

#define MIN_PIXEL_ELEVATION   -500

Definition at line 14 of file vegetation_indices.h.

◆ UNDEFINED

#define UNDEFINED   BAD_FLT

Definition at line 16 of file vegetation_indices.h.

◆ VI_MAXVAL

#define VI_MAXVAL   1000.0

Definition at line 13 of file vegetation_indices.h.

◆ VI_MINVAL

#define VI_MINVAL   -1000.0

Definition at line 12 of file vegetation_indices.h.

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

Definition at line 15 of file vegetation_indices.c.

◆ blu_min

const int32_t blu_min

Definition at line 14 of file vegetation_indices.c.

◆ grn_max

const int32_t grn_max

Definition at line 21 of file vegetation_indices.c.

◆ grn_min

const int32_t grn_min

Definition at line 20 of file vegetation_indices.c.

◆ modis_b11_max

const int32_t modis_b11_max

Definition at line 25 of file vegetation_indices.c.

◆ modis_b11_min

const int32_t modis_b11_min

Definition at line 24 of file vegetation_indices.c.

◆ modis_b4_max

const int32_t modis_b4_max

Definition at line 23 of file vegetation_indices.c.

◆ modis_b4_min

const int32_t modis_b4_min

Definition at line 22 of file vegetation_indices.c.

◆ nir_max

const int32_t nir_max

Definition at line 19 of file vegetation_indices.c.

◆ nir_min

const int32_t nir_min

Definition at line 18 of file vegetation_indices.c.

◆ red_max

const int32_t red_max

Definition at line 17 of file vegetation_indices.c.

◆ red_min

const int32_t red_min

Definition at line 16 of file vegetation_indices.c.