OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_cal_gain.c
Go to the documentation of this file.
1 #include "viirs_sim_sdr.h"
2 
3 int get_cal_gain(char *file, unsigned char ham, int det, int *nf_bands,
4  int *nf_gains, c0_sub, c1_sub, c2_sub, dark, lt_max_hg)
5 /*-----------------------------------------------------------------------------
6  Routine: get_cal_gain.c
7 
8  Description: provide the gain coefficients, the dark count, and the
9  maximum Lt value in high gain mode for a specific ham side and line in
10  the scan. Gain coefficients and dark count are for band, gain
11  setting and lt_max_hg is for the band
12 
13  Returns type: int - 0 if good, else I/O error
14 
15  Arguments:
16  Type Name I/O Description
17  ---- ---- --- -----------
18  char * file I calibration file name
19  unsigned char ham I the ham side for this scan
20  int idet I detector number to access
21  int * nf_bands O # bands in gain file
22  int * nf_gains O # gains in gain file (should be 2 max)
23  float * c0_sub O 0 order coefficients for gain, low gain
24  followed by high gain values
25  float * c1_sub O 1st order coefficients for gain, low gain
26  followed by high gain values
27  float * c2_sub O 2nd order coefficients for gain, low gain
28  followed by high gain values
29  float * dark_sub O dark count for bands low gain
30  followed by high gain values
31  float * lt_max_hg_sub O Lt at max high gain state for bands
32 
33  Note that the c0_sub, c1_sub, c2_sub, dark_sub, lt_max_hg_sub
34  are pointers passed in, the
35  routine will alocate the space needed for these
36 
37  Modification history:
38 
39  W. Robinson, SAIC 16 Sep 2010 Original development
40 
41 ----------------------------------------------------------------------------*/ {
42  int nf_ham, nf_det;
43  static float *c0, *c1, *c2, *dark, *lt_max_hg;
44  /*
45  * read in all the info from the hdf file
46  */
47  if (first_time) {
48  if (setup_gain1(nf_bands, nf_gains, &nf_ham, &nf_det,
49  c0, c1, c2, dark, lt_max_hg) != 0) return 1;
50  /*
51  if( setup_gain2( file, nf_bands, nf_gains, &nf_ham, &nf_det,
52  c0, c1, c2, dark, lt_max_hg ) != 0 )
53  */
54  /*
55  *
56  }
57  /*
58  * do mallocs for the space to read in the coefficients
59  */
60  c0
61 
62  c1
63 
64  c2
65 
66  dark_lcl
67 
68  lt_max_hg_lcl
69 
70  /*
71  * finish up with file
72  */
73  close
74  }
75  /*
76  * transfer the correct values for specific ham and detector
77  */
78  for (ibnd = 0; ibnd <#bands; ibnd++ )
79  {
80  lt_max_hg[ibnd] = lt_max_hg_lcl[ibnd];
81 
82  for (igain = 0; igain < 2; igain++) {
83  *(c0_sub + ibnd + nbnd * igain) = *(c0 + INDEXING ? ? ?)
84 
85  about same
86 
87  for c1, c2, dark
88  }
89  }
90 }
91 int setup_gain1(int *nf_bands, int *nf_gains, int *nf_ham, int *nf_det,
92  float *c0, float *c1, float *c2, float *dark, float *lt_max_hg) {
93  /*
94  * set the sizes
95  * allocate the storage
96  /*
97  * open the hdf 5 file with the gain info and get the data
98  */
99  open
100 
101  read c0
102 
103  read c1
104 
105  read c2
106 
107  read dark_lcl
108 
109  read lt_max_hg_lcl
110 
111  * move all locally stored coeffs to storage
112  * finished
113  */
114  return 0;
115  /*
116  for the gain2 which will read the hdf 5 file:
117  */
118 }
int setup_gain1(int *nf_bands, int *nf_gains, int *nf_ham, int *nf_det, float *c0, float *c1, float *c2, float *dark, float *lt_max_hg)
Definition: get_cal_gain.c:91
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 file
Definition: HISTORY.txt:413
int nbnd
Definition: get_cmp.c:29
int get_cal_gain(char *file, unsigned char ham, int det, int *nf_bands, int *nf_gains, c0_sub, c1_sub, c2_sub, dark, lt_max_hg)
Definition: get_cal_gain.c:3
this program makes no use of any feature of the SDP Toolkit that could generate such a then geolocation is calculated at that and then aggregated up to Resolved feature request Bug by adding three new int8 SDSs for each high resolution offsets between the high resolution geolocation and a bi linear interpolation extrapolation of the positions This can be used to reconstruct the high resolution geolocation Resolved Bug by delaying cumulation of gflags until after validation of derived products Resolved Bug by setting Latitude and Longitude to the correct fill resolving to support Near Real Time because they may be unnecessary if use of entrained ephemeris and attitude data is turned resolving bug report Corrected to filter out Aqua attitude records with missing status helping resolve bug MOD_PR03 will still correctly write scan and pixel data that does not depend upon the start thereby resolving MODur00108 Changed header guard macro names to avoid reserved name resolving MODur00104 Maneuver list file for Terra satellite was updated to include data from Jecue DuChateu Maneuver list files for both Terra and Aqua were updated to include two maneuvers from recent IOT weekly reports The limits for Z component of angular momentum was and to set the fourth GEO scan quality flag for a scan depending upon whether or not it occurred during one of them Added _FillValue attributes to many and changed the fill value for the sector start times from to
Definition: HISTORY.txt:295