ocssw  1.0
/data1/web/ocssw/build/src/auto_qc/l1stat_chk/rd_nav_t.c (r10353/r2592)
Go to the documentation of this file.
00001 #include "l1stat.h"
00002 #include "l1stat_proto.h"
00003 
00004 extern int32 stat_status;
00005 
00006 int rd_nav_t( int32 sdfid, int32 nscans, nav_t_str *nav_t )
00007 /*******************************************************************
00008 
00009    rd_nav_t
00010 
00011    purpose: read a set of navigation and time values from the 
00012             L1 dataset
00013 
00014    Returns type: none
00015 
00016    Parameters: (in calling order)
00017       Type              Name            I/O     Description
00018       ----              ----            ---     -----------
00019       int32             sdfid           I       SD interface ID
00020       int32             nscans          I       # of scan lines
00021       nav_t_str *       nav_t           O       structure containing the 
00022                                                 pointers to the nav sds data
00023 
00024    Modification history:
00025       Programmer        Date            Description of change
00026       ----------        ----            ---------------------
00027       W. Robinson, GSC  29-Dec-1999     Original development
00028 
00029 *******************************************************************/
00030 {
00031   int32  start[3], edge[3];
00032  /*
00033   *  Allocate space for the navigation buffers
00034   */
00035 
00036   if ((nav_t->orb_vec = (float32 *)calloc (nscans * 3, sizeof(float32))) == NULL)
00037     {
00038     sprintf(err_msg,"chk_nav: cannot allocate memory for reading orb_vec");
00039     return FAIL;
00040     }
00041 
00042   if ((nav_t->sun_ref = (float32 *)calloc (nscans * 3, sizeof(float32))) == NULL)
00043     {
00044     sprintf(err_msg,"chk_nav: cannot allocate memory for reading sun_ref");
00045     return FAIL;
00046     }
00047 
00048   if ((nav_t->sen_mat = (float32 *)calloc (nscans*3*3, sizeof(float32))) == NULL)
00049     {
00050     sprintf(err_msg,"chk_nav: cannot allocate memory for reading sen_mat");
00051     return FAIL;
00052     }
00053  
00054   if ((nav_t->scan_ell = (float32 *)calloc (nscans * 6, sizeof(float32))) == NULL)
00055     {
00056     sprintf(err_msg,"chk_nav: cannot allocate memory for reading scan_ell");
00057     return FAIL;
00058     }
00059 
00060   if ((nav_t->msec = (int32_t *)calloc ( nscans, sizeof(int32_t))) == NULL)
00061     {
00062     sprintf(err_msg,"chk_nav: cannot allocate memory for reading msec");
00063     return FAIL;
00064     }
00065   if ((nav_t->nflag = (int32 *)calloc (nscans*8, sizeof(int32))) == NULL)
00066     {
00067     sprintf(err_msg,"chk_nav: cannot allocate memory for reading nflag");
00068     return FAIL;
00069     }
00070 
00071  /*
00072   *  Set start and end dims for reading orb_vec sds
00073   */
00074   start[0] = start[1] = start[2] = 0;
00075   edge[0] = nscans;
00076   edge[1] = 3;
00077   edge[2] = 0;
00078   if ((rdslice(sdfid, ORBVEC, start, edge, (VOIDP)nav_t->orb_vec)) < 0)
00079     {
00080     stat_status = stat_status | 1;
00081     return FAIL;
00082     }
00083 
00084  /*
00085   *  Set start and end dims and read sun_ref sds
00086   */
00087   start[0] = start[1] = start[2] = 0;
00088   edge[0] = nscans;
00089   edge[1] = 3;
00090   edge[2] = 0;
00091   if ((rdslice(sdfid, SUNREF, start, edge, (VOIDP)nav_t->sun_ref)) < 0)
00092     {
00093     stat_status = stat_status | 1;
00094     return FAIL;
00095     }
00096 
00097  /*
00098   *  Set start and end dims and read sen_mat sds
00099   */
00100   start[0] = start[1] = start[2] = 0;
00101   edge[0] = nscans;
00102   edge[1] = 3;
00103   edge[2] = 3;
00104   if ((rdslice(sdfid, SENMAT, start, edge, (VOIDP)nav_t->sen_mat)) < 0)
00105     {
00106     stat_status = stat_status | 1;
00107     return FAIL;
00108     }
00109 
00110  /*
00111   *  Set start and end dims and read scan_ell sds
00112   */
00113   start[0] = start[1] = start[2] = 0;
00114   edge[0] = nscans;
00115   edge[1] = 6;
00116   edge[2] = 0;
00117   if ((rdslice(sdfid, SCANELL, start, edge, (VOIDP)nav_t->scan_ell)) < 0)
00118     {
00119     stat_status = stat_status | 1;
00120     return FAIL;
00121     }
00122 
00123  /*
00124   *  Set start and end dims and read msec sds
00125   */
00126   start[0] = start[1] = start[2] = 0;
00127   edge[0] = nscans;
00128   edge[1] = 0;
00129   edge[2] = 0;
00130   if ((rdslice(sdfid, "msec", start, edge, (VOIDP)nav_t->msec )) < 0)
00131     {
00132     stat_status = stat_status | 1;
00133     return FAIL;
00134     }
00135 
00136  /*
00137   *  Set start and end dims and read nflag sds
00138   */
00139   start[0] = start[1] = start[2] = 0;
00140   edge[0] = nscans;
00141   edge[1] = 8;
00142   edge[2] = 0;
00143   if ((rdslice(sdfid, NFLAG, start, edge, (VOIDP)nav_t->nflag )) < 0)
00144     {
00145     stat_status = stat_status | 1;
00146     return FAIL;
00147     }
00148   return SUCCEED;
00149 }