📄 ppf_genref_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_genref_c.c 1.16 99/05/19"; /****************************************************************************** * * Module : ppf_genref_c.c * * Functions : main program (PPF_GENREF example) to call: * * - pg_genoef * - pg_genswath * * 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.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 <string.h>#include <stdio.h>#include <time.h>#include <ppf_genref.h> /* PPF_GENREF header file */#define MAX_LENGTH 256/* Main program *//* ------------ */long main (int argc, char *argv[]){ long status; /* Main status flag */ long n; /* Number of error messages */ long func_id; /* CFI function ID */ char msg[PG_MAX_COD][PG_MAX_STR]; /* Error messages vector */ long code[PG_MAX_COD]; /* Error codes vector */ long k;/* pg_genoef variables *//* ------------------- */ long start_orbit, stop_orbit, ierr_genoef_t[10]; char osf_name[MAX_LENGTH], oef_name[MAX_LENGTH];/* auxiliary variables */ FILE *genoef_fp, *genswath_fp; char line [MAX_LENGTH];/* pg_genswath variables *//* --------------------- */ long req_orbit; long rep_cycl, cycl_length; long ierr_genswath_t[36]; char sdf_name[MAX_LENGTH], stf_name[MAX_LENGTH]; /* Set error handling mode to SILENT *//* --------------------------------- */ pg_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"); pg_print_msg(&n,msg);/* Calling pg_genoef *//* ------------------- */ start_orbit=0; stop_orbit=279; strcpy(osf_name, "../data/MPS_ORB_SCTEMM19970829_093100_00000000_00000000_19970101_000000_20991231_000000.N1"); strcpy(oef_name,""); n = 0; sprintf(msg[n++], "\n\nPG_GENOEF\n"); pg_print_msg(&n, msg); status = pg_genoef(osf_name, &start_orbit, &stop_orbit, oef_name, ierr_genoef_t); if (status != PG_OK) { func_id = PG_GENOEF_ID; pg_vector_msg(&func_id, ierr_genoef_t, &n, msg); pg_print_msg(&n, msg); /* example of handling of error codes - in this case to detect an error on input */ pg_vector_code(&func_id, ierr_genoef_t, &n, code); for (k=0; k<n; k++) { if (code[k] == PG_CFI_GENOEF_OSF_WRONG_ERR) { n = 0; sprintf(msg[n++], "\n*** This error means that OSF input is not correct\n"); pg_print_msg(&n, msg); } } if (status <= PG_ERR) return(status); } /* Calling pg_genswath *//* -------------------- */ req_orbit=0; rep_cycl=35; cycl_length=501; strcpy(osf_name, "../data/MPL_ORB_SCTRGT19970515_120000_00000000_00000000_19950101_000000_20100101_000000.N1"); strcpy(sdf_name,"../data/SDF_MERIS.1200pts.N1"); strcpy(stf_name,""); n = 0; sprintf(msg[n++], "\n\nPG_GENSWATH\n"); pg_print_msg(&n, msg); status = pg_genswath(osf_name, &req_orbit, sdf_name, stf_name, &rep_cycl, &cycl_length, ierr_genswath_t); if (status != PG_OK) { func_id = PG_GENSWATH_ID; pg_vector_msg(&func_id, ierr_genswath_t, &n, msg); pg_print_msg(&n, msg); /* example of handling of error codes - in this case to detect an error on input */ pg_vector_code(&func_id, ierr_genswath_t, &n, code); for (k=0; k<n; k++) { if (code[k] == PG_CFI_GENSWATH_PG_CHECK_GENSW_INP_ERR) { n = 0; sprintf(msg[n++], "\n*** This error means that inputs REPEAT CYCLE or CYCLE LENGTH or are not correct or OSF inconsistency.\n"); pg_print_msg(&n, msg); } } if (status <= PG_ERR) return(status); } return(PG_OK);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -