OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
mtl_grid.h
Go to the documentation of this file.
1 /*
2  * Name: mtl_grid.h
3  *
4  * Purpose: Include file defining structures and function prototypes
5  * for scene gridding for angle generation.
6  */
7 #ifndef _MTL_GRID_
8 #define _MTL_GRID_
9 
10 #include "mtl_geometry.h"
11 #include "smeta_exploit.h"
12 #include "smeta_geometry.h"
13 
14 #define NUM_GRID_COL 9
15 #define NUM_GRID_ROW 15
16 #define NUM_GRID_ROW_LS 13
17 #define GRID_COL_INC 0.25
18 #define GRID_ROW_INC 0.1
19 #define GRID_ROW_BASE -0.7
20 #define GRID_ROW_BASE_LS -0.6
21 #define GRID_COL_BASE -1.0
22 
23 typedef struct MTL_GRID_PT
24 {
25  double npix; /* Normalized pixel coordinate - added for older LS */
26  double ndet; /* Normalized detector coordinate */
27  double frow; /* Fractional row offset */
28  double l1t_line; /* L1T line coordinate */
29  double l1t_samp; /* L1T sample coordinate */
30  VECTOR V; /* LSR view vector */
31  VECTOR S; /* LSR sun vector */
32 } MTL_GRID_PT;
33 
34 typedef struct MTL_GRID_SCA
35 {
36  int sca; /* SCA number */
37  double min_line; /* Minimum line coordinate */
38  double max_line; /* Maximum line coordinate */
39  double min_samp; /* Minimum sample coordinate */
40  double max_samp; /* Maximum sample coordinate */
41  MTL_GRID_PT pgrid[NUM_GRID_ROW][NUM_GRID_COL]; /* SCA grid points */
42  double ls_to_ndet[4]; /* Line/samp to ndet coefficients */
43  double ls_to_frow[4]; /* Line/samp to frow coefficients */
44 } MTL_GRID_SCA;
45 
46 typedef struct MTL_GRID_SCA_LS
47 {
48  int sca; /* SCA number */
49  double min_line; /* Minimum line coordinate */
50  double max_line; /* Maximum line coordinate */
51  double min_samp; /* Minimum sample coordinate */
52  double max_samp; /* Maximum sample coordinate */
53  MTL_GRID_PT pgrid[NUM_GRID_ROW_LS][NUM_GRID_COL]; /* SCA grid points */
54  double ls_to_ndet[4]; /* Line/samp to ndet coefficients */
55  double ls_to_frow[4]; /* Line/samp to frow coefficients */
57 
58 typedef struct MTL_GRID_BAND
59 {
60  int band; /* Band number */
61  int nsca; /* Number of SCAs */
62  /* Sudipta new addition for OLI to extract SCA and Det numbers */
63  int num_detectors; /* Number of detectors per SCA */
64  /* End Sudipta new addition for OLI */
65  MTL_GRID_SCA *sgrid; /* Array of SCA grids */
67 
68 typedef struct MTL_GRID_BAND_LS
69 {
70  int band; /* Band number */
71  int nsca; /* Number of SCAs */
72  MTL_GRID_SCA_LS *sgrid; /* Array of SCA grids */
74 
75 int calc_band_grid(
76  WRS2 parms, /* I: WRS2 system parameters */
77  SMETA smeta, /* I: Scene metadata structure */
78  double dellon, /* I: Path longitude adjustment (in degrees) */
79  VECTOR ecfsun, /* I: ECF sun vector */
80  int band_index, /* I: Index for current band */
81  MTL_GRID_BAND *bgrid ); /* O: Band grid structure */
82 
83 /* variant for older LS */
85  WRS2 parms, /* I: WRS2 system parameters */
86  SMETA smeta, /* I: Scene metadata structure */
87  double dellon, /* I: Path longitude adjustment (in degrees) */
88  VECTOR ecfsun, /* I: ECF sun vector */
89  int band_index, /* I: Index for current band */
90  MTL_GRID_BAND_LS *bgrid ); /* O: Band grid structure */
91 
92 int calc_grid_point(
93  WRS2 parms, /* I: WRS2 system parameters */
94  SMETA smeta, /* I: Scene metadata structure */
95  double dellon, /* I: Path longitude adjustment (in degrees) */
96  int band_index, /* I: Index for current band */
97  int sca, /* I: SCA number (1 to nsca) */
98  VECTOR ecfsun, /* I: ECF sun vector */
99  MTL_GRID_PT *gpt ); /* I/O: Grid point with only ndet and frow on input */
100 
101 
102 int calc_grid_fit(
103  MTL_GRID_SCA *sgrid ); /* I/O: SCA grid array to compute polynomial fit for */
104 
105 /* variant of calc_grid_fit for older LS */
106 int calc_grid_fit_ls(
107  MTL_GRID_SCA_LS *sgrid ); /* I/O: SCA grid array to compute polynomial fit for */
108 
109 int simple_inverse(
110  int n, /* I: Dimension of matrix to invert */
111  double a[4][4] ); /* I/O: Matrix to invert */
112 
113 int smeta_angles(
114  double line, /* I: L1T line coordinate */
115  double samp, /* I: L1T sample coordinate */
116  MTL_GRID_BAND bgrid, /* I: MTL grid structure for current band */
117  /* Sudipta new addition for OLI to extract SCA and Det numbers */
118  short *sca_num, /* O: SCA containing current point */
119  short *det_num, /* O: Detector generating current point */
120  /* End Sudipta new addition for OLI */
121  double *sat_zn, /* O: Viewing zenith angle scaled to 0.01 degrees */
122  double *sat_az, /* O: Viewing azimuth angle scaled to 0.01 degrees */
123  double *sun_zn, /* O: Solar zenith angle scaled to 0.01 degrees */
124  double *sun_az ); /* O: Solar azimuth angle scaled to 0.01 degrees */
125 
126 
127 int smeta_angles_ls(
128  double line, /* I: L1T line coordinate */
129  double samp, /* I: L1T sample coordinate */
130  MTL_GRID_BAND_LS bgrid, /* I: MTL grid structure for current band */
131  short *sat_zn, /* O: Viewing zenith angle scaled to 0.01 degrees */
132  short *sat_az, /* O: Viewing azimuth angle scaled to 0.01 degrees */
133  short *sun_zn, /* O: Solar zenith angle scaled to 0.01 degrees */
134  short *sun_az ); /* O: Solar azimuth angle scaled to 0.01 degrees */
135 #endif
double max_samp
Definition: mtl_grid.h:52
double frow
Definition: mtl_grid.h:27
int calc_grid_fit_ls(MTL_GRID_SCA_LS *sgrid)
Definition: mtl_grid.c:223
int smeta_angles(double line, double samp, MTL_GRID_BAND bgrid, short *sca_num, short *det_num, double *sat_zn, double *sat_az, double *sun_zn, double *sun_az)
Definition: mtl_grid.c:485
MTL_GRID_SCA_LS * sgrid
Definition: mtl_grid.h:72
MTL_GRID_PT pgrid[NUM_GRID_ROW][NUM_GRID_COL]
Definition: mtl_grid.h:41
MTL_GRID_PT pgrid[NUM_GRID_ROW_LS][NUM_GRID_COL]
Definition: mtl_grid.h:53
double min_samp
Definition: mtl_grid.h:39
int calc_band_grid_ls(WRS2 parms, SMETA smeta, double dellon, VECTOR ecfsun, int band_index, MTL_GRID_BAND_LS *bgrid)
Definition: mtl_grid.c:91
double max_line
Definition: mtl_grid.h:38
double min_line
Definition: mtl_grid.h:49
VECTOR V
Definition: mtl_grid.h:30
VECTOR S
Definition: mtl_grid.h:31
int calc_grid_point(WRS2 parms, SMETA smeta, double dellon, int band_index, int sca, VECTOR ecfsun, MTL_GRID_PT *gpt)
Definition: mtl_grid.c:315
int calc_band_grid(WRS2 parms, SMETA smeta, double dellon, VECTOR ecfsun, int band_index, MTL_GRID_BAND *bgrid)
Definition: mtl_grid.c:14
int num_detectors
Definition: mtl_grid.h:63
double ls_to_frow[4]
Definition: mtl_grid.h:55
#define NUM_GRID_ROW_LS
Definition: mtl_grid.h:16
#define NUM_GRID_COL
Definition: mtl_grid.h:14
double ls_to_ndet[4]
Definition: mtl_grid.h:42
double l1t_line
Definition: mtl_grid.h:28
double ndet
Definition: mtl_grid.h:26
int smeta_angles_ls(double line, double samp, MTL_GRID_BAND_LS bgrid, short *sat_zn, short *sat_az, short *sun_zn, short *sun_az)
Definition: mtl_grid.c:644
double max_samp
Definition: mtl_grid.h:40
MTL_GRID_SCA * sgrid
Definition: mtl_grid.h:65
double min_line
Definition: mtl_grid.h:37
double npix
Definition: mtl_grid.h:25
double l1t_samp
Definition: mtl_grid.h:29
double min_samp
Definition: mtl_grid.h:51
double ls_to_ndet[4]
Definition: mtl_grid.h:54
double max_line
Definition: mtl_grid.h:50
Definition: smeta.h:118
double ls_to_frow[4]
Definition: mtl_grid.h:43
int calc_grid_fit(MTL_GRID_SCA *sgrid)
Definition: mtl_grid.c:153
PGE01 indicating that PGE02 PGE01 V6 for and PGE01 V2 for MOD03 were used to produce the granule By convention adopted in all MODIS Terra PGE02 code versions are The fourth digit of the PGE02 version denotes the LUT version used to produce the granule The source of the metadata environment variable ProcessingCenter was changed from a QA LUT value to the Process Configuration A sign used in error in the second order term was changed to a
Definition: HISTORY.txt:424
int simple_inverse(int n, double a[4][4])
Definition: mtl_grid.c:292
#define NUM_GRID_ROW
Definition: mtl_grid.h:15