NASA Logo
Ocean Color Science Software

ocssw V2022
polcor_oci.cpp File Reference
#include <vector>
#include <map>
#include <netcdf>
#include <math.h>
#include <allocate2d.h>
#include "l12_proto.h"
#include "polcor_oci.h"
Include dependency graph for polcor_oci.cpp:

Go to the source code of this file.

Functions

void getPolarizationCoefs (NcVar &ncVar, vector< vector< float >> &aggVec, int start, int stop, int numPolCoef, int currHamSide)
 
void initializePolCorOci (NcFile &ncFile)
 
void getScanAngleForScan (NcFile &ncFile)
 
void getQualSwirForScan (NcFile &ncFile)
 
bool areHighGainBandsSaturated (int currPix)
 
void calculateAndSetPolCor (l1str *&l1rec, int currPix, int index, vector< float > m12Coefs, vector< float > m13Coefs)
 
void polcor_oci (l1str *l1rec, int32_t currPix)
 

Function Documentation

◆ areHighGainBandsSaturated()

bool areHighGainBandsSaturated ( int  currPix)

Grab the current lines quality flag for SWIR bands. Check the high gain bands (3 and 6) for saturation.

Parameters
currPix- current pixel
Returns
true if at least 1 is saturated, false if not.

Definition at line 242 of file polcor_oci.cpp.

◆ calculateAndSetPolCor()

void calculateAndSetPolCor ( l1str *&  l1rec,
int  currPix,
int  index,
vector< float >  m12Coefs,
vector< float >  m13Coefs 
)

Calculates the polarization correction for the current pixel and sets it to index.

Index is the relative position of the current pixel to the polcor array, which has size numBands * numPixels for the current scan.

Calculate the value of m12 and m13 using the Second Degree Polynomial Function: Ax^2 + Bx + C, where: A = coef[2], B = coef[1], C = coef[0], x = ccd scan angle

Definition at line 267 of file polcor_oci.cpp.

◆ getPolarizationCoefs()

void getPolarizationCoefs ( NcVar &  ncVar,
vector< vector< float >> &  aggVec,
int  start,
int  stop,
int  numPolCoef,
int  currHamSide 
)

Given an NcVar reference to a blue or red M12 or M13 Coef, get all the coef. for the bands specified and append them to an array that is aggrigating the blue, red and SWIR M12 and M13 coefs.

Parameters
ncVar- Ref to the band variable from NetCDF
aggVec- vector to put the coefs
start- start range for bands to be read
stop- stop range for band to be read
numPolCoef- number of polorization coef that is being read
currHamSide- ham side that the coef is on

Definition at line 55 of file polcor_oci.cpp.

◆ getQualSwirForScan()

void getQualSwirForScan ( NcFile &  ncFile)

For each new line, get the line's SWIR quality flag for low and high gain bands for all pixels. The quality flag describes the bands saturation (T/F) for pix. low gain bands = 2, 5 high gain bands = 3, 6

Parameters
ncFile- ref to the current opened NC file.

Definition at line 196 of file polcor_oci.cpp.

◆ getScanAngleForScan()

void getScanAngleForScan ( NcFile &  ncFile)

For each new line, get the CCD scan angle for all pixels

Definition at line 167 of file polcor_oci.cpp.

◆ initializePolCorOci()

void initializePolCorOci ( NcFile &  ncFile)

Function that grabs the m12 and m13 variables and set them in the static variables above for all scans. It also grabs static dim values that will be used for the duration of the program.

Parameters
ncFile- reference the opened NetCDF file

Definition at line 92 of file polcor_oci.cpp.

◆ polcor_oci()

void polcor_oci ( l1str *  l1rec,
int32_t  currPix 
)

For the current scan, grab and merge the blue and red m12 and m13 bands. Also grab the swir bands based on saturation (max 2). Then, for every band, apply the polarization correction for currPix

Parameters
l1rec- L1B file – contains the current scan line this pixel belongs to
currPix- current pixel to apply polcor

Definition at line 314 of file polcor_oci.cpp.