NASA Logo
Ocean Color Science Software

ocssw V2022
l1c_filehandle.cpp
Go to the documentation of this file.
1 
2 // l1c_filehandle.cpp
3 // Created by Martin Montes on 8/15/22
4 
5 #include "l1c_filehandle.h"
6 #include <string>
7 #include <stdlib.h>
8 #include <stdio.h>
9 #include <math.h>
10 #include <boost/assign/list_of.hpp> // for 'list_of()'
11 #include <boost/assert.hpp>
12 #include <list>
13 #include <stack>
14 #include <vector>
15 #include <iostream>
16 
17 using namespace std;
18 using namespace boost::assign;
19 
20 namespace l1c {
21 
22 l1c_filehandle::l1c_filehandle() {
23  // global--
24  // L1C produts-
25  // std::vector<std::string> cust_l1cprod = list_of("pc")("vsf")("dpr");//3 options selected for for l1c
26  // products, principal components, volume scattering function and degree linear polarization
27  // std::vector<std::string> cust_l1cprod = {"pc","vsf","dpr"};
28  cust_l1cprod.push_back("pc");
29  gridname = "";
30  azeast_name = "";
31  swath_scans = 1;
32  swath_num = 1;
33  for (int j = 0; j < 10; j++) {
34  selgran[j] = -1;
35  }
36  verbose=0;
37  l1c_pflag = 0;
38  l1b_name = "";
39  version = "";
40  progname = "";
41  sd_id = 0;
42  format = FT_INVALID;
43  // mode=0;
44  length = 0;
45  sensorID = -1;
46  subsensorID = -1;
47  res_spat = -999.0;
48  ;
49  res_spec = -999.0;
50  lat_gd = nullptr;
51  lon_gd = nullptr;
52  alt_gd = nullptr;
53  lat_asort = nullptr;
54  index_xy = nullptr;
55 
56  // time-space limits of image
57  syear = 0;
58  sday = 0;
59  minlat_img = -999.0;
60  ;
61  maxlat_img = -999.0;
62  ;
63  minlon_img = -999.0;
64  ;
65  maxlon_img = -999.0;
66  ;
67 
68  // dimensions--
69  nframes = -1; // HARP sensor
70  ndets = 1;
71  nscan = 0;
72  n_views = 1; // sensor views
73  npols = 1; // polarization states
74  nbands = 0; // number of total bands
75  nband_blue = 0; // this includes uv + visible bands
76  nband_red = 0; // this includes nir + visible bands
77  nband_swir = 0;
78  // spex------------
79  nband_view = 0;
80  npol_band_view = 0;
81  npix = 0;
82 
83  // sensor characteritics
84  views = nullptr; // indexes are not defined
85  for (int i = 0; i < 3; i++) {
86  pols[i] = 0; // 0: non-pol, 1: cross, 2: parall
87  }
88 
89  bbands = nullptr; // array with bands wavelengths
90  rbands = nullptr;
91  swirbands = nullptr;
92 
93  // navigation attributes
94  orbit_number = 0;
95  orb_dir = -1; // 0 asc 1 des
96  orbit_node_lon = -999.0; // this is node_crossing_time
97  eqt = -999.0;
98  tswt_ini = ""; // metadata string for initial time
99  tswt_end = ""; // metadata string for final time
100  tswt_mid="";
101  tswt_ini_file = "";
102  tunix_start = -999.; // start utc time for the swath,
103  tg_s = -999.;
104  tg_e = -999.;
105  numgran = -1;
106  tfile_ini_sec = -999.;
107  tfile_end_sec = -999.;
108  instrument = "";
109  start_dir = "";
110  end_dir = "";
111  binstr = "";
112  date_created = "";
113  norb_rec=-1;//number of orbital records total for swath
114  // telemetry stauff----L1A--HKT
115  fileix = 0;
116  gransize = 5; // granule size in minutes
117  gd_per_gran = 400;
118  gran_ini_timeflag = 1; // initial time for granules produced HKT->L1C
119 
120  // geolocation attributes
121  terrain_corrected = 0;
122  cloud_corrected = 0;
123  cloud_height = nullptr;
124 
125  // calibration attributes
126  Fobar = nullptr;
127 
128  // projection attribute
129  mean_az_east = -999.0;
130  NY1 = -1;
131  NY2 = -1;
132  num_gridlines = -1;
133  binyb = -1;
134  binya = -1;
135  mot = -999.;
136  nbinx = -1;
137  sensor = -1;
138  latnorth = 90.0;
139  latsouth = -90.0;
140  lonwest = -180.;
141  loneast = +180.;
142  nswath = -1;
143  ndswaths = -1;
144  nswt_files = -1;
145  nadpix = -1;
146  gres = -999.0;
147 
148  proj_type = 0; // 0 'socea" and 1: socea-2
149  sort_type = 0;
150  lat0 = 0.0;
151 
152  // multi attributes (view, pol, bands)
153  view_agg = nullptr; // views to be aggregated for later products such as vsfs etc
154  pol_agg = nullptr; // polarization states to be aggregated for post-processing products, linear
155  // depolarization ratio etc
156  band_agg = nullptr; // specific bands for future merged products
157  overlap_vflag = 0; // tells if we want merged views
158  overlap_pflag = 0; // tells if we want merged polarizations
159  overlap_bflag = 0; // tells if we want merged spectral bands
160  // uncertainty params l1c merged products
161  unc_meth = -1;
162  unc_thres_v = -999.0; // uncertainity threshold of angular merged products as %
163  unc_thres_p = -999.0; // same but for polarization
164  unc_thres_b = -999.0; // same but for spectral bands
165 }
166 
167 l1c_filehandle::~l1c_filehandle() {
168 }
169 
171  std::vector<std::string> cust_l1cprod = {"pc", "vsf", "dpr"};
172  // cust_l1cprod = {"pc", "vsf", "dpr"};
173  for (const auto& item : cust_l1cprod) {
174  std::cout << item << std::endl;
175  }
176 }
177 
178 } // namespace l1c
int j
Definition: decode_rs.h:73
void printProducts()
int syear
Definition: l1_czcs_hdf.c:15
int32 nscan
Definition: l1_czcs_hdf.c:19
int sday
Definition: l1_czcs_hdf.c:15
Definition: l1c.cpp:71
int32_t nbands
@ FT_INVALID
Definition: filetype.h:12
int i
Definition: decode_rs.h:71
int32_t sensorID[MAXNFILES]
Definition: l2bin.cpp:91
int verbose
Definition: fmt_check.c:6
int npix
Definition: get_cmp.c:28
version
Definition: setup.py:15