⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ppf_visibility_valid.c

📁 read envisat and analyis sar data from NASA
💻 C
📖 第 1 页 / 共 2 页
字号:
#include <stdio.h>#include <math.h>#include <string.h>#include <stdlib.h>#include <ppf_visibility.h>/* This version number is the SCCS version number valid only for internal configuration and control. *//* The oficial version number can be found in the History box below. */static char PPF_VISIBILITY_VALID_C [] = "@(#)ppf_visibility_valid.c	2.8     00/04/13";/***************************************************************************************** * * Copyright    : DEIMOS Space S.L. * Project      : REMASE * * Test level   : VALIDATION * * Module       : ppf_visibility_valid.c * Purpose      : It runs validation tests of PPF_VISIBILITY * * History      +------------------------------------------------------------------------+ *              | Version | Date     | Name         | Change                             | *              |---------|----------|--------------|------------------------------------| *              |    2.1  | 05/12/97 | GMV, S.A.    | First release                      | *              |    2.2  | 18/05/98 | GMV, S.A.    | Second release                     | *              |    2.3  | 13/10/98 | GMV, S.A.    | Third release                      | *		|    2.4  | 25/05/99 | GMV, S.A.    | Fourth release                     | *		|    2.5  | 14/04/00 | GMV, S.A.    | Fifth release                      | *              |    2.6  | 22/06/01 | GMV, S.A.    | Sixth release                      | *		|    2.7  | 31/07/01 | GMV, S.A.    | Seventh release                    | *		|    2.8  | 22/10/01 | DEIMOS Space | Eigth release                      | *		|    3.0  | 18/01/02 | DEIMOS Space | Ninth release                      | *		|    3.1  | 25/11/02 | DEIMOS Space | Tenth release                      | *		|    3.2  | 26/05/03 | DEIMOS Space | Eleventh release                   | *		|    3.3  | 13/12/04 | DEIMOS Space | Twelfth release                    | *		|   3.3.1 | 15/02/05 | DEIMOS Space | Thirteenth release                 | *		|    3.4  | 17/05/05 | DEIMOS Space | Forteenth release                  | *              +------------------------------------------------------------------------+ * ****************************************************************************************//* Macro definition *//* ---------------- */#define MAX_CONDITION			1000	/* Maximum number of checks per test case */#define START_VALIDATION		int main(int argc, char *argv[]){ \					double di,th,ta,tb,sinta,costa,sintb,costb; \					double di_l,di_r,th_l,th_r; \					int i,j; \					int checks; \					PL_Boolean condition[MAX_CONDITION]; \					PL_Boolean result;#define START_CHECK(msg)                printf(" *** %s\n",msg); \                                        checks = 0;#define END_CHECK                       result = PL_TRUE; \                                        for (i = 0 ; i < checks ; i++) \                                          { \                                          if (condition[i] == PL_FALSE) \                                            { \                                            result = PL_FALSE; \                                            break; \                                            } \                                          } \                                        if (result == PL_TRUE) \                                          { \                                          printf(" *** RESULT = PASS ***\n\n"); \                                          } \                                        else \ 					  { \                                          printf(" *** RESULT = FAIL ***\n\n"); \                                          }#define CHECK_STATUS(msg,stat)		if (stat < PV_OK ) { \					  condition[checks] = PL_FALSE; \					  printf(" ...\t%s (PL_FALSE)\n",msg); \					}else{ \					  condition[checks] = PL_TRUE; \					  printf(" ...\t%s (PL_TRUE)\n",msg); \					} \                                        checks++;					#define CHECK_PAR(msg,p,p0,dp)		if((di=fabs(p-p0)) <= (th=dp)){ \					  condition[checks] = PL_TRUE; \					  printf(" ...\t%s (PL_TRUE)\n",msg); \					}else{ \					  condition[checks] = PL_FALSE; \					  printf(" ...\t%s (PL_FALSE)\n",msg); \					} \					printf("\t\t Threshold  : %g\n",th); \					printf("\t\t Difference : %g\n",di); \					checks++;#define CHECK_VEC(msg,v,v0,im,iM,dp)	for(i=im;i<=iM;++i){ \					  CHECK_PAR(msg,v[i],v0[i],dp); \					}#define END_VALIDATION			return(0); \					}/* pv_drsvistime max value */#define MAX_SEGMENTS   999#define MAX_LENGTH     256typedef enum{PL_FALSE = 0,      /* False variable */PL_TRUE = 1        /* True variable */} PL_Boolean;/* Validation for PPF_VISIBILITY *//* ----------------------------- */START_VALIDATION/* Local variables definition *//* -------------------------- */	   long status;                         /* Main status flag */   long local_status;   long n_msg, n;				/* Number of error messages */   long func_id;                        /* CFI function ID */      char msg[PV_MAX_COD][PV_MAX_STR];    /* Error messages vector */   long code[PV_MAX_COD];          	/* Error codes vector */   long k;   /* Variables to call "pv_anxutc" and "pv_utcanx" */   /* --------------------------------------------- */   long second_anxutc, microsec_anxutc, orbit_anxutc;   long orbit_t, second_t, microsec_t, ierr_t[10];     double utc_t;   char orbit_event_file_t[PV_MAX_STR];   /* Variables to call "pv_drsvistime" */   /* --------------------------------- */   long start_orbit, stop_orbit,        max_segments, number_segments,        bgn_orbit[MAX_SEGMENTS],        bgn_second[MAX_SEGMENTS],        bgn_microsec[MAX_SEGMENTS],        end_orbit[MAX_SEGMENTS],        end_second[MAX_SEGMENTS],        end_microsec[MAX_SEGMENTS];   double min_duration, longitude;   /* Variables to call "pv_zonevistime" */   /* ---------------------------------- */   char zone_id[9];   char swath_file[PV_MAX_STR], zone_db_file[PV_MAX_STR];   long projection, zone_num;   double zone_long[10], zone_lat[10], zone_diam;   long coverage[MAX_SEGMENTS];   /* Variables to call "pv_swathcalc" */   /* -------------------------------- */   double long_osf[3], lat_osf[3], alt_osf[3];   /* Variables to call "pv_stavistime" */   /* --------------------------------- */   long zdop_orbit[MAX_SEGMENTS], zdop_second[MAX_SEGMENTS], zdop_microsec[MAX_SEGMENTS];   long mask;   char sta_id[9], sta_db_file[PV_MAX_STR];   double aos_elevation, los_elevation;   /* Variables to call "pv_orbitinfo" */   /* -------------------------------- */   long    mode, abs_orbit, rel_orbit, cycle, phase, repeat_cycle, cycle_length, ierr[10];   double  phasing, mlst, mjd_anx[2], pos_anx[3], vel_anx[3], xm_anx[6];   char    orbit_event_file[MAX_LENGTH];   /* Variables to call "pv_starvistime" */   /* ---------------------------------- */   double   star_ra, star_dec, star_ra_deg, star_dec_deg;   char     swath_file_lower[PV_MAX_STR], swath_file_upper[PV_MAX_STR];   char     star_id[PV_MAX_STR], star_db_file[PV_MAX_STR];   long     bgn_coverage[MAX_SEGMENTS], end_coverage[MAX_SEGMENTS];   /* variable to call to time segments mamipulation cfi's */   /* ---------------------------------------------------- */   long orbit_type;   long num_out, order_switch,        *bgn_orbit_res,        *bgn_secs_res,        *bgn_microsecs_res,        *bgn_cycle_res,        *bgn_cycle,        *end_orbit_res,        *end_secs_res,        *end_microsecs_res,        *end_cycle_res,        *end_cycle;   long pv_not_ierr[1];   long pv_or_ierr[1];   long pv_and_ierr[1];   long pv_sort_ierr[1];   long pv_merge_ierr[1];   long pv_delta_ierr[1];   long order_criteria,        operation,        delta_secs,        delta_microsecs;   double entry_delta,     exit_delta;/***************************************************************************************** * * --------- * Test case * --------- * * Test number          : VT-1 * ****************************************************************************************/START_CHECK("Check PV_ANXUTC-PV_UTCANX compatibility")   /* Calling pv_anxutc   */   /* ------------------- */#ifndef PL_WINDOWS   strcpy(orbit_event_file_t,      "../example/data/MPL_ORB_EVTEMM19970829_093100_00000000_00000000_19970101_000000_20991231_000000.N1");#else   strcpy(orbit_event_file_t,      "..\\example\\data\\MPL_ORB_EVTEMM19970829_093100_00000000_00000000_19970101_000000_20991231_000000.N1");#endif   orbit_anxutc= 2964;   second_anxutc= 3000;   microsec_anxutc= 50;   n = 0;   sprintf(msg[n++], "\n\nPV_ANXUTC\n");        pv_print_msg(&n, msg);     local_status=pv_anxutc(orbit_event_file_t, &orbit_anxutc, &second_anxutc, &microsec_anxutc,                  &utc_t, ierr_t);   if (local_status != PV_OK)      {      func_id = PV_ANXUTC_ID;      pv_vector_msg(&func_id, ierr_t, &n, msg);      pv_print_msg(&n, msg);      }   CHECK_STATUS("ANXUTC status", local_status)   n = 0;   sprintf(msg[n++], "\n\nPV_UTCANX\n");        pv_print_msg(&n, msg);     local_status=pv_utcanx("", &orbit_t, &second_t, &microsec_t, &utc_t, ierr_t);   /* The output must be the input of "pv_anxutc" in the above call. */   if (local_status != PV_OK)      {      func_id = PV_UTCANX_ID;      pv_vector_msg(&func_id, ierr_t, &n, msg);      pv_print_msg(&n, msg);      }   CHECK_STATUS("UTCANX status", local_status)   CHECK_PAR("Orbit ANXUTC/UTCANX", orbit_anxutc, orbit_t, 0)   CHECK_PAR("Seconds ANXUTC/UTCANX", second_anxutc, second_t, 0)   CHECK_PAR("Microseconds ANXUTC/UTCANX", microsec_anxutc, microsec_t, 0)END_CHECK/***************************************************************************************** * * --------- * Test case * --------- * * Test number          : VT-2 * ****************************************************************************************/START_CHECK("Check that PV_DRSVISTIME status is OK")   /* Calling pv_drsvistime */   /* --------------------- */   max_segments=MAX_SEGMENTS;#ifndef PL_WINDOWS   strcpy(orbit_event_file_t,      "../example/data/MPL_ORB_EVTEMM19970829_093100_00000000_00000000_19970101_000000_20991231_000000.N1");#else   strcpy(orbit_event_file_t,      "..\\example\\data\\MPL_ORB_EVTEMM19970829_093100_00000000_00000000_19970101_000000_20991231_000000.N1");#endif   start_orbit=2950;   stop_orbit=2970;   longitude=16.4;   min_duration=0.0;  /* In seconds, minimum duration of an occultation that can be computed */   n = 0;   sprintf(msg[n++], "\n\nPV_DRSVISTIME\n");        pv_print_msg(&n, msg);     local_status= pv_drsvistime(orbit_event_file_t, &start_orbit, &stop_orbit,                         &longitude,                         &max_segments, &min_duration,                         &number_segments,                         bgn_orbit, bgn_second, bgn_microsec,                         end_orbit, end_second, end_microsec,                         ierr_t);   CHECK_STATUS("DRSVISTIME status", local_status)   if (local_status != PV_OK)      {      func_id = PV_DRSVISTIME_ID;      pv_vector_msg(&func_id, ierr_t, &n, msg);      pv_print_msg(&n, msg);      }END_CHECK/***************************************************************************************** * * --------- * Test case * --------- * * Test number          : VT-3 * ****************************************************************************************/START_CHECK("Check that PV_SWATHCALC status is OK")   /* Calling pv_swathcalc */   /* -------------------- */   strcpy(orbit_event_file_t,"");   orbit_t = 2950;   second_t = 0;   microsec_t = 0;#ifndef PL_WINDOWS   strcpy(swath_file, "../example/data/RA_2___501_.N1");#else   strcpy(swath_file, "..\\example\\data\\RA_2___501_.N1");#endif   n = 0;   sprintf(msg[n++], "\n\nPV_SWATHCALC\n");      pv_print_msg(&n, msg);     local_status = pv_swathcalc(orbit_event_file_t, swath_file, &orbit_t, &second_t, &microsec_t,                                  long_osf, lat_osf, alt_osf, ierr_t);   if (local_status != PV_OK)      {      func_id = PV_SWATHCALC_ID;      pv_vector_msg(&func_id, ierr_t, &n, msg);      pv_print_msg(&n, msg);      }   CHECK_STATUS("SWATHCALC status", local_status)END_CHECK/***************************************************************************************** * * --------- * Test case * --------- * * Test number          : VT-4 * ****************************************************************************************/START_CHECK("Check that PV_STAVISTIME status is OK")   /* Calling pv_stavistime */   /* --------------------- */   strcpy(orbit_event_file_t,"");   start_orbit		= 2900;   stop_orbit		= 2950;#ifndef PL_WINDOWS   strcpy(swath_file, "../example/data/RA_2___501_.N1");   strcpy(sta_id, "GMASPABX");   strcpy(sta_db_file,        "../example/data/MPL_GND_DBTRGT19970515_120000_00000000_00000000_19950101_000000_20100101_000000.N1");#else   strcpy(swath_file, "..\\example\\data\\RA_2___501_.N1");   strcpy(sta_id, "GMASPABX");   strcpy(sta_db_file,        "..\\example\\data\\MPL_GND_DBTRGT19970515_120000_00000000_00000000_19950101_000000_20100101_000000.N1");#endif   mask			= 0;   aos_elevation	= 0.0;   los_elevation	= 0.0;   max_segments=MAX_SEGMENTS;   min_duration = 0.0;   n = 0;   sprintf(msg[n++], "\n\nPV_STAVISTIME\n");    pv_print_msg(&n, msg);     local_status = pv_stavistime(orbit_event_file_t, &start_orbit, &stop_orbit, swath_file,                    sta_id, sta_db_file, &mask, &aos_elevation, &los_elevation,                    &max_segments, &min_duration, &number_segments,                    bgn_orbit, bgn_second, bgn_microsec, end_orbit, end_second, end_microsec,                    zdop_orbit, zdop_second, zdop_microsec, ierr_t);   if (local_status != PV_OK)      {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -