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

📄 ppf_lib_c.c

📁 read envisat and analyis sar data from NASA
💻 C
📖 第 1 页 / 共 2 页
字号:
/* This version number is the SCCS version number valid only for internal configuration control. *//* The oficial version number can be found in the History box below. */ static char PPF_LIB_C_C [] = "@(#)ppf_lib_c.c	1.8		00/04/12"; /****************************************************************************** * * Module      : ppf_lib_c.c * * Functions   : main program (PPF_LIB example) to call: * *                    - pl_change_sv_cs *                    - pl_car_geo *                    - pl_geo_car *                    - pl_srar_cs *                    - pl_geo_distance *                    - pl_tmjd *                    - pl_emjd  *                    - pl_pmjd  *                    - pl_tadd  *                    - pl_tsub  *                    - pl_sbtutc  *                    - pl_utcsbt  *                    - pl_sun *                    - pl_moon *                    - pl_planets     *                    - pl_star_radec * * Purpose     : Example program to show the way to call the previous functions. * *               +-------------------------------------------------------------+ * History     : |Version |  Date  |   Name    | Change                        | *               |-------------------------------------------------------------| *               |    4.1 |21/01/97| GMV, S.A. | First release                 | *               |    4.2 |30/04/97| GMV, S.A. | Second release                | *               |    4.3 |18/05/98| GMV, S.A. | Third release                 | *               |    4.4 |13/10/98| GMV, S.A. | Fourth release                | *               |    4.5 |25/05/99| GMV, S.A. | Fifth release                 | *               |    4.6 |14/04/00| GMV, S.A. | Sixth release                 | *               |    4.7 |22/07/01| GMV, S.A. | Seventh release               | *               |    4.8 |31/07/01| GMV, S.A. | Eight release                 | *               |    4.9 |22/10/01| DEIMOS    | Ninth release                 | *               |    5.0 |18/01/02| DEIMOS    | Tenth release                 | *               |    5.1 |25/11/02| DEIMOS    | Eleventh release              | *               |    5.2 |26/05/03| DEIMOS    | Twelftth release              | *               |    5.3 |13/12/04| DEIMOS    | Thirteenth release            | *               |   5.3.1|15/02/05| DEIMOS    | Forteenth release             | *               |    5.4 |17/05/04| DEIMOS    | Fifteenth release             | *               +-------------------------------------------------------------+ * ******************************************************************************/ #include <math.h>#include <string.h>#include <stdio.h>#include <ppf_lib.h>			/* PPF_LIB header file *//* Main program *//* ------------ */long main (int argc, char *argv[]){         long   mjdt[4], mjdt_2[4], mjdt_3[4];   long   mjdt_a1[4], mjdt_add[4], mjdt_a3[4], mjdt_sub[4];   long   mjdt_s1[4], mjdt_s2[4];   long    cs_in_t, cs_out_t;     unsigned long sbt0, per0, obtm_1, obtl_1, obtm_2, obtl_2;   long    planet_id;   double mjdp[2], mjdp_2[2], mjdp_3[2];   double ut1[2], rsun[3], rdsun[3], rmoon[3], rdmoon[3], rplanet[3], rdplanet[3];   double ra0, dec0, mu_ra, mu_dec, rad_vel, par, ra, dec;   double rr_t[3], rrd_t[3], rr2d_t[3];   double lon_t, lat_t, h_t, lond_t, latd_t, hd_t;   double time_t[2], r_t[3], rd_t[3], r2d_t[3];   double r_out_t[3], rd_out_t[3], r2d_out_t[3];   double aocs_t[3], misp_t[3], mispd_t[3], xs_t[3], ys_t[3], zs_t[3];   double xsd_t[3], ysd_t[3], zsd_t[3], angout_t[3], angoutd_t[3];   double lon1_t, lat1_t, lon2_t, lat2_t;   double d_t, az1_t, az2_t;   char   utce[28], dut1e[9], utce_2[28], dut1e_2[9], utce_3[28], dut1e_3[9];   long   ext_status; 			/* (Extended) status flag */   long    n;				/* Number of error messages */   long    func_id;                      /* CFI function ID */      char   msg[PL_MAX_COD][PL_MAX_STR];	/* Error messages vector */      double dummy_d = 0.0;   long   dummy_l = 0L;/* Variables for Rounding to 32, 40 & 43 bits */    unsigned long round32 = (unsigned long)0x00000001;    unsigned long round40 = (unsigned long)0x00000100;    unsigned long round43 = (unsigned long)0x00000800;    double   dround;    unsigned long wrap  = (unsigned long)0xFFFFFFFF;    double   dwrap = ((double) wrap) + (double) 1.0 ;         unsigned long sbtm43, sbtl43;    unsigned long sbtm40, sbtl40;    unsigned long sbtm32, sbtl32;    double dsbt;/* Set error handling mode to SILENT *//* ---------------------------------- */   pl_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");   pl_print_msg(&n,msg);/* Transform cartesian coordinates from Earth fixed to True of Date coordinate system *//* ---------------------------------------------------------------------------------- */            cs_in_t   = PL_EF;			/* Initial coordinate system = Earth fixed */   cs_out_t  = PL_TOD;			/* Final coordinate system = True of Date */   time_t[0] =  -2456.0;		/* UTC time in MJD2000 (1993-04-11 00:00:00) [days] */   time_t[1] =  0.0;			/* Delta UT1 [s] */   r_t[0]    =   4859964.138;		/* Position vector (x,y,z) [m] */   r_t[1]    =  -5265612.059;   r_t[2]    =         0.002;   rd_t[0]   =  -1203.303801;		/* Velocity vector (x,y,z) [m/s] */   rd_t[1]   =  -1098.845511;   rd_t[2]   =   7377.224410;   r2d_t[0]  =  0.0;			/* Acceleration vector (x,y,z) [m/s2] */   r2d_t[1]  =  0.0;   r2d_t[2]  =  0.0;                          n = 0;   sprintf(msg[n++], "\n\nPL_CHANGE_SV_CS\n");        pl_print_msg(&n, msg);   ext_status = pl_change_sv_cs(time_t, &cs_in_t, &cs_out_t,                                 r_t, rd_t, r2d_t,                                 r_out_t, rd_out_t, r2d_out_t);   if (ext_status != PL_OK)   {        func_id = PL_CHANGE_SV_CS_ID;      pl_vector_msg(&func_id, &ext_status, &n, msg);      pl_print_msg(&n, msg);           if (ext_status <= PL_ERR) return(PL_ERR);    /* CAREFUL: extended status */   }      n = 0;     sprintf(msg[n++], "-   r_out_t[0]: %lf ", r_out_t[0]);		/* Position vector (x,y,z) [m] */   sprintf(msg[n++], "-   r_out_t[1]: %lf ", r_out_t[1]);   sprintf(msg[n++], "-   r_out_t[2]: %lf ", r_out_t[2]);   sprintf(msg[n++], "-  rd_out_t[0]: %lf ", rd_out_t[0]);	/* Velocity vector (x,y,z) [m/s] */   sprintf(msg[n++], "-  rd_out_t[1]: %lf ", rd_out_t[1]);   sprintf(msg[n++], "-  rd_out_t[2]: %lf ", rd_out_t[2]);   sprintf(msg[n++], "- r2d_out_t[0]: %lf ", r2d_out_t[0]);	/* Acceleration vector (x,y,z) [m/s2] */   sprintf(msg[n++], "- r2d_out_t[1]: %lf ", r2d_out_t[1]);   sprintf(msg[n++], "- r2d_out_t[2]: %lf ", r2d_out_t[2]);   pl_print_msg(&n, msg);                       /* Change from cartesian to geodetic coordinates *//* --------------------------------------------- */   rr_t[0]  =   4859964.138;		/* Position vector in the Earth fixed coordinate system (x,y,z) [m] */   rr_t[1]  =  -5265612.059;   rr_t[2]  =         0.002;   rrd_t[0] =  -1203.303801;		/* Velocity vector in the Earth fixed coordinate system (x,y,z) [m/s] */   rrd_t[1] =  -1098.845511;   rrd_t[2] =   7377.224410;   n = 0;   sprintf(msg[n++], "\n\nPL_CAR_GEO\n");        pl_print_msg(&n, msg);   ext_status = pl_car_geo(rr_t, rrd_t, &lon_t, &lat_t, &h_t,                            &lond_t, &latd_t, &hd_t);   if (ext_status != PL_OK)   {      func_id = PL_CAR_GEO_ID;      pl_vector_msg(&func_id, &ext_status, &n, msg);      pl_print_msg(&n, msg);           if (ext_status <= PL_ERR) return(PL_ERR);    /* CAREFUL: extended status */   }      n = 0;   sprintf(msg[n++], "- lon_t: %lf ", lon_t);		/* Geocentric longitude [deg] */   sprintf(msg[n++], "- lat_t: %lf ", lat_t);		/* Geodetic longitude [deg] */   sprintf(msg[n++], "- h_t: %lf ", h_t);			/* Geodetic altitude [m] */   sprintf(msg[n++], "- lond_t: %lf ", lond_t);		/* Geocentric longitude rate [deg/s] */   sprintf(msg[n++], "- latd_t: %lf ", latd_t);		/* Geodetic latitude rate [deg/s] */   sprintf(msg[n++], "- hd_t: %lf ", hd_t);			/* Geodetic altitude rate [m/s] */   pl_print_msg(&n, msg);      /* Change from geodetic to cartesian coordinates *//* --------------------------------------------- */   lon_t    =   4.17;			/* Geocentric longitude [deg] */   lat_t    =   45.0;			/* Geodetic latitude [deg] */   h_t      =  400.0;			/* Geodetic altitude [m] */   lond_t   =  0.0 ;			/* Geocentric longitude rate [deg/s] */   latd_t   =  0.0;			/* Geodetic latitude rate [deg/s] */   hd_t     =  0.0;			/* Geodetic altitude rate [m/s] */      n = 0;   sprintf(msg[n++], "\n\nPL_GEO_CAR\n");        pl_print_msg(&n, msg);   ext_status = pl_geo_car(&lon_t, &lat_t, &h_t, &lond_t, &latd_t, &hd_t, rr_t, rrd_t);   if (ext_status != PL_OK)   {        func_id = PL_GEO_CAR_ID;      pl_vector_msg(&func_id, &ext_status, &n, msg);      pl_print_msg(&n, msg);           if (ext_status <= PL_ERR) return(PL_ERR);    /* CAREFUL: extended status */   }      n = 0;     sprintf(msg[n++], "- rr_t[0]: %lf ", rr_t[0]);		/* Cartesian position vector (x,y,z) [m] */   sprintf(msg[n++], "- rr_t[1]: %lf ", rr_t[1]);   sprintf(msg[n++], "- rr_t[2]: %lf ", rr_t[2]);   sprintf(msg[n++], "- rrd_t[0]: %lf ", rrd_t[0]);		/* Cartesian velocity vector (x,y,z) [m/s] */   sprintf(msg[n++], "- rrd_t[1]: %lf ", rrd_t[1]);   sprintf(msg[n++], "- rrd_t[2]: %lf ", rrd_t[2]);   pl_print_msg(&n, msg);                                                       /* Calculate the Satellite Relative Actual Reference coordinate system *//* ------------------------------------------------------------------- */                                                rr_t[0]  =   4859964.138;		/* Position vector in the Earth fixed coordinate system (x,y,z) [m] */   rr_t[1]  =  -5265612.059;   rr_t[2]  =         0.002;   rrd_t[0] =  -1203.303801;		/* Velocity vector in the Earth fixed coordinate system (x,y,z) [m/s] */   rrd_t[1] =  -1098.845511;   rrd_t[2] =   7377.224410;   rr2d_t[0] =  0.0;		        /* Acceleration vector in the Earth fixed coordinate system (x,y,z) [m/s2] */   rr2d_t[1] =  0.0;   rr2d_t[2] =  0.0;   aocs_t[0] =  -0.1672;		/* Cx AOCS parameter (pitch) [deg] */   aocs_t[1] =   0.0501;		/* Cy ACOS parameter (roll) [deg] */   aocs_t[2] =   3.9284; 		/* Cz ACOS parameter (yaw) [deg] */   misp_t[0] =  0.0;			/* Mispointing angles between SRAR and SRR coordinate systems (x,y,z) [deg] */   misp_t[1] =  0.0;   misp_t[2] =  0.0;                         mispd_t[0] =  0.0;			/* Mispointing rates between SRAR and SRR coordinate systems (x,y,z) [deg/s] */   mispd_t[1] =  0.0;   mispd_t[2] =  0.0;                                                            n = 0;   sprintf(msg[n++], "\n\nPL_SRAR_CS\n");        pl_print_msg(&n, msg);   ext_status = pl_srar_cs(rr_t, rrd_t, rr2d_t, aocs_t, misp_t, mispd_t,                            xs_t, ys_t, zs_t, xsd_t, ysd_t, zsd_t, angout_t, angoutd_t);   if (ext_status != PL_OK)   {        func_id = PL_SRAR_CS_ID;      pl_vector_msg(&func_id, &ext_status, &n, msg);      pl_print_msg(&n, msg);           if (ext_status <= PL_ERR) return(PL_ERR);    /* CAREFUL: extended status */   }      n = 0;     /* Cartesian coordinates of the unitary direction vector of the x-axis of the SRAR coordinate system	 expressed in the Earth fixed coordinate system (x,y,z) */   sprintf(msg[n++], "- xs_t[0]: %lf ", xs_t[0]);   sprintf(msg[n++], "- xs_t[1]: %lf ", xs_t[1]);   sprintf(msg[n++], "- xs_t[2]: %lf ", xs_t[2]);                                            /* Cartesian coordinates of the unitary direction vector of the y-axis of the SRAR coordinate system	 expressed in the Earth fixed coordinate system (x,y,z) */   sprintf(msg[n++], "- ys_t[0]: %lf ", ys_t[0]);   sprintf(msg[n++], "- ys_t[1]: %lf ", ys_t[1]);   sprintf(msg[n++], "- ys_t[2]: %lf ", ys_t[2]);                                            /* Cartesian coordinates of the unitary direction vector of the z-axis of the SRAR coordinate system	 expressed in the Earth fixed coordinate system (x,y,z) */   sprintf(msg[n++], "- zs_t[0]: %lf ", zs_t[0]);   sprintf(msg[n++], "- zs_t[1]: %lf ", zs_t[1]);   sprintf(msg[n++], "- zs_t[2]: %lf ", zs_t[2]);   /* First time derivative of the unitary direction vector of the x-axis of the SRAR coordinate system (x,y,z) [1/s] */   sprintf(msg[n++], "- xsd_t[0]: %lf ", xsd_t[0]);   sprintf(msg[n++], "- xsd_t[1]: %lf ", xsd_t[1]);   sprintf(msg[n++], "- xsd_t[2]: %lf ", xsd_t[2]);                                            /* First time derivative of the unitary direction vector of the y-axis of the SRAR coordinate system (x,y,z) [1/s] */   sprintf(msg[n++], "- ysd_t[0]: %lf ", ysd_t[0]);   sprintf(msg[n++], "- ysd_t[1]: %lf ", ysd_t[1]);   sprintf(msg[n++], "- ysd_t[2]: %lf ", ysd_t[2]);                                            /* First time derivative of the unitary direction vector of the z-axis of the SRAR coordinate system (x,y,z) [1/s] */   sprintf(msg[n++], "- zsd_t[0]: %lf ", zsd_t[0]);   sprintf(msg[n++], "- zsd_t[1]: %lf ", zsd_t[1]);   sprintf(msg[n++], "- zsd_t[2]: %lf ", zsd_t[2]);      /* Mispointing angles between the SRAR and the SR coordinate systems (roll,pitch,yaw) [deg] */         sprintf(msg[n++], "- angout_t[0]: %lf ", angout_t[0]);   sprintf(msg[n++], "- angout_t[1]: %lf ", angout_t[1]);   sprintf(msg[n++], "- angout_t[2]: %lf ", angout_t[2]);   /* Mispointing rates between the SRAR and the SR coordinate systems (roll,pitch,yaw) [deg/s] */         sprintf(msg[n++], "- angoutd_t[0]: %lf ", angoutd_t[0]);   sprintf(msg[n++], "- angoutd_t[1]: %lf ", angoutd_t[1]);   sprintf(msg[n++], "- angoutd_t[2]: %lf ", angoutd_t[2]);   pl_print_msg(&n, msg);/* Calculate the geodesic (minimum) distance between two points that lay on the same ellipsoid *//* ------------------------------------------------------------------------------------------- */   lon1_t    =   4.17;			/* Geocentric longitude of the first point [deg] */   lat1_t    =  10.0;			/* Geodetic latitude of the first point [deg] */   lon2_t    =   4.17;			/* Geocentric longitude of the second point [deg] */   lat2_t    = -20.0;			/* Geodetic latitude of the second point [deg] */   h_t       =   0.0;			/* Geodetic altitude of both points [m] */   n = 0;   sprintf(msg[n++], "\n\nPL_GEO_DISTANCE\n");        pl_print_msg(&n, msg);   ext_status = pl_geo_distance(&lon1_t, &lat1_t, &lon2_t, &lat2_t, &h_t, &d_t, &az1_t, &az2_t);   if (ext_status != PL_OK)   {        func_id = PL_GEO_DISTANCE_ID;      pl_vector_msg(&func_id, &ext_status, &n, msg);      pl_print_msg(&n, msg);           if (ext_status <= PL_ERR) return(PL_ERR);    /* CAREFUL: extended status */   }      n = 0;     sprintf(msg[n++], "- d_t: %lf ", d_t);		/* Geodesic distance [m] */   sprintf(msg[n++], "- az1_t: %lf ", az1_t);	/* Topocentric azimuth of the geodesic line between the two points at point 1 [deg] */

⌨️ 快捷键说明

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