OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_navig_sds.c
Go to the documentation of this file.
1 #include "proto.h"
2 #include "mfhdf.h"
3 
4 int get_navig_sds_line(int32 sd_id, int iline, float32 *sen_mat, float32 *orb_vec, float32 *sun_ref, float32 *scan_ell, char newfile) {
5  static int32 sds_id_sen_mat, sds_id_orb_vec, sds_id_sun_ref, sds_id_scan_ell;
6 
7  if (newfile) {
8  if ((sds_id_sen_mat = open_sds(sd_id, "sen_mat")) == -1 ||
9  (sds_id_orb_vec = open_sds(sd_id, "orb_vec")) == -1 ||
10  (sds_id_sun_ref = open_sds(sd_id, "sun_ref")) == -1 ||
11  (sds_id_scan_ell = open_sds(sd_id, "scan_ell")) == -1)
12  return -1;
13  }
14 
15  /* Read sensor matrix */
16  if (read_sds_block(sds_id_sen_mat, iline, 1, sen_mat) == -1) return -1;
17 
18  /* Read orbit position vector */
19  if (read_sds_block(sds_id_orb_vec, iline, 1, orb_vec) == -1) return -1;
20 
21  /* Read reference sun vector */
22  if (read_sds_block(sds_id_sun_ref, iline, 1, sun_ref) == -1) return -1;
23 
24  /* Read scan-track ellipse coefs */
25  if (read_sds_block(sds_id_scan_ell, iline, 1, scan_ell) == -1) return -1;
26 
27  return 0;
28 
29 }
30 
31 int get_navig_sds(int32 sd_id, float32 *sen_mat, float32 *orb_vec, float32 *sun_ref, float32 *scan_ell, int32 *msec) {
32 
33  /* Read sensor matrix */
34  if (read_sds(sd_id, "sen_mat", sen_mat) == -1) return -1;
35 
36  /* Read orbit position vector */
37  if (read_sds(sd_id, "orb_vec", orb_vec) == -1) return -1;
38 
39  /* Read reference sun vector */
40  if (read_sds(sd_id, "sun_ref", sun_ref) == -1) return -1;
41 
42  /* Read scan-track ellipse coefs */
43  if (read_sds(sd_id, "scan_ell", scan_ell) == -1) return -1;
44 
45  /* Read scan line time */
46  if (read_sds(sd_id, "msec", msec) == -1) return -1;
47 
48  return 0;
49 }
int read_sds_block(int32 sds_id, int iline, int buflines, void *dataP)
Definition: read_write.c:19
int32 * msec
Definition: l1_czcs_hdf.c:31
int get_navig_sds_line(int32 sd_id, int iline, float32 *sen_mat, float32 *orb_vec, float32 *sun_ref, float32 *scan_ell, char newfile)
Definition: get_navig_sds.c:4
int get_navig_sds(int32 sd_id, float32 *sen_mat, float32 *orb_vec, float32 *sun_ref, float32 *scan_ell, int32 *msec)
Definition: get_navig_sds.c:31
int32 open_sds(int32 sd_id, char *sds_name)
Definition: read_write.c:6
int scan_ell(float p[3], double sm[3][3], double coef[10])
int32 read_sds(l1info_struct l1info, char *arr_name, int32 *exp_ntyp, void *array)
Definition: read_sds.c:5