OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
DDSensor.h
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * NAME: DDSensor.h
4  *
5  * DESCRIPTION: Declaration for the DDSensor object class.
6  *
7  * Created on: May 10, 2017
8  * Author: Sam Anderson
9  *
10  ***************************************************************************/
11 
12 #ifndef INCLUDE_INPUT_H_
13 #define INCLUDE_INPUT_H_
14 
15 #include <vector>
16 #include <map>
17 #include <DDOptions.h>
18 
19 using namespace std;
20 using namespace netCDF;
21 
22 extern "C" {
23  double esdist_(int32_t *year, int32_t *day, int32_t *msec);
24 }
25 
26 static const int BTLUTSIZE = 65536;
27 static const int VALIDMAX = 65527;
28 static const int SOLZNIGHT = 90.0;
29 static const int SOLZNIGHTA = 80.0;
30 static const int DAYSCENE = 0;
31 static const int NIGHTSCENE = 1;
32 static const int DAYANDNIGHT = 2;
33 static const int UNKNOWNSCENE = 3;
34 static const int ASCENDING = 0;
35 static const int DSCENDING = 1;
36 static const int UNKNOWNNODE = 2;
37 
38 class DDProcess;
39 
41 {
42  float btlut[BTLUTSIZE];
43 };
44 
45 // VIIRS input structures
46 struct vfio {
47  float in[VLINES][VELEMS];
48  float out[VLINES][VELEMS];
49 };
50 struct vsio {
51  short in[VLINES][VELEMS];
52  short out[VLINES][VELEMS];
53 };
54 struct vusio {
55  unsigned short in[VLINES][VELEMS];
56  unsigned short out[VLINES][VELEMS];
57 };
58 
59 // PACE input structures
60 struct pfio {
61  boost::multi_array<float,2> in;
62  boost::multi_array<float,2> out;
63 };
64 struct psio {
65  boost::multi_array<short,2> in;
66  boost::multi_array<short,2> out;
67 };
68 struct pusio {
69  boost::multi_array<unsigned short,2> in;
70  boost::multi_array<unsigned short,2> out;
71 };
72 
73 #define LANDMASK_LAT 43201
74 #define LANDMASK_LON 86401
75 
77 {
78  double lat[LANDMASK_LAT];
79  double lon[LANDMASK_LON];
80  char watermask[LANDMASK_LAT][LANDMASK_LON];
81 };
82 
83 const static int MAXMODIS250RSB = 2;
84 const static int MAXMODIS500RSB = 7;
85 const static int MAXMODIS1KMRSB = 19;
86 
97 };
98 
99 const static float WLS = 2.5;
100 const static float WLB = 310.0;
101 const static float WLR = 600.0;
102 
103 enum PACE_SWIR {
106 };
107 
108 /*
109  * BASE CLASS
110  */
111 
112 class DDSensor
113 {
114 public:
118  DDSensor();
122  virtual ~DDSensor ();
123 
127  map<string, ddata*> create(vector<size_t> start, vector<size_t> count);
128 
132  map<string, ddata*> read(vector<size_t> start, vector<size_t> count);
133 
137  map<string, ddata*> read_landmask( map<string, ddata*> gmap,
138  vector<size_t> start, vector<size_t> count );
139 
140 protected:
141  friend class POCI;
142  friend class VIIRS;
143 
144  bool brad_;
145  float fsol_;
146 
150  unsigned long int random_seed();
151  float make_noise(float sigma);
152 
156  map<string, ddata*> create_l2( map<string, ddata*> );
157 
161  virtual float noise_model(float rfl, int iw, float snr_mult);
162 
166  virtual map<string,ddata*> read_l1b(const string& filepath,
167  vector<size_t> start, vector<size_t> count);
168 
172  virtual map<string,ddata*> read_l1b_attributes(NcFile* nc_input);
173 
177  virtual map<string,ddata*> read_geo(const string& filepath,
178  vector<size_t> start, vector<size_t> count);
179 };
180 
181 /*
182  * PACE
183  */
184 
185 class POCI : public DDSensor
186 {
187 public:
188 
192  POCI();
196  ~POCI ();
197 
198 protected:
199 
203  float noise_model(float rfl, int iw, float snr_mult);
204 
208  map<string,ddata*> read_l1b(const string& filepath,
209  vector<size_t> start, vector<size_t> count);
210 
214  map<string,ddata*> read_l1b_attributes(NcFile* nc_input);
215 
219  map<string,ddata*> read_geo(const string& filepath,
220  vector<size_t> start, vector<size_t> count);
221 
222  size_t bindex(float wl) {return (size_t)((wl-WLB)/WLS);}
223  size_t rindex(float wl) {return (size_t)((wl-WLR)/WLS);}
224 
225 };
226 
227 /*
228  * VIIRS
229  */
230 
231 class VIIRS : public DDSensor
232 {
233 public:
237  VIIRS();
238 
242  ~VIIRS ();
243 
244 protected:
245 
249  float noise_model(float rfl, int iw, float snr_mult);
250 
254  map<string,ddata*> read_l1b(const string& filepath,
255  vector<size_t> start, vector<size_t> count);
256 
260  map<string,ddata*> read_l1b_attributes(NcFile* nc_input);
261 
265  map<string,ddata*> read_geo(const string& filepath,
266  vector<size_t> start, vector<size_t> count);
267 
268 };
269 
270 #endif /* INCLUDE_INPUT_H_ */
@ MW869
Definition: DDSensor.h:91
@ MW4515
Definition: DDSensor.h:93
void read_landmask(int argc, IDL_VPTR argv[])
Definition: read_landmask.c:8
@ MW678L
Definition: DDSensor.h:90
#define LANDMASK_LAT
Definition: DDSensor.h:73
@ MW13935
Definition: DDSensor.h:95
int32_t day
#define DAYSCENE
Definition: l12_parms.h:87
#define VELEMS
Definition: DDOptions.h:23
@ MW8550
Definition: DDSensor.h:94
#define UNKNOWNSCENE
Definition: l12_parms.h:90
map< string, ddata * > read_l1b_attributes(NcFile *nc_input)
Definition: DDSensor.cpp:1027
@ MW12020
Definition: DDSensor.h:95
@ MAXMODISALL
Definition: DDSensor.h:96
@ MW859
Definition: DDSensor.h:88
@ MW667L
Definition: DDSensor.h:90
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 as required for compatibility with version of the SDP toolkit Corrected test output file names to end in out
Definition: HISTORY.txt:422
@ MW531
Definition: DDSensor.h:89
@ MW488
Definition: DDSensor.h:89
@ MW3750
Definition: DDSensor.h:92
@ MW645
Definition: DDSensor.h:88
float rfl[NOWL]
Definition: DbAlgOcean.cpp:41
@ MW3959L
Definition: DDSensor.h:92
@ PS1040
Definition: DDSensor.h:104
float * lat
int32 * msec
Definition: l1_czcs_hdf.c:31
boost::multi_array< unsigned short, 2 > in
Definition: DDSensor.h:69
double esdist_(int32_t *year, int32_t *day, int32_t *msec)
Definition: DDSensor.h:68
Definition: DDSensor.h:185
@ MW905
Definition: DDSensor.h:91
unsigned long int random_seed()
Definition: loadl1.c:40
@ MW551
Definition: DDSensor.h:90
@ MW6715
Definition: DDSensor.h:93
@ MW3959H
Definition: DDSensor.h:92
#define DAYANDNIGHT
Definition: l12_parms.h:89
#define NIGHTSCENE
Definition: l12_parms.h:88
@ MW4050
Definition: DDSensor.h:92
MODIS_BANDS
Definition: DDSensor.h:87
@ MW4465
Definition: DDSensor.h:93
@ MW7325
Definition: DDSensor.h:94
@ PS2130
Definition: DDSensor.h:105
map< string, ddata * > read_geo(const string &filepath, vector< size_t > start, vector< size_t > count)
Definition: DDSensor.cpp:1126
@ PS2260
Definition: DDSensor.h:105
@ MW11030
Definition: DDSensor.h:94
@ MW667H
Definition: DDSensor.h:90
Definition: DDSensor.h:60
@ PS1615
Definition: DDSensor.h:104
map< string, ddata * > create_l2(map< string, ddata * >)
Definition: DDSensor.cpp:299
Definition: DDSensor.h:64
@ MW164
Definition: DDSensor.h:88
@ MW678H
Definition: DDSensor.h:91
size_t bindex(float wl)
Definition: DDSensor.h:222
@ MW550
Definition: DDSensor.h:88
map< string, ddata * > read_l1b(const string &filepath, vector< size_t > start, vector< size_t > count)
Definition: DDSensor.cpp:950
boost::multi_array< float, 2 > in
Definition: DDSensor.h:61
#define DSCENDING
Definition: scene_meta.h:13
@ MW13335
Definition: DDSensor.h:95
@ MAXSWIRBAND
Definition: DDSensor.h:105
#define ASCENDING
Definition: scene_meta.h:12
@ MW936
Definition: DDSensor.h:91
Definition: DDSensor.h:46
boost::multi_array< unsigned short, 2 > out
Definition: DDSensor.h:70
Definition: DDSensor.h:50
bool brad_
Definition: DDSensor.h:144
boost::multi_array< float, 2 > out
Definition: DDSensor.h:62
@ MW748
Definition: DDSensor.h:91
@ PS940
Definition: DDSensor.h:104
@ MW940
Definition: DDSensor.h:91
string filepath
Definition: color_dtdb.py:207
#define SOLZNIGHT
Definition: l1.h:57
@ PS1250
Definition: DDSensor.h:104
@ MW124
Definition: DDSensor.h:88
Definition: DDSensor.h:54
float noise_model(float rfl, int iw, float snr_mult)
Definition: DDSensor.cpp:921
float fsol_
Definition: DDSensor.h:145
float make_noise(float sigma)
Definition: loadl1.c:47
@ MW9730
Definition: DDSensor.h:94
float * lon
boost::multi_array< short, 2 > out
Definition: DDSensor.h:66
@ MW13635
Definition: DDSensor.h:95
#define SOLZNIGHTA
Definition: l1.h:58
boost::multi_array< short, 2 > in
Definition: DDSensor.h:65
@ MW1375
Definition: DDSensor.h:93
#define UNKNOWNNODE
Definition: scene_meta.h:14
@ MW470
Definition: DDSensor.h:88
#define VLINES
Definition: DDOptions.h:22
PACE_SWIR
Definition: DDSensor.h:103
@ PD1250
Definition: DDSensor.h:104
@ PD1615
Definition: DDSensor.h:105
@ MW412
Definition: DDSensor.h:89
@ PS1378
Definition: DDSensor.h:104
@ MW213
Definition: DDSensor.h:89
@ MW14235
Definition: DDSensor.h:95
#define LANDMASK_LON
Definition: DDSensor.h:74
size_t rindex(float wl)
Definition: DDSensor.h:223
@ MW443
Definition: DDSensor.h:89
int count
Definition: decode_rs.h:79