OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
l2bin.cpp File Reference
#include <stdlib.h>
#include <stdint.h>
#include <libgen.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <netcdf>
#include <boost/algorithm/string.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/foreach.hpp>
#include <meta_l3b.h>
#include <seaproto.h>
#include <readL2scan.h>
#include <timeutils.h>
#include <genutils.h>
#include <setupflags.h>
#include <sensorInfo.h>
#include <sensorDefs.h>
#include <nc4utils.h>
#include <ncdfbin_utils.h>
#include <hdf.h>
#include <mfhdf.h>
#include "dataday.h"
#include "l2bin_input.h"
#include "L3Shape.h"
#include "L3ShapeIsine.h"
Include dependency graph for l2bin.cpp:

Go to the source code of this file.

Macros

#define PI   3.141592653589793
 
#define MTILT_DIMS_2   20
 
#define LTILT_DIMS_2   2
 
#define MAXALLOCPERBIN   20
 
#define EARTH_RADIUS   6378.14
 
#define VERSION   "7.0.3"
 
#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, 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)
 
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
 
vector< int32_t > thirdDimId
 
vector< float32 > min_value
 

Macro Definition Documentation

◆ EARTH_RADIUS

#define EARTH_RADIUS   6378.14

Definition at line 60 of file l2bin.cpp.

◆ LTILT_DIMS_2

#define LTILT_DIMS_2   2

Definition at line 58 of file l2bin.cpp.

◆ MAXALLOCPERBIN

#define MAXALLOCPERBIN   20

Definition at line 59 of file l2bin.cpp.

◆ MTILT_DIMS_2

#define MTILT_DIMS_2   20

Definition at line 57 of file l2bin.cpp.

◆ PI

#define PI   3.141592653589793

Definition at line 56 of file l2bin.cpp.

◆ PROGRAM

#define PROGRAM   "l2bin"

Definition at line 113 of file l2bin.cpp.

◆ VERSION

#define VERSION   "7.0.3"

Definition at line 112 of file l2bin.cpp.

Typedef Documentation

◆ Box_t

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

Definition at line 110 of file l2bin.cpp.

◆ Point_t

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

Definition at line 108 of file l2bin.cpp.

◆ Polygon_t

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

Definition at line 109 of file l2bin.cpp.

Function Documentation

◆ addPixelToBin()

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

Definition at line 355 of file l2bin.cpp.

◆ binIntersectsPixel() [1/2]

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

Definition at line 584 of file l2bin.cpp.

◆ binIntersectsPixel() [2/2]

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

Definition at line 617 of file l2bin.cpp.

◆ get_l2prod_index()

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

Definition at line 345 of file l2bin.cpp.

◆ getbinnum()

int64_t getbinnum ( int32_t  ifile,
int32_t  ipixl 
)

Definition at line 2714 of file l2bin.cpp.

◆ getBins()

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

Definition at line 690 of file l2bin.cpp.

◆ getBinsFromRow()

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

Definition at line 654 of file l2bin.cpp.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 876 of file l2bin.cpp.

Variable Documentation

◆ allocated_space

int16_t* allocated_space

Definition at line 75 of file l2bin.cpp.

◆ bin_flag

int32_t* bin_flag

Definition at line 85 of file l2bin.cpp.

◆ composite_l3prod_index

int16_t composite_l3prod_index = -1

Definition at line 102 of file l2bin.cpp.

◆ composite_prod_index

int16_t composite_prod_index[MAXNFILES]

Definition at line 101 of file l2bin.cpp.

◆ denom

int16_t * denom[MAXNFILES]

Definition at line 99 of file l2bin.cpp.

◆ f32

float32 f32

Definition at line 104 of file l2bin.cpp.

◆ krow

int32_t krow

Definition at line 90 of file l2bin.cpp.

◆ l3b_nprod

int32_t l3b_nprod

Definition at line 94 of file l2bin.cpp.

◆ lastfile

int16_t * lastfile

Definition at line 86 of file l2bin.cpp.

◆ min_value

vector<float32> min_value

Definition at line 106 of file l2bin.cpp.

◆ n_allocperbin

int32_t n_allocperbin

Definition at line 74 of file l2bin.cpp.

◆ n_bins_in_group

int32_t n_bins_in_group

Definition at line 88 of file l2bin.cpp.

◆ n_rows_in_group

int32_t n_rows_in_group = -1

Definition at line 89 of file l2bin.cpp.

◆ nscenes

int16_t * nscenes

Definition at line 86 of file l2bin.cpp.

◆ numer

int16_t* numer[MAXNFILES]

Definition at line 99 of file l2bin.cpp.

◆ qual

int16_t * qual

Definition at line 86 of file l2bin.cpp.

◆ qual_prod_index

int16_t qual_prod_index[MAXNFILES]

Definition at line 100 of file l2bin.cpp.

◆ sensorID

int32_t sensorID[MAXNFILES]

Definition at line 97 of file l2bin.cpp.

◆ thirdDimId

vector<int32_t> thirdDimId

Definition at line 105 of file l2bin.cpp.

◆ tilt

int16_t* tilt

Definition at line 86 of file l2bin.cpp.

◆ tiltstate

int32_t tiltstate = 0

Definition at line 93 of file l2bin.cpp.