NASA Logo
Ocean Color Science Software

ocssw V2022
l1c_filehandle.h
Go to the documentation of this file.
1 /*
2  * File: l1c_filehandle.h
3  * Author: mmontes
4  *
5 ---------------------------------------------------------
6 l1cgen firstly defined as mainL1C.cpp
7  Created by Martin Montes on 8/15/2022
8  last version 3/7/2022
9 ---------------------------------------------------------
10  */
11 
12 #ifndef L1C_FILEHANDLE_H
13 #define L1C_FILEHANDLE_H
14 
15 #include <stdio.h>
16 #include <string>
17 #include <vector>
18 #include <filetype.h>
19 
20 #define READ 0
21 #define WRITE 1
22 
23 namespace l1c {
24 
26  protected:
27  public:
28  // methods---
30  virtual ~l1c_filehandle();
31  virtual void printProducts();
32  // global attributes----
35  std::string l1b_name; // just the input l1b filenamed
36  size_t sd_id;
37 
38  // more L1C input vars
39  bool verbose;
40  size_t swath_num;
41  int16_t swath_scans;
42  int16_t selgran[10]; // selected granule ids for L1C processing
43  const char *gridname; // name for l1cgrid having 2-d lon,lat gd points
44  const char *azeast_name; // filename of az_east in degrees
45  size_t l1c_pflag; // L1C processing 0:no processing, 1:full orbit, 2: full swath, half-day daytime, 3:
46  // L1C grid generation, 4: 5-minute granule file
47  std::vector<std::string> cust_l1cprod; // list of L1c products to be included, flexible approach
48  std::vector<std::string> ifiles;
49  file_type format; // file type, netcdf4 or hdf4/5
50  // size_t mode;//read/write file mode
51  size_t length; // data block
52  size_t sensorID; // original int32 changed to size_t type
53  size_t subsensorID;
54  float res_spat; // spatial resolution in km
55  float res_spec; // spectral resolution in nm
56 
57  // time-space limits of image
58  int16_t syear;
59  int16_t sday;
60  float minlat_img;
61  float maxlat_img;
62  float minlon_img;
63  float maxlon_img;
64 
65  // dimensions--
66  size_t nframes;
67  size_t ndets;
68  size_t nscan;
69  size_t n_views; // sensor views
70  size_t npols; // polarization states
71  size_t nbands; // number of total intensity bands
72  size_t nband_blue; // this includes uv + visible bands
73  size_t nband_red; // this includes nir + visible bands
74  size_t nband_swir;
75  size_t nband_view;
77  size_t npix; // number of pixels per line or across-track --x component
78 
79  // sensor characteritics
80  float *views; // indexes are not defined
81  size_t pols[3]; //[1 0 0] non-pol, [1 1 0]: non+cross, [1 1 1]: non+cross+parall
82  float *bbands; // array with bands wavelengths
83  float *rbands;
84  float *swirbands;
85 
86  // navigation attributes
87  // swath attr here
88  size_t orbit_number;
89  size_t orb_dir; // asc or desc orbit 1 or 0 respectively
90  float orbit_node_lon; // long at which is crossing the equator asc or desc
91  double eqt; // equat crossing time
92  std::string tswt_ini; // UTC initial time of swath
93  std::string tswt_end; // UTC ennd time of swath
101 
102  double tunix_start; // unix time
103  double tg_s;
104  double tg_e;
105  int numgran;
106  double tfile_ini_sec; // unix time seconds since 1970
108 
109  // telemetry stauff----L1A--HKT
110  int fileix;
111  int gransize; // granule size in minutes
112  int32_t gd_per_gran; // #gridlines per granule time
113  int gran_ini_timeflag; // initial time for L1C granule
114 
115  // geolocation attributes
118  float *cloud_height; // should be in geolocation group nc file
119 
120  // calibration attributes
121  float *Fobar;
122 
123  // L1C projection attributes-
124  // std::string proj_type;
125  float mean_az_east; // swath mean bearing for right side scan
126  float **lat_gd;
127  float **lon_gd;
128  float **alt_gd;
129  float **lat_asort;
130  short **index_xy;
131  int32_t NY1;
132  int32_t NY2;
133  int32_t num_gridlines;
134  int16_t binyb;
135  int16_t binya;
136  double mot;
137  int32_t nbinx; // grid bins across-track
138  int32_t sensor;
139  float latnorth;
140  float latsouth;
141  float lonwest;
142  float loneast;
143  int16_t nswath;
144  int16_t ndswaths;
145  int16_t nswt_files;
146  int32_t nadpix;
147  size_t proj_type;
148  size_t sort_type;
149  float gres; // grid resolution in km
150  size_t norb_rec;
151  // these params go to proj class
152  float lat0;
153 
154  // multi attributes (view, pol, bands)
155  float *view_agg; // views to be aggregated for later products such as vsfs etc
156  float *pol_agg; // polarization states to be aggregated for post-processing products, linear
157  // depolarization ratio etc
158  float *band_agg; // specific bands for future merged products
159  size_t overlap_vflag; // tells if we want merged views
160  size_t overlap_pflag; // tells if we want merged polarizations
161  size_t overlap_bflag; // tells if we want merged spectral bands
162  // uncertainty params for merged l1c products
163  size_t unc_meth; // 0: no error calculation, 1: propagation, 2: Monte Carlo
164  float unc_thres_v; // uncertainity threshold of angular merged products as %
165  float unc_thres_p; // same but for polarization
166  float unc_thres_b; // same but for spectral bands
167  // ancill info, requested products?
168  // float *cloud_h;//this is cloud_height
169 };
170 
171 // we move this to l1c class --void load_l1c_filehandle(filehandle *file,l1c_filehandle *filel1c);
172 // void printVector(const std::vector<std::string> &n);
173 void printProducts();
174 
175 } // namespace l1c
176 #endif
std::string start_dir
std::string progname
std::string l1b_name
virtual void printProducts()
void printProducts()
@ string
const char * azeast_name
std::string tswt_ini
const char * gridname
std::string tswt_end
Definition: l1c.cpp:71
file_type
Definition: filetype.h:11
std::string date_created
std::vector< std::string > cust_l1cprod
std::string tswt_ini_file
std::string tswt_mid
std::vector< std::string > ifiles
std::string instrument