OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
readL2scan.h
Go to the documentation of this file.
1 #ifndef READL2SCAN_H
2 #define READL2SCAN_H
3 
4 #include <dfutils.h>
5 
6 #define byte unsigned char
7 
8 #define MAXNFILES 10000 /* Increase to 544 09/25/06 JMG - 800 WDR */
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 typedef struct l2prod_struct {
15  int32_t fileindex;
16 
17  char filename[128];
18  char oformat[32];
19 
20  int32_t nrec;
21  int32_t nsamp;
22 
23  int16_t syear;
24  int16_t sday;
25  int32_t smsec;
26  int16_t eyear;
27  int16_t eday;
28  int32_t emsec;
29  int32_t orbit;
30  char dtype[8];
31 
32  int32_t ntilts;
33  int16_t tilt_flags[20];
34  int16_t tilt_ranges[2][20];
35 
36  char *flagnames;
37  int32_t flagmask;
38 
39  int32_t year;
40  int32_t day;
41  int32_t msec;
42 
43  int32_t *year_cache;
44  int32_t *day_cache;
45  int32_t *msec_cache;
46 
47  float *longitude;
48  float *latitude;
49 
50  float *geonav[6];
51 
52  float *lon_cntl;
53  float *lat_cntl;
54  float *cntl_pnts;
56  float *spline_arr;
57 
58  int32_t nprod;
59  char *prodname[1000];
60  float bv_unscaled[1000];
61  int16_t bv_scaled[1000];
62  int32_t thirdDim[1000];
63 
64  float **l2_data;
65  int32_t *l2_flags;
66 
67  byte eng_qual[4];
68  byte s_flags[4];
69  int32_t nflag[8];
70 
71  int32_t geointerp;
72 
73  byte *mside;
74  byte *detnum;
75  int32_t *pixnum;
76 
77  // area weighting variables
78  float *lat1; // lat1 for corner of pixel
79  float *lon1; // lon1 for corner of pixel
80  float *lat2; // lat2 for corner of pixel
81  float *lon2; // lon2 for corner of pixel
82  byte lat2Valid; // does lat2 and lon2 contain valid coordinates
83 
84  int wavelength[250];
85 
86  int32_t bandsPerPixel;
87 } l2_prod;
88 
89 typedef struct meta_l2Struct {
90  char *product_name; /* ATTR Product name(file name) */
91  char *title;
92  char *data_center; /* ATTR data_center, processing center */
93  char *mission; /* ATTR mission */
94  char *mission_char; /* ATTR Mission Characteristics */
95  char *sensor_name; /* ATTR sensor name */
96  char *sensor; /* ATTR sensor */
97  char *sensor_char; /* ATTR instrumentInformation */
98  char *sw_id; /* ATTR Software ID */
99  char *infiles; /* ATTR Input files */
100  char *stime; /* ATTR Start time */
101  char *etime; /* ATTR End time */
102  char *ctime; /* ATTR scene center time */
103  char *ntime; /* ATTR Node crossing time */
104  char *snode; /* ATTR Start Node */
105  char *enode; /* ATTR End Node */
106  int orbnum; /* ATTR orbit number */
107  char *norad1; /* ATTR NORAD elements, first line */
108  char *norad2; /* ATTR NORAD elements, second line */
109  int pix_start; /* ATTR LAC Pixel Start Number */
110  int pix_sub; /* ATTR LAC Pixel Subsampling */
111  int ncrec; /* ATTR scene center scan line */
112  int nfrec; /* ATTR number of filled scan line */
113  byte ff_mis; /* ATTR FF missing frames */
114  byte sd_mis; /* ATTR SDPS missing frames */
115  float flags_pc[32]; /* MFSD % data for each quality flag */
116  char *lat_units; /* ATTR Latitude units */
117  char *lon_units; /* ATTR Longitude units */
118  float northlat; /* ATTR Northernmost latitude */
119  float southlat; /* ATTR Southernmost latitude */
120  float westlon; /* ATTR Westernmost longitude */
121  float eastlon; /* ATTR Easternmost longitude */
122  float startclat; /* ATTR Start Center Latitude */
123  float startclon; /* ATTR Start Center Longitude */
124  float endclat; /* ATTR End Center Latitude */
125  float endclon; /* ATTR End Center Longitude */
126  float nodel; /* ATTR Orbit node longitude */
127  int ntilts; /* MFSD Sensor Tilt */
128  /* Calibration Vgroup */
129  short entry_year;
130  short entry_day;
131  short ref_year;
132  short ref_day;
133  short ref_minute;
134 } meta_l2Type;
135 
136 
137 /* Prototypes */
138 void free_rowgroup_cache();
139 void init_rowgroup_cache();
140 int32_t get_dtype(int32_t dtype, ds_format_t fileformat);
141 int32_t openL2(const char *, char *, l2_prod *);
142 int32_t reopenL2(int32_t, l2_prod *);
143 int32_t readL2(l2_prod *l2_str, int32_t ifile, int32_t recnum, int32_t iprod,
144  unsigned char *scan_in_rowgroup);
145 int32_t readlonlat(l2_prod *l2_str, int32_t ifile, int32_t *start, int32_t *edges,
146  unsigned char *scan_in_rowgroup);
147 int32_t closeL2(l2_prod *, int32_t);
148 int32_t freeL2(l2_prod *);
149 int32_t findprod(l2_prod *, char*);
150 int32_t readL2meta(meta_l2Type *, int32_t);
151 int32_t freeL2meta(meta_l2Type *);
152 int32_t getL3units(l2_prod *, int32_t, char *, char *);
153 
155 
162 
163 #ifdef __cplusplus
164 }
165 #endif
166 #endif
float * lat2
Definition: readL2scan.h:80
char * product_name
Definition: readL2scan.h:90
@ L2PixelOff
Definition: readL2scan.h:154
float * spline_arr
Definition: readL2scan.h:56
float * lon_cntl
Definition: readL2scan.h:52
float * latitude
Definition: readL2scan.h:48
int32_t * year_cache
Definition: readL2scan.h:43
char * data_center
Definition: readL2scan.h:92
int32_t ntilts
Definition: readL2scan.h:32
float bv_unscaled[1000]
Definition: readL2scan.h:60
float startclat
Definition: readL2scan.h:122
float * lon2
Definition: readL2scan.h:81
byte * mside
Definition: readL2scan.h:73
float flags_pc[32]
Definition: readL2scan.h:115
@ L2PixelCorner
Definition: readL2scan.h:154
int16_t tilt_ranges[2][20]
Definition: readL2scan.h:34
int32_t msec
Definition: readL2scan.h:41
float * cntl_pnts_cache
Definition: readL2scan.h:55
int32_t bandsPerPixel
Definition: readL2scan.h:86
float * longitude
Definition: readL2scan.h:47
char * lon_units
Definition: readL2scan.h:117
char oformat[32]
Definition: readL2scan.h:18
char * enode
Definition: readL2scan.h:105
char * lat_units
Definition: readL2scan.h:116
int32_t nsamp
Definition: readL2scan.h:21
char * ctime
Definition: readL2scan.h:102
short ref_minute
Definition: readL2scan.h:133
int32_t freeL2meta(meta_l2Type *)
Definition: readL2scan.c:2255
int16_t tilt_flags[20]
Definition: readL2scan.h:33
float * cntl_pnts
Definition: readL2scan.h:54
int wavelength[250]
Definition: readL2scan.h:84
int32_t freeL2(l2_prod *)
Definition: readL2scan.c:2026
float * geonav[6]
Definition: readL2scan.h:50
void init_rowgroup_cache()
Definition: readL2scan.c:265
char * stime
Definition: readL2scan.h:100
int32_t emsec
Definition: readL2scan.h:28
int32_t reopenL2(int32_t, l2_prod *)
Definition: readL2scan.c:975
@ L2PixelDelta
Definition: readL2scan.h:154
char * norad2
Definition: readL2scan.h:108
int32_t geointerp
Definition: readL2scan.h:71
int32_t closeL2(l2_prod *, int32_t)
Definition: readL2scan.c:1936
int32_t year
Definition: readL2scan.h:39
byte * detnum
Definition: readL2scan.h:74
int16_t bv_scaled[1000]
Definition: readL2scan.h:61
short entry_day
Definition: readL2scan.h:130
char * prodname[1000]
Definition: readL2scan.h:59
read recnum
char * sw_id
Definition: readL2scan.h:98
int32_t fileindex
Definition: readL2scan.h:15
float ** l2_data
Definition: readL2scan.h:64
void free_rowgroup_cache()
Definition: readL2scan.c:236
float northlat
Definition: readL2scan.h:118
char * snode
Definition: readL2scan.h:104
short entry_year
Definition: readL2scan.h:129
int32_t findprod(l2_prod *, char *)
Definition: readL2scan.c:2071
int32_t * msec_cache
Definition: readL2scan.h:45
int32_t readL2(l2_prod *l2_str, int32_t ifile, int32_t recnum, int32_t iprod, unsigned char *scan_in_rowgroup)
Definition: readL2scan.c:1250
char * mission
Definition: readL2scan.h:93
int32_t thirdDim[1000]
Definition: readL2scan.h:62
int32_t * l2_flags
Definition: readL2scan.h:65
char * ntime
Definition: readL2scan.h:103
char * infiles
Definition: readL2scan.h:99
char * norad1
Definition: readL2scan.h:107
int32_t smsec
Definition: readL2scan.h:25
char * title
Definition: readL2scan.h:91
int32_t getL3units(l2_prod *, int32_t, char *, char *)
Definition: readL2scan.c:2274
char * mission_char
Definition: readL2scan.h:94
int16_t eday
Definition: readL2scan.h:27
int32_t nflag[8]
Definition: readL2scan.h:69
float * lon1
Definition: readL2scan.h:79
int32_t get_dtype(int32_t dtype, ds_format_t fileformat)
Definition: readL2scan.c:211
L2PixelMode_t
Definition: readL2scan.h:154
char * sensor_char
Definition: readL2scan.h:97
char * sensor
Definition: readL2scan.h:96
int32_t day
Definition: readL2scan.h:40
char * flagnames
Definition: readL2scan.h:36
dtype
Definition: DDataset.hpp:31
short ref_year
Definition: readL2scan.h:131
int32_t openL2(const char *, char *, l2_prod *)
Definition: readL2scan.c:296
int32_t readlonlat(l2_prod *l2_str, int32_t ifile, int32_t *start, int32_t *edges, unsigned char *scan_in_rowgroup)
Definition: readL2scan.c:1745
float southlat
Definition: readL2scan.h:119
int16_t syear
Definition: readL2scan.h:23
char * etime
Definition: readL2scan.h:101
int32_t nrec
Definition: readL2scan.h:20
void enableL2PixelArea(enum L2PixelMode_t val)
Definition: readL2scan.c:193
ds_format_t
Definition: dfutils.h:18
char filename[128]
Definition: readL2scan.h:17
int32_t readL2meta(meta_l2Type *, int32_t)
Definition: readL2scan.c:2081
float startclon
Definition: readL2scan.h:123
int16_t eyear
Definition: readL2scan.h:26
float * lat1
Definition: readL2scan.h:78
msiBandIdx val
Definition: l1c_msi.cpp:34
char * sensor_name
Definition: readL2scan.h:95
int32_t flagmask
Definition: readL2scan.h:37
float * lat_cntl
Definition: readL2scan.h:53
int32_t nprod
Definition: readL2scan.h:58
byte s_flags[4]
Definition: readL2scan.h:68
byte lat2Valid
Definition: readL2scan.h:82
int32_t orbit
Definition: readL2scan.h:29
int32_t * day_cache
Definition: readL2scan.h:44
int32_t * pixnum
Definition: readL2scan.h:75
int16_t sday
Definition: readL2scan.h:24