OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
gringHelper.h
Go to the documentation of this file.
1 #ifndef _GRING_HELPER_H
2 #define _GRING_HELPER_H
3 
4 #ifndef MAX_GEOBOX_CNT
5 #define MAX_GEOBOX_CNT 100
6 #endif
7 
8 #include "l1.h"
9 #include "allocate2d.h"
10 
11 #include <string>
12 
13 struct gringConfig_t {
14  float delta_degrees_lat; // To be derived from user input (e.g. l1info command line)
15  int scan_direction; // CZCS is +1 (to the right); others are -1 (to the left)
16  size_t direction_delta; // number of lines to wait before checking the direction
17 };
18 
19 // The scanBounds structure is used to mark the end-points (and mid-point) of a scan that can contribute to a gring
20 struct scanBounds_t {
21  float slat; // Starting lat
22  float slon; // Starting lon
23  float clat; // Center lat
24  float clon; // Center lon
25  float elat; // End lat
26  float elon; // End lon
27 };
28 
29 // gring_t struct
30 struct gring_t{
35 };
36 
37 // The member functions of this class can be used by the CALLER to create a gring
38 // Call sequence:
39 // CALLER (instantiation) > gringHelper
40 // CALLER (per scan) > process_scan > includeScanInGring > setScanBounds
41 // CALLER > get_geobox_cnt
42 // CALLER > get_gring_strings > createGring > orderGeobox
43 // > xlat_floatArray2String
44 // > xlat_intArray2String
45 
46 
47 class gringHelper {
48 
49 public:
50 
51  gringHelper(gringConfig_t *gringConfig); // Constructor
52  virtual ~gringHelper(); // Destructor
53  void process_scan(l1str *l1rec, size_t recnum, size_t escan); // Process an individual scan line // Print (to screen) gring-related information
54  int get_geobox_cnt();
55  int get_gring_strings(std::string& gring_lon_string, std::string& gring_lat_string, std::string& gring_seq_string);
56 
57 
58 private:
59 
60  // State information
61  bool first_good_scan;
62  int last_direction;
63  float last_lat;
64  float **geobox; // Array 4 x MAX_GEOBOX_CNT
65  float *centerLat;
66  size_t geobox_cnt;
67  size_t direction_line; // last line where we checked the direction
68  size_t direction_delta; // number of line to wait before checking the direction
69 
70  // Config
71  float delta_degrees_lat;
72  int scan_direction;
73 
74  // Structs
75  //scanBounds_t *scanBounds; // If scan should be included in gring, stuff the scanBoundsOut into a geobox.
76 
77  bool valid_lat(float lat);
78  bool valid_lon(float lon);
79 
80  bool includeScanInGring(float *lat, float *lon, int32_t *flags, size_t num_pixels, size_t recnum, size_t escan,
81  scanBounds_t *scanBounds );
82 
83  void delete_extra_line();
84 
85  void createGring(gring_t *this_gring);
86 
87  void orderGeobox(float **geoboxOrdered);
88 
89  void xlat_floatArray2String(std::string& myString, float *myArray, int array_length);
90 
91  void xlat_intArray2String(std::string& myString, size_t *myArray, int array_length);
92 
93 };
94 
95 #endif
96 
size_t direction_delta
Definition: gringHelper.h:16
read l1rec
int get_geobox_cnt()
float gring_lat[2 *MAX_GEOBOX_CNT]
Definition: gringHelper.h:31
#define MAX_GEOBOX_CNT
Definition: gringHelper.h:5
float * lat
gringHelper(gringConfig_t *gringConfig)
Definition: gringHelper.cpp:25
@ string
float gring_lon[2 *MAX_GEOBOX_CNT]
Definition: gringHelper.h:32
read recnum
int num_gring_pts
Definition: gringHelper.h:34
int get_gring_strings(std::string &gring_lon_string, std::string &gring_lat_string, std::string &gring_seq_string)
Utility functions for allocating and freeing two-dimensional arrays of various types.
size_t gring_seq[2 *MAX_GEOBOX_CNT]
Definition: gringHelper.h:33
flags
Definition: DDAlgorithm.h:22
virtual ~gringHelper()
Definition: gringHelper.cpp:47
float * lon
float delta_degrees_lat
Definition: gringHelper.h:14
void process_scan(l1str *l1rec, size_t recnum, size_t escan)
Definition: gringHelper.cpp:70
int scan_direction
Definition: gringHelper.h:15