OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
VcstViirsThermal.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * NAME: ViirsThermal.h
4  *
5  * DESCRIPTION: Object class that provides data structures and processes specific
6  * to the processing and management of temperature data required for calibration.
7  * The ViirsGranule object class maintains a pointer to a ViirsThermal object
8  * class, through which it is able to gain access to all available temperature
9  * information.
10  *
11  * Created on: Aug 25, 2014
12  * Author: Sam Anderson, VCST
13  *
14  *******************************************************************************/
15 
16 #ifndef VIIRSTHERMAL_H_
17 #define VIIRSTHERMAL_H_
18 
19 #include <VcstObc.h>
20 #include <VcstCmnGeo.h>
21 #include "VcstCalLutInputItem.h"
22 
23 // Structure of LUT pointers used for temperatures
24 
25 struct tempLutPtrs {
39 };
40 
41 // Define static arrays
42 
43 class ViirsGranule;
44 class VcstObc;
45 
46 class ViirsThermal {
47 public:
48 
49  static constexpr int FOCAL_PLANES = 3;
50  static constexpr int REF_RESISTANCES = 3;
51  static constexpr int TEMP_COEFFS = 6;
52  static constexpr int TEMP_MEASUREMENTS = 2;
53  static constexpr int BB_THERMISTORS = 6;
54  static constexpr int NUM_THERM = 19;
55 
56  static constexpr int TEMP_DN_LOW = -9000;
57  static constexpr int THERM_LOW_VALUE = -8192;
58  static constexpr int THERM_HI_VALUE = 8192;
59 
60  static constexpr int TEB_LUT_SIZE = 65536;
61  static constexpr int TEB_LUT_VALUES = 65528;
62  static constexpr int TEB_LUT_SIZE_M13 = 327681;
63  static constexpr int TEB_LUT_VALUES_M13 = 327671;
64 
65  static constexpr double TOLLERANCE = 1.0E-20; // defined zero
66  static constexpr double LOWBTEMP = 0.0;
67 
68  static constexpr int C_COEFFS = 4;
69  static constexpr int A_COEFFS = 3;
70  static constexpr int T_FP_LEVELS = 5;
71  static constexpr int T_ELEC_LEVELS = 5;
72  static constexpr int DGSTATES = 2;
73 
74  // DCR Coefficients
75 
76  static constexpr float C0_dcr = -5.381061f;
77  static constexpr float C1_dcr = 1.357921e-003f;
78  static constexpr float C2_dcr = 8.193453e-009f;
79  static constexpr float C3_dcr = -1.679609e-012f;
80 
81  static constexpr int DCR_LIMIT = 8192;
82 
83  // Focal plane assembly types
84 
85  static constexpr unsigned char VISNIR = 0;
86  static constexpr unsigned char SMWIR = 1;
87  static constexpr unsigned char LWIR = 2;
88  static constexpr unsigned char BG_DNB = 3;
89  static const unsigned char band_to_fp_[Viirs_Bands];
90 
95  ViirsThermal();
96  ViirsThermal(VcstObc* pObc);
97 
102  ~ViirsThermal();
103 
108  int initialize(GRAN_SEQ_ENUM gran_seq);
109 
122  double interpolate_Temp_to_Rad(int bandIndex,
123  double *array_tp,
124  double *array_rad,
125  int indices[][2],
126  double tp);
127 
140  double interpolate_L_to_EBBT(int bandIndex,
141  double *array_tp,
142  double *array_rad,
143  int indices[][2],
144  double rad);
145 
153 
161 
166  float Telec_[VIIRS_SCANS]; // Calculate C and C'
167  float fp_[FOCAL_PLANES][VIIRS_SCANS]; // Calculate C and C' (Tdet)
168  float Tcav_[VIIRS_SCANS]; // Calibrate TEB
169  float Trta_[VIIRS_SCANS]; // Calibrate TEB
170  float Ttele_[VIIRS_SCANS]; // Calibrate TEB
171  float Tsh_[VIIRS_SCANS]; // Calibrate TEB
172  float mir_avg_[VIIRS_SCANS]; // Calibrate TEB (Tham)
173  float bb_avg_[VIIRS_SCANS]; // Calibrate TEB (Tobc)
176 
177  bool bbTempNotNominal_[VIIRS_SCANS]; //DR4710 bb not nominal (warm up/cool down)
178  bool lwirFPAtempNonNominal_[VIIRS_SCANS]; //DR4501 lwir fpa test
181 
184 
187 
190 
193 
194  // Pointer to VcstObc object class
195 
197 
198  // Pointer to structure of LUT pointer defined above
199 
201 
202  // L1A raw data
228 
229 
230 protected:
231 
236  int initialize_L1A_data(GRAN_SEQ_ENUM gran_seq);
237 
242  int initialize_LUT_data();
243 
244  // Temperature Data
245 
246  unsigned char ft_lw_80k_[VIIRS_SCANS];
247  unsigned char ft_lw_82k_[VIIRS_SCANS];
248 
249 private:
250 
251  // Actual number of scans in granule
252  int act_scans_;
253 
254  //Map to store LUT input item objects.
255 
256  std::map<std::string, VcstLutInputItem*> tempLutItems_;
257 
258  static const float bbSetTempCoefs_[6];
259 
260  struct thermistor_struct {
261  short buffer[VIIRS_SCANS];
262  short max_valid_value;
263  };
264 
265  thermistor_struct thermistors_[NUM_THERM];
266 
267  int quality_flag_[Viirs_Bands][VIIRS_SCANS];
268 
275  float convert_temp_poly(short tdn, float c[6], float toffset);
276 
283  float coeffMult(const float coeffs[], int numCoef, float floatDN);
284 
291  int black_body();
292 
299  int focal_plane();
300 
307  int opto_mechanical();
308 
315  int scan_mirror();
316 
323  int shield();
324 
331  int rta();
332 
339  int telescope();
340 
347  int cavity();
348 
355  int electronics();
356 
363  int generate_rad_bt_lut();
364 
371  short convert14To16bit(short value14bit);
372 
373 
374 };
375 
376 #endif /* VIIRSTEMPERATURES_H_ */
float mir_avg_[VIIRS_SCANS]
int compute_F(VIIRS_BAND_ENUM band)
short ap_sm_cca_[VIIRS_SCANS]
proSdrViirsCalRTAERLUT * RTAERLUT
static constexpr int TEB_LUT_VALUES_M13
short ft_sm_cfpa_lo_rsl_[VIIRS_SCANS]
#define Number_of_Tbands
proSdrViirsCalOBCRRLUT * OBCRRLUT
float F_M_[Number_of_MTbands][VIIRS_SCANS][Mband_detectors][Gain_States]
tempLutPtrs pLut_
short ap_vn_cca_[VIIRS_SCANS]
short mf_scan_cavity_nxp_[VIIRS_SCANS]
proSdrViirsCalEmissiveLUT * EmissiveLUT
proSdrViirsCalTeleCoeffLUT * tCoeffs
VIIRS_BAND_ENUM
static constexpr int TEMP_MEASUREMENTS
float bt_lut_M13_[TEB_LUT_SIZE_M13]
#define Iband_detectors
PARAM_TYPE_NONE Default value No parameter is buried in the product name name_prefix is case insensitive string compared to the product name PARAM_TYPE_VIS_WAVE The visible wavelength bands from the sensor are buried in the product name The product name is compared by appending and name_suffix ie aph_412_giop where prod_ix will be set to PARAM_TYPE_IR_WAVE same search method as PARAM_TYPE_VIS_WAVE except only wavelength above are looped through but prod_ix is still based ie aph_2_giop for the second band
static constexpr int REF_RESISTANCES
static constexpr float C2_dcr
static constexpr double TOLLERANCE
static constexpr unsigned char LWIR
#define Number_of_Ibands
static constexpr int A_COEFFS
static constexpr int T_FP_LEVELS
static constexpr int DGSTATES
short ft_lw_cfpa_hi_rsl_[VIIRS_SCANS]
static constexpr unsigned char BG_DNB
static constexpr int FOCAL_PLANES
bool badInterpolateValue_[VIIRS_SCANS]
double interpolate_L_to_EBBT(int bandIndex, double *array_tp, double *array_rad, int indices[][2], double rad)
short ct_prec_tref_mux1ca3_[VIIRS_SCANS]
unsigned char ft_lw_82k_[VIIRS_SCANS]
float Tcav_[VIIRS_SCANS]
proSdrViirsCalGainTableLUT * GainTable
short ft_lw_cfpa_lo_rsl_[VIIRS_SCANS]
static constexpr int TEMP_COEFFS
#define Mband_detectors
float tp[MODELMAX]
Definition: atrem_corl1.h:173
static constexpr int T_ELEC_LEVELS
short mf_ao_blkhd_px_nz_[VIIRS_SCANS]
#define Parity
float Ttele_[VIIRS_SCANS]
#define Number_of_MTbands
short mf_ham_blkhd_[VIIRS_SCANS]
static constexpr int TEB_LUT_SIZE
double precision function f(R1)
Definition: tmd.lp.f:1454
bool bbTempNotNominal_[VIIRS_SCANS]
float bt_lut_[7][TEB_LUT_SIZE]
float fp_[FOCAL_PLANES][VIIRS_SCANS]
proSdrViirsCalOBCERLUT * OBCERLUT
short ham_tmp1_[VIIRS_SCANS]
float Tsh_[VIIRS_SCANS]
static constexpr int TEB_LUT_SIZE_M13
proSdrViirsCalRMParametersLUT * rmParameters
float RrtaRhamDiff_[Number_of_Tbands][VIIRS_SCANS]
short ct_prec_tref_mux1ca2_[VIIRS_SCANS]
short bbTemp_[VIIRS_SCANS][BB_THERMISTORS]
double C_M_[Number_of_Mbands][VIIRS_SCANS][Mband_detectors][Gain_States][C_Coefs]
static constexpr int TEB_LUT_VALUES
static constexpr int BB_THERMISTORS
static constexpr int THERM_HI_VALUE
float Tomm_[VIIRS_SCANS]
short ap_lw_cca_[VIIRS_SCANS]
short ham_tmp2_[VIIRS_SCANS]
GRAN_SEQ_ENUM
#define Number_of_Mbands
static constexpr int THERM_LOW_VALUE
short mf_tel_blkhd_py_[VIIRS_SCANS]
static constexpr int DCR_LIMIT
proSdrViirsCalLtoEBBTLUT * EBBTLUT
float Trta_[VIIRS_SCANS]
#define Gain_States
bool lwirFPAtempNonNominal_[VIIRS_SCANS]
int compute_C(VIIRS_BAND_ENUM band)
proSdrViirsCalInstrumentResponseLUT * TableB
unsigned char ft_lw_80k_[VIIRS_SCANS]
short mf_scan_cavity_baf_nz_[VIIRS_SCANS]
#define Mirror_Sides
#define Agg_Zones
short ft_vis_nir_fpa_[VIIRS_SCANS]
short ft_sm_cfpa_hi_rsl_[VIIRS_SCANS]
short bb_htr_temp_[VIIRS_SCANS]
short mf_ao_blkhd_nx_pz_[VIIRS_SCANS]
static const unsigned char band_to_fp_[Viirs_Bands]
static constexpr int C_COEFFS
static constexpr float C0_dcr
#define Viirs_Bands
static constexpr float C1_dcr
static constexpr unsigned char SMWIR
float Telec_[VIIRS_SCANS]
short mf_scan_cavity_baf_pz_[VIIRS_SCANS]
#define C_Coefs
const int VIIRS_SCANS
Definition: VcstCmnConsts.h:58
proSdrViirsCalHAMERLUT * HAMERLUT
float bb_avg_[VIIRS_SCANS]
proSdrViirsCalDetectorResponseLUT * TableA
int initialize(GRAN_SEQ_ENUM gran_seq)
float AVG_F_M_[Number_of_MTbands][Mirror_Sides][Mband_detectors][Gain_States]
short mf_fold_mirror_blkhd_[VIIRS_SCANS]
int initialize_L1A_data(GRAN_SEQ_ENUM gran_seq)
int initialize_LUT_data()
static constexpr float C3_dcr
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed as required for compatibility with version of the SDP toolkit Corrected test output file names to end in per delivery and then split off a new MYD_PR03 pcf file for Aqua Added AssociatedPlatformInstrumentSensor to the inventory metadata in MOD01 mcf and MOD03 mcf Created new versions named MYD01 mcf and MYD03 where AssociatedPlatformShortName is rather than Terra The program itself has been changed to read the Satellite Instrument validate it against the input L1A and LUT and to use it determine the correct files to retrieve the ephemeris and attitude data from Changed to produce a LocalGranuleID starting with MYD03 if run on Aqua data Added the Scan Type file attribute to the Geolocation copied from the L1A and attitude_angels to radians rather than degrees The accumulation of Cumulated gflags was moved from GEO_validate_earth_location c to GEO_locate_one_scan c
Definition: HISTORY.txt:464
float AVG_F_I_[Number_of_ITbands][Mirror_Sides][Iband_detectors][Agg_Zones][Parity]
static constexpr int TEMP_DN_LOW
short mf_stopassy_baff_nz_[VIIRS_SCANS]
double interpolate_Temp_to_Rad(int bandIndex, double *array_tp, double *array_rad, int indices[][2], double tp)
static constexpr double LOWBTEMP
short dp_dnb_cca_[VIIRS_SCANS]
proSdrViirsCalBBTempCoeffs * bBTempCoeffs
static constexpr unsigned char VISNIR
float F_I_[Number_of_ITbands][VIIRS_SCANS][Iband_detectors][Agg_Zones][Parity]
double C_I_[Number_of_Ibands][VIIRS_SCANS][Iband_detectors][C_Coefs]
static constexpr int NUM_THERM
#define Number_of_ITbands
short ct_prec_tref_mux1ca1_[VIIRS_SCANS]
bool badThermValue_[VIIRS_SCANS]
proSdrViirsCalDeltaCTempLUT * DeltaCTable