OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
l1a_hawkeye.c File Reference
#include <nc4utils.h>
#include "l1.h"
#include "libnav.h"
#include <productInfo.h>
#include <allocate2d.h>
#include <allocate3d.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <libgen.h>
#include <math.h>
#include <timeutils.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_spline.h>
#include <gsl/gsl_sort.h>
#include <gsl/gsl_statistics.h>
#include <stdbool.h>
#include "l1a_hawkeye.h"
Include dependency graph for l1a_hawkeye.c:

Go to the source code of this file.

Functions

void qc_hawkeye_CCD_T ()
 
void read_cal_hawkeye (char *cal_path)
 
void interp_hawkeye_CCD_T (double delta_time_ms_i)
 
void calibrate_hawkeye (double current_julian_date, int line)
 
double nan_wmean (double *weights, double *data, size_t n, double fill_value)
 
void prep_for_interp_double (double *xi, double *x, int N)
 
int openl1a_hawkeye (filehandle *file)
 
void calc_bkg_hawkeye ()
 
int readl1a_hawkeye (filehandle *file, int32_t oline, l1str *l1rec)
 
int closel1a_hawkeye (filehandle *file)
 

Function Documentation

◆ calc_bkg_hawkeye()

void calc_bkg_hawkeye ( )

Calculate average dark counts for background subtraction

Definition at line 435 of file l1a_hawkeye.c.

◆ calibrate_hawkeye()

void calibrate_hawkeye ( double  current_julian_date,
int  line 
)

Apply instrument calibration, converting dn into Lt.

Parameters
current_julian_date
Returns

Definition at line 1069 of file l1a_hawkeye.c.

◆ closel1a_hawkeye()

int closel1a_hawkeye ( filehandle *  file)

Close L1A file, GEO file, and free memory

Parameters
file
Returns

Definition at line 715 of file l1a_hawkeye.c.

◆ interp_hawkeye_CCD_T()

void interp_hawkeye_CCD_T ( double  delta_time_ms_i)

The array CCD_temperatures_cleansed has dimensions num_tlm_blocks_cleansed x num_ccd_temps. Given the input value of delta_time_ms_i, we interpolate on the first dimension, generating the array CCD_temperatures_this_scan, having dimension 1 x num_ccd_temps

Parameters
delta_time_ms_i

Definition at line 1027 of file l1a_hawkeye.c.

◆ nan_wmean()

double nan_wmean ( double *  weights,
double *  data,
size_t  n,
double  fill_value 
)

Definition at line 1178 of file l1a_hawkeye.c.

◆ openl1a_hawkeye()

int openl1a_hawkeye ( filehandle *  file)

Open the hawkeye L1A file and perform some one-time tasks (as opposed to tasks that are per scan), including: -Get L1A dimensions num_scans, num_bands, num_pixels, num_ccd_temps, num_tlm_blocks (static). Allocate memory for some static arrays based upon these dimensions. -Get L1A group ids e.g. l1aScanLineGrp, l1aEarthViewGrp and it's 8 "band_%d" var ids (static) -Get L1A CCD_temperatures and tlm_delta_time_ms, and call qc_hawkeye_CCD_T to create cleansed versions of these arrays (static). -Get L1A "time_coverage_start" and "time_coverage_end" to derive time_interval (static) etc.

Get

Parameters
file
Returns

Definition at line 161 of file l1a_hawkeye.c.

◆ prep_for_interp_double()

void prep_for_interp_double ( double *  xi,
double *  x,
int  N 
)

If xi is outside the range of x, set it to the nearest neighbor.

Parameters
xi
x
N

Definition at line 1205 of file l1a_hawkeye.c.

◆ qc_hawkeye_CCD_T()

void qc_hawkeye_CCD_T ( )

Perform quality control on the CCD_temperatures[num_tlm_blocks][num_ccd_temps] and its time base tlm_delta_time_ms[num_tlm_blocks], creating cleansed versions of both of these arrays. Cleansing includes the following rules: -If one or more CCD_temperatures for a given tlm block are FILL, replace them with the mean value of the non-FILL temperatures. -Identify possibly bad (extreme) values for CCD temperatures e.g. if one of the 4 CCD thermistors has a value much different from the others. -If ALL the CCD temperatures for a given tlm block are FILL, skip this tlm block. -If there are no good tlm blocks, manufacture 2 good rows using a default value for CCD temperature.

Definition at line 763 of file l1a_hawkeye.c.

◆ read_cal_hawkeye()

void read_cal_hawkeye ( char *  cal_path)

Get calibration coefficients (for instrument calibration) from the specified calibration file and store them in static arrays. These arrays K1-K5, time_ref, and temperature_ref have already been declared static. Here in read_cal_hawkeye, we determine their dimensions, allocate memory to them, and populate them.

Parameters
cal_path

Definition at line 895 of file l1a_hawkeye.c.

◆ readl1a_hawkeye()

int readl1a_hawkeye ( filehandle *  file,
int32_t  oline,
l1str *  l1rec 
)

Read the specified scan line from the specified L1A file. If this is the first call, call read_cal_hawkeye to read the calibration file, which stores calibration coefficients (for instrument calibration) in static arrays. For each scan, get scan_delta_time_ms and use it to call interp_hawkeye_CCD_T, which sets CCD_temperatures_this_scan[num_ccd_temps]. Then, apply the instrument cal by calling calibrate_hawkeye. Store Lt in l1rec->Lt. Read GEO file.

Parameters
file
line
l1rec
Returns

Definition at line 499 of file l1a_hawkeye.c.