OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
genutils.h
Go to the documentation of this file.
1 #ifndef _GENUTILS_H
2 #define _GENUTILS_H
3 
4 #include <stdint.h>
5 #include <stdio.h>
6 
7 #include "passthebuck.h"
8 
9 // circumference of the earth at the equator in meters
10 #define EARTH_CIRCUMFERENCE 40075016.6856
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
22 #define BAD_FLT -32767.0
23 #define BAD_INT -32767
24 #define BAD_UINT 65535
25 #define BAD_BYTE -128
26 #define BAD_UBYTE 255
27 
29 extern int want_verbose;
30 
34 int endianess(void);
35 
36 void parse_file_name(const char *inpath, char *outpath);
37 
44 int swapc_bytes(char *in, int nbyte, int ntime);
45 
53 int swapc_bytes2(const char *in, char *out, int nbyte, int ntime);
54 
63 size_t fread_swap(int little_endian, void *ptr, size_t size, size_t nmemb, FILE *stream);
64 
73 size_t fwrite_swap(int little_endian, const void *ptr, size_t size, size_t nmemb, FILE *stream);
74 
75 void spline(float [], float [], int, float, float, float []);
76 void splint(float [], float [], float [], int, float, float *);
77 void lspline(float xin [], float yin [], int32_t nin,
78  float xout[], float yout[], int32_t nout);
79 float linterp(float xin [], float yin [], int32_t nin, float xout);
80 float bioBandShift(float xin [], float yin [], float chl, int32_t nin, float xout);
81 
82 int32_t filesize_(const char *filename);
83 int32_t filesize(const char *filename);
84 
85 int getlut_file(char *lut_file, short *rlut, short *glut, short * blut);
86 
87 char *lowcase(char *instr);
88 char *upcase(char *instr);
89 
90 int isValidInt(const char* str);
91 
92 void* allocateMemory(size_t numBytes, const char* name);
93 
94 void trimBlanks(char* str);
95 char* trimBlanksDup(const char* str);
96 
97 int getFileFormatIndex(const char* str);
98 const char* getFileFormatName(const char* str);
99 const char* getFileFormatExtension(const char* str);
100 
101 char* replace_ocroots(const char* inStr);
102 
109 double str2resolution(char const * resolutionStr);
110 
117 const char* resolution2str(double resolution);
118 
125 double resolution2degrees(double resolution);
126 
133 double degrees2resolution(double degrees);
134 
135 
136 #ifdef __cplusplus
137 }
138 
139 // C++ functions
140 #include <string>
142 
149 double string2resolution(std::string resolutionStr);
150 
158 
159 
160 #endif // C++
161 
162 #endif
void replaceOCroots(std::string &str)
char * lowcase(char *instr)
Definition: lowcase.c:10
int32_t filesize(const char *filename)
Definition: swl0_utils.c:93
size_t fwrite_swap(int little_endian, const void *ptr, size_t size, size_t nmemb, FILE *stream)
Definition: fread_swap.c:15
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
this program makes no use of any feature of the SDP Toolkit that could generate such a then geolocation is calculated at that resolution
Definition: HISTORY.txt:188
int32_t filesize_(const char *filename)
Definition: filesize.c:19
float bioBandShift(float xin[], float yin[], float chl, int32_t nin, float xout)
int getlut_file(char *lut_file, short *rlut, short *glut, short *blut)
Definition: getlut_file.c:8
int isValidInt(const char *str)
Definition: isValidInt.c:9
size_t fread_swap(int little_endian, void *ptr, size_t size, size_t nmemb, FILE *stream)
Definition: fread_swap.c:4
void * allocateMemory(size_t numBytes, const char *name)
Definition: allocateMemory.c:7
int endianess(void)
determine endianess
Definition: endianess.c:10
@ string
void splint(float[], float[], float[], int, float, float *)
Definition: nr_spline.c:78
int swapc_bytes(char *in, int nbyte, int ntime)
Definition: swapc_bytes.c:4
void spline(float[], float[], int, float, float, float[])
Definition: nr_spline.c:35
float linterp(float xin[], float yin[], int32_t nin, float xout)
Definition: lspline.c:59
double degrees2resolution(double degrees)
Pixel resolution degrees to meters.
double string2resolution(std::string resolutionStr)
int want_verbose
char filename[FILENAME_MAX]
Definition: atrem_corl1.h:122
char * replace_ocroots(const char *inStr)
std::string resolution2string(double resolution)
void parse_file_name(const char *inpath, char *outpath)
const char * resolution2str(double resolution)
Pixel resolution meters to string.
const char * str
Definition: l1c_msi.cpp:35
double resolution2degrees(double resolution)
Pixel resolution meters to degrees.
char * upcase(char *instr)
Definition: upcase.c:10
string outpath
Definition: color_dtdb.py:224
const char * getFileFormatName(const char *str)
int swapc_bytes2(const char *in, char *out, int nbyte, int ntime)
Definition: swapc_bytes.c:24
char * trimBlanksDup(const char *str)
Definition: trimBlanks.c:58
void lspline(float xin[], float yin[], int32_t nin, float xout[], float yout[], int32_t nout)
Definition: lspline.c:20
#define degrees(radians)
Definition: niwa_iop.c:30
void trimBlanks(char *str)
Definition: trimBlanks.c:10
double str2resolution(char const *resolutionStr)
Pixel resolution string to meters.
int getFileFormatIndex(const char *str)
const char * getFileFormatExtension(const char *str)