📄 ppf_visibility_c.c
字号:
/* 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 sccs_id[]="@(#)ppf_visibility_c.c 2.7 00/04/13"; /****************************************************************************** * * Module : ppf_visibility_c.c * * Functions : main program (PPF_VISIBILITY example) to call: * * - pv_stavistime * - pv_drsvistime * - pv_zonevistime * - pv_swathcalc * - pv_anxutc * - pv_utcanx * - pv_starvistime * -pv_orbitinfo * * Purpose : Example program to show the way to call the above functions. * * +-------------------------------------------------------------+ * 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 | Eigth release | * | 3.0 | 18/01/02 | DEIMOS | Ninth release | * | 3.1 | 25/11/02 | DEIMOS | Tenth release | * | 3.2 | 26/05/03 | DEIMOS | Eleventh release | * | 3.3 | 13/12/04 | DEIMOS | Twelfth release | * | 3.3.1| 15/02/05 | DEIMOS | Thirteenth release | * | 3.4 | 17/05/05 | DEIMOS | Forteenth release | * +-------------------------------------------------------------+ * ******************************************************************************/#include <stdio.h>#include <stdlib.h>#include <math.h>#include <string.h>#include <time.h>#include <ppf_visibility.h> /* PPF_VISIBILITY header file */#ifndef _PPF_LIB_H#include <ppf_lib.h>#endif#ifndef _PPF_ORBIT_H#include <ppf_orbit.h>#endif/* pv_drsvistime max value */#define MAX_SEGMENTS 999#define MAX_LENGTH 256/* Main program *//* ------------ */ main (){ long status; /* Main status flag */ long 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; /* pv_anxutc & pv_utcanx variables */ /* ------------------------------- */ long orbit_t, second_t, microsec_t, ierr_t[10]; double utc_t; char orbit_event_file_t[PV_MAX_STR]; /* pv_drsvistime variables */ /* -------------------------------- */ long start_orbit, stop_orbit,max_segments, number_segments; long bgn_orbit[MAX_SEGMENTS],bgn_second[MAX_SEGMENTS],bgn_microsec[MAX_SEGMENTS]; long end_orbit[MAX_SEGMENTS],end_second[MAX_SEGMENTS],end_microsec[MAX_SEGMENTS]; long ierr[10]; 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_orb[10]; double phasing, mlst, mjd_anx[2], pos_anx[3], vel_anx[3], xm_anx[6]; /* STARVISTIME variables */ /* --------------------- */ double star_ra, star_dec; double star_ra_deg, star_dec_deg; long bgn_coverage[MAX_SEGMENTS], end_coverage[MAX_SEGMENTS]; long star_ierr[10]; char swath_file_upper[PV_MAX_STR], swath_file_lower[PV_MAX_STR]; char star_id[PV_MAX_STR], star_db_file[PV_MAX_STR]; /* variable to call to time segments mamipulation cfi's */ /* ---------------------------------------------------- */ long i; 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; /* long operation; long delta_secs, delta_microsecs;*/ double entry_delta, exit_delta; /* Initialization */ /* ============== */ status=PV_OK; /* Set error handling mode to SILENT */ /* ---------------------------------- */ pv_silent(); /* Set error handling mode to SILENT */ /* Dummy Test of Logging feature */ /* ----------------------------- */ n = 0; strcpy(msg[n++],"This is the first user's log message"); strcpy(msg[n++],"This is the second user's log message"); pv_print_msg(&n,msg); /* Calling pv_anxutc */ /* ------------------- */#ifndef PL_WINDOWS strcpy(orbit_event_file_t, "../data/MPL_ORB_EVTEMM19970829_093100_00000000_00000000_19970101_000000_20991231_000000.N1");#else strcpy(orbit_event_file_t, "..\\data\\MPL_ORB_EVTEMM19970829_093100_00000000_00000000_19970101_000000_20991231_000000.N1");#endif orbit_t= 2964; second_t= 3000; microsec_t= 50; n = 0; sprintf(msg[n++], "\n\nPV_ANXUTC\n"); pv_print_msg(&n, msg); status=pv_anxutc(orbit_event_file_t, &orbit_t, &second_t, µsec_t, &utc_t, ierr_t); if (status != PV_OK) { func_id = PV_ANXUTC_ID; pv_vector_msg(&func_id, ierr_t, &n, msg); pv_print_msg(&n, msg); /* example of handling of error codes - in this case to detect an error on input */ pv_vector_code(&func_id, ierr_t, &n, code); for (k=0; k<n; k++) { if (code[k] == PV_CFI_ANXUTC_ORB_NUM_1ST_ERR) { n = 0; sprintf(msg[n++], "\n*** This error means that \"orb_num\" is not correct\n"); pv_print_msg(&n, msg); } } } /* PV_UTCANX */ /* In this case, "utc_t" is the output of "pv_anxutc" when it was called above. "pv_utcanx" is called with the "oef" of the last PPF_VISIBILITY function called (see above). */ n = 0; sprintf(msg[n++], "\n\nPV_UTCANX\n"); pv_print_msg(&n, msg); status=pv_utcanx("", &orbit_t, &second_t, µsec_t, &utc_t, ierr_t); /* The output must be the input of "pv_anxutc" in the above call. */ if (status != PV_OK) { func_id = PV_UTCANX_ID; pv_vector_msg(&func_id, ierr_t, &n, msg); pv_print_msg(&n, msg); } /* Calling pv_swathcalc */ /* -------------------- */ strcpy(orbit_event_file_t,""); orbit_t = 2950; second_t = 0; microsec_t = 0;#ifndef PL_WINDOWS strcpy(swath_file, "../data/RA_2___501_.N1");#else strcpy(swath_file, "..\\data\\RA_2___501_.N1");#endif n = 0; sprintf(msg[n++], "\n\nPV_SWATHCALC\n"); pv_print_msg(&n, msg); status = pv_swathcalc(orbit_event_file_t, swath_file, &orbit_t, &second_t, µsec_t, long_osf, lat_osf, alt_osf, ierr_t); if (status != PV_OK) { func_id = PV_SWATHCALC_ID; pv_vector_msg(&func_id, ierr_t, &n, msg); pv_print_msg(&n, msg); } /* --- call STARVISTIME --- */ /* ------------------------ */ /* INPUTS for starvistime */ /* ---------------------- */ status = PV_OK; strcpy(orbit_event_file_t, ""); start_orbit = 2900; stop_orbit = 3000; star_ra = 20.0; star_dec = 80.0;#ifndef PL_WINDOWS strcpy(swath_file_upper, "../data/GOMOIH_.N1"); strcpy(swath_file_lower, "../data/GOMOIL_.N1");#else strcpy(swath_file_upper, "..\\data\\GOMOIH_.N1"); strcpy(swath_file_lower, "..\\data\\GOMOIL_.N1");#endif strcpy(star_id, ""); strcpy(star_db_file, ""); max_segments=MAX_SEGMENTS; min_duration = 0.0; n = 0; sprintf(msg[n++], "\n\nPV_STARVISTIME\n"); pv_print_msg(&n, msg); status = pv_starvistime(orbit_event_file_t, &start_orbit, &stop_orbit, swath_file_upper, swath_file_lower, star_id, star_db_file, &star_ra, &star_dec, &max_segments, &min_duration, &star_ra_deg, &star_dec_deg, &number_segments, bgn_orbit, bgn_second, bgn_microsec,bgn_coverage, end_orbit, end_second, end_microsec,end_coverage, star_ierr); if (status != PV_OK) { func_id = PV_STARVISTIME_ID; pv_vector_msg(&func_id, star_ierr, &n, msg); pv_print_msg(&n, msg); } /* Calling "pv_stavistime" */ strcpy(orbit_event_file_t,""); start_orbit = 2900; stop_orbit = 2950; #ifndef PL_WINDOWS strcpy(swath_file, "../data/RA_2___501_.N1"); strcpy(sta_id, "GMASPABX"); strcpy(sta_db_file, "../data/MPL_GND_DBTRGT19970515_120000_00000000_00000000_19950101_000000_20100101_000000.N1");#else strcpy(swath_file, "..\\data\\RA_2___501_.N1"); strcpy(sta_id, "GMASPABX"); strcpy(sta_db_file, "..\\data\\MPL_GND_DBTRGT19970515_120000_00000000_00000000_19950101_000000_20100101_000000.N1");#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -