NASA Logo
Ocean Color Science Software

ocssw V2022
l2bin.cpp File Reference
#include <cstdlib>
#include <cstdint>
#include <libgen.h>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <netcdf>
#include <boost/algorithm/string.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <get_dataday.hpp>
#include <meta_l3b.h>
#include <seaproto.h>
#include <readL2scan.h>
#include <timeutils.h>
#include <genutils.h>
#include <setupflags.h>
#include <sensorInfo.h>
#include <nc4utils.h>
#include <ncdfbin_utils.h>
#include <chrono>
#include <hdf.h>
#include "l2bin_input.h"
#include "L3Shape.h"
#include "L3ShapeIsine.h"
#include <get_geospatial.hpp>
#include "expand3D.hpp"
#include "find_variable.hpp"
Include dependency graph for l2bin.cpp:

Go to the source code of this file.

Macros

#define MTILT_DIMS_2   20
 
#define LTILT_DIMS_2   2
 
#define MAXALLOCPERBIN   20
 
#define VERSION   "7.1.0"
 
#define PROGRAM   "l2bin"
 

Typedefs

typedef bg::model::point< double, 2, bg::cs::geographic< bg::degree > > Point_t
 
typedef bg::model::polygon< Point_tPolygon_t
 
typedef bg::model::box< Point_tBox_t
 

Functions

int32_t get_l2prod_index (const l2_prod &l2, const char *prodname)
 
void addPixelToBin (int32_t ifile, int32_t ipixl, uint64_t bin, bool is_l2_flags_defined=true, double areaFrac=1.0)
 
bool binIntersectsPixel (int32_t row, int32_t col, Box_t &pixelBox, double &areaFrac)
 
bool binIntersectsPixel (int32_t row, int32_t col, Polygon_t &pixelPoly, double &areaFrac)
 
template<class T >
bool getBinsFromRow (double lat, double lon, T &pixelPoly, std::map< uint64_t, double > &areas)
 
void getBins (int32_t ifile, int32_t ipixl, std::map< uint64_t, double > &areas)
 
bool skip_DL (float lon, int side, int night_flag, time_t end_day, time_t beg_day)
 
int main (int argc, char **argv)
 
int64_t getbinnum (int32_t ifile, int32_t ipixl)
 

Variables

int32_t n_allocperbin
 
int16_t * allocated_space
 
int32_t * bin_flag
 
int16_t * tilt
 
int16_t * qual
 
int16_t * nscenes
 
int16_t * lastfile
 
int32_t n_bins_in_group
 
int32_t n_rows_in_group = -1
 
int32_t krow
 
int32_t tiltstate = 0
 
int32_t l3b_nprod
 
int32_t sensorID [MAXNFILES]
 
int16_t * numer [MAXNFILES]
 
int16_t * denom [MAXNFILES]
 
int16_t qual_prod_index [MAXNFILES]
 
int16_t composite_prod_index [MAXNFILES]
 
int16_t composite_l3prod_index = -1
 
float32 f32
 
std::vector< int32_t > thirdDimId
 
std::vector< float32 > min_value
 
std::vector< float32 > max_value
 

Macro Definition Documentation

◆ LTILT_DIMS_2

#define LTILT_DIMS_2   2

Definition at line 53 of file l2bin.cpp.

◆ MAXALLOCPERBIN

#define MAXALLOCPERBIN   20

Definition at line 54 of file l2bin.cpp.

◆ MTILT_DIMS_2

#define MTILT_DIMS_2   20

Definition at line 52 of file l2bin.cpp.

◆ PROGRAM

#define PROGRAM   "l2bin"

Definition at line 107 of file l2bin.cpp.

◆ VERSION

#define VERSION   "7.1.0"

Definition at line 106 of file l2bin.cpp.

Typedef Documentation

◆ Box_t

typedef bg::model::box<Point_t> Box_t

Definition at line 104 of file l2bin.cpp.

◆ Point_t

typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > Point_t

Definition at line 102 of file l2bin.cpp.

◆ Polygon_t

typedef bg::model::polygon<Point_t> Polygon_t

Definition at line 103 of file l2bin.cpp.

Function Documentation

◆ addPixelToBin()

void addPixelToBin ( int32_t  ifile,
int32_t  ipixl,
uint64_t  bin,
bool  is_l2_flags_defined = true,
double  areaFrac = 1.0 
)

Definition at line 120 of file l2bin.cpp.

◆ binIntersectsPixel() [1/2]

bool binIntersectsPixel ( int32_t  row,
int32_t  col,
Box_t pixelBox,
double &  areaFrac 
)

Definition at line 377 of file l2bin.cpp.

◆ binIntersectsPixel() [2/2]

bool binIntersectsPixel ( int32_t  row,
int32_t  col,
Polygon_t pixelPoly,
double &  areaFrac 
)

Definition at line 413 of file l2bin.cpp.

◆ get_l2prod_index()

int32_t get_l2prod_index ( const l2_prod &  l2,
const char *  prodname 
)

Definition at line 109 of file l2bin.cpp.

◆ getbinnum()

int64_t getbinnum ( int32_t  ifile,
int32_t  ipixl 
)

Definition at line 2460 of file l2bin.cpp.

◆ getBins()

void getBins ( int32_t  ifile,
int32_t  ipixl,
std::map< uint64_t, double > &  areas 
)

Definition at line 492 of file l2bin.cpp.

◆ getBinsFromRow()

bool getBinsFromRow ( double  lat,
double  lon,
T &  pixelPoly,
std::map< uint64_t, double > &  areas 
)

Definition at line 453 of file l2bin.cpp.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 707 of file l2bin.cpp.

◆ skip_DL()

bool skip_DL ( float  lon,
int  side,
int  night_flag,
time_t  end_day,
time_t  beg_day 
)

checks if lon should be skipped

Parameters
loninput longitude
sideside (west or east) of the dateline should be included
night_flagnight
end_daytime difference between the start scan time and the end day
beg_daytime difference between the start scan time and the beginning day

Definition at line 692 of file l2bin.cpp.

Variable Documentation

◆ allocated_space

int16_t* allocated_space

Definition at line 69 of file l2bin.cpp.

◆ bin_flag

int32_t* bin_flag

Definition at line 79 of file l2bin.cpp.

◆ composite_l3prod_index

int16_t composite_l3prod_index = -1

Definition at line 96 of file l2bin.cpp.

◆ composite_prod_index

int16_t composite_prod_index[MAXNFILES]

Definition at line 95 of file l2bin.cpp.

◆ denom

int16_t * denom[MAXNFILES]

Definition at line 93 of file l2bin.cpp.

◆ f32

float32 f32

Definition at line 98 of file l2bin.cpp.

◆ krow

int32_t krow

Definition at line 84 of file l2bin.cpp.

◆ l3b_nprod

int32_t l3b_nprod

Definition at line 88 of file l2bin.cpp.

◆ lastfile

int16_t * lastfile

Definition at line 80 of file l2bin.cpp.

◆ max_value

std::vector<float32> max_value

Definition at line 100 of file l2bin.cpp.

◆ min_value

std::vector<float32> min_value

Definition at line 100 of file l2bin.cpp.

◆ n_allocperbin

int32_t n_allocperbin

Definition at line 68 of file l2bin.cpp.

◆ n_bins_in_group

int32_t n_bins_in_group

Definition at line 82 of file l2bin.cpp.

◆ n_rows_in_group

int32_t n_rows_in_group = -1

Definition at line 83 of file l2bin.cpp.

◆ nscenes

int16_t * nscenes

Definition at line 80 of file l2bin.cpp.

◆ numer

int16_t* numer[MAXNFILES]

Definition at line 93 of file l2bin.cpp.

◆ qual

int16_t * qual

Definition at line 80 of file l2bin.cpp.

◆ qual_prod_index

int16_t qual_prod_index[MAXNFILES]

Definition at line 94 of file l2bin.cpp.

◆ sensorID

int32_t sensorID[MAXNFILES]

Definition at line 91 of file l2bin.cpp.

◆ thirdDimId

std::vector<int32_t> thirdDimId

Definition at line 99 of file l2bin.cpp.

◆ tilt

int16_t* tilt

Definition at line 80 of file l2bin.cpp.

◆ tiltstate

int32_t tiltstate = 0

Definition at line 87 of file l2bin.cpp.