OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
geolocate_oci.h
Go to the documentation of this file.
1 #ifndef _GEOLOCATE_OCI_H_
2 #define _GEOLOCATE_OCI_H_
3 
4 #include "common.h"
5 
6 #include <netcdf>
7 
8 
9 #define SWAP_2(x) ( (((x) & 0xff) << 8) | ((unsigned short)(x) >> 8) )
10 
11 #define SWAP_4(x) ( ((x) << 24) | \
12  (((x) << 8) & 0x00ff0000) | \
13  (((x) >> 8) & 0x0000ff00) | \
14  ((x) >> 24) )
15 
16 typedef float quat_array[4];
17 typedef float orb_array[3];
18 
19 double constexpr PI = 3.14159265358979323846;
20 double constexpr RADEG = 180 / PI;
21 double constexpr DTOR = PI / 180;
22 
23 float constexpr focal_length = 45.184;
24 
25 
26 class geoFile {
27  netCDF::NcFile *geofile;
28 
29  std::string fileName;
30 
31  int ngrps;
32  int ndims;
33 
34  netCDF::NcDim ncDims[1000];
35 
36  public:
37  geoFile();
38  ~geoFile();
39 
40  netCDF::NcGroup ncGrps[10];
41 
42  int createFile( const char* filename, const char* cdlfile,
43  size_t sdim, int *ncid, int *gid);
44 
45  int parseDims( std::string dimString, std::vector<netCDF::NcDim>& varDims);
46 
47 };
48 
49 int read_mce_tlm( netCDF::NcFile *l1afile, netCDF::NcGroup egid,
50  uint32_t nscan, uint32_t nenc, int32_t& ppr_off,
51  double& revpsec, double&secpline, int32_t *mspin,
52  int32_t *ot_10us, uint8_t *enc_count,
53  float **hamenc, float **rtaenc);
54 
55 int j2000_to_ecr(int32_t iyr, int32_t idy, double sec, double ecmat[3][3]);
56 int j2000_to_mod(int32_t iyr, int32_t idy, double sec, double j2mod[3][3]);
57 int get_nut(int32_t iyr, int32_t idy, double xnut[3][3]);
58 int get_ut1(int32_t iyr, int32_t idy, double &ut1utc);
59 int ephparms(double t, double &xls, double &gs, double &xlm, double &omega);
60 int nutate(double t, double xls, double gs, double xlm, double omega,
61  double &dpsi, double &eps, double &epsm);
62 int gha2000(int32_t iyr, double day, double &gha);
63 int mtoq(double rm[3][3], double q[4]);
64 int qprod(double q1[4], float q2[4], double q3[4]);
65 int qprod(float q1[4], float q2[4], float q3[4]);
66 int orb_interp(size_t n_SC_rec, size_t sdim,
67  double *torb, orb_array *p, orb_array *v,
68  double *time, orb_array *posi, orb_array *veli);
69 int q_interp(size_t n_SC_rec, size_t sdim, double *tq, quat_array *q,
70  double *time, quat_array *qi);
71 int l_sun(size_t sdim, int32_t iyr, int32_t iday,
72  double *sec, orb_array *sunr);
73 int sun2000(size_t sdim, int32_t iyr, int32_t idy,
74  double *sec, orb_array *sun);
75 int qtom(float quat[4], double rm[3][3]);
76 int scan_ell(float p[3], double sm[3][3], double coef[10]);
77 
78 int oci_geonav(float pos[3], float vel[3], double smat[3][3], double coef[10],
79  float sunr[3], float **pview, size_t npix, double delt,
80  float *xlat, float *xlon, short *solz, short *sola,
81  short *senz, short *sena, short *range);
82 
83 int mat2rpy(float pos[3], float vel[3], double smat[3][3], float rpy[3]);
84 
85 
86 
87 inline
88 int expandEnvVar( std::string *sValue) {
89  if ( (*sValue).find_first_of( "$" ) == std::string::npos) return 0;
90  std::string::size_type posEndIdx = (*sValue).find_first_of( "/" );
91  if ( posEndIdx == std::string::npos) return 0;
92  const std::string envVar = sValue->substr (1, posEndIdx - 1);
93  char *envVar_str = getenv(envVar.c_str());
94  if (envVar_str == 0x0) {
95  printf("Environment variable: %s not defined.\n", sValue->c_str());
96  exit(1);
97  }
98  *sValue = envVar_str + (*sValue).substr( posEndIdx);
99 
100  return 0;
101 }
102 
103 
105 
106 }
107 
108 
110 
111 }
112 
113 
114 #endif // _GEOLOCATE_OCI_H_
constexpr float focal_length
Definition: geolocate_oci.h:23
data_t q
Definition: decode_rs.h:74
data_t t[NROOTS+1]
Definition: decode_rs.h:77
int nutate(double t, double xls, double gs, double xlm, double omega, double &dpsi, double &eps, double &epsm)
int parseDims(std::string dimString, std::vector< netCDF::NcDim > &varDims)
int32_t day
int get_ut1(int32_t iyr, int32_t idy, double &ut1utc)
int ephparms(double t, double &xls, double &gs, double &xlm, double &omega)
int mtoq(double rm[3][3], double q[4])
int sun2000(size_t sdim, int32_t iyr, int32_t idy, double *sec, orb_array *sun)
int qprod(double q1[4], float q2[4], double q3[4])
float32 * pos
Definition: l1_czcs_hdf.c:35
float orb_array[3]
Definition: geolocate_oci.h:17
constexpr double PI
Definition: geolocate_oci.h:19
int32 nscan
Definition: l1_czcs_hdf.c:19
@ string
constexpr double RADEG
Definition: geolocate_oci.h:20
float quat_array[4]
Definition: geolocate_oci.h:16
int expandEnvVar(std::string *sValue)
Definition: geolocate_oci.h:88
int j2000_to_ecr(int32_t iyr, int32_t idy, double sec, double ecmat[3][3])
data_t omega[NROOTS+1]
Definition: decode_rs.h:77
int oci_geonav(float pos[3], float vel[3], double smat[3][3], double coef[10], float sunr[3], float **pview, size_t npix, double delt, float *xlat, float *xlon, short *solz, short *sola, short *senz, short *sena, short *range)
int createFile(const char *filename, const char *cdlfile, size_t sdim, int *ncid, int *gid)
netCDF::NcGroup ncGrps[10]
Definition: geolocate_oci.h:40
int j2000_to_mod(int32_t iyr, int32_t idy, double sec, double j2mod[3][3])
int scan_ell(float p[3], double sm[3][3], double coef[10])
char filename[FILENAME_MAX]
Definition: atrem_corl1.h:122
float xlon[LAC_PIXEL_NUM]
Definition: l1a_seawifs.c:93
int orb_interp(size_t n_SC_rec, size_t sdim, double *torb, orb_array *p, orb_array *v, double *time, orb_array *posi, orb_array *veli)
constexpr double DTOR
Definition: geolocate_oci.h:21
this program makes no use of any feature of the SDP Toolkit that could generate such a then geolocation is calculated at that and then aggregated up to Resolved feature request Bug by adding three new int8 SDSs for each high resolution offsets between the high resolution geolocation and a bi linear interpolation extrapolation of the positions This can be used to reconstruct the high resolution geolocation Resolved Bug by delaying cumulation of gflags until after validation of derived products Resolved Bug by setting Latitude and Longitude to the correct fill resolving to support Near Real Time because they may be unnecessary if use of entrained ephemeris and attitude data is turned resolving bug report Corrected to filter out Aqua attitude records with missing status helping resolve bug MOD_PR03 will still correctly write scan and pixel data that does not depend upon the start time
Definition: HISTORY.txt:248
int read_mce_tlm(netCDF::NcFile *l1afile, netCDF::NcGroup egid, uint32_t nscan, uint32_t nenc, int32_t &ppr_off, double &revpsec, double &secpline, int32_t *mspin, int32_t *ot_10us, uint8_t *enc_count, float **hamenc, float **rtaenc)
int get_nut(int32_t iyr, int32_t idy, double xnut[3][3])
int l_sun(size_t sdim, int32_t iyr, int32_t iday, double *sec, orb_array *sunr)
int mat2rpy(float pos[3], float vel[3], double smat[3][3], float rpy[3])
int qtom(float quat[4], double rm[3][3])
int32_t idy
Definition: atrem_corl1.h:161
int32_t iyr
Definition: atrem_corl1.h:161
int q_interp(size_t n_SC_rec, size_t sdim, double *tq, quat_array *q, double *time, quat_array *qi)
int npix
Definition: get_cmp.c:27
float p[MODELMAX]
Definition: atrem_corl1.h:131
int gha2000(int32_t iyr, double day, double &gha)