Changeset 6039 for trunk/psLib/src/astro
- Timestamp:
- Jan 18, 2006, 1:49:06 PM (21 years ago)
- Location:
- trunk/psLib/src/astro
- Files:
-
- 4 edited
-
psEarthOrientation.c (modified) (8 diffs)
-
psEarthOrientation.h (modified) (2 diffs)
-
psSphereOps.c (modified) (2 diffs)
-
psSphereOps.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psEarthOrientation.c
r6036 r6039 8 8 * @author Robert Daniel DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-01-18 2 0:59:31$10 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-01-18 23:49:06 $ 12 12 * 13 13 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 470 470 // Convert psTime to MJD 471 471 double MJD = psTimeToMJD(time); 472 if (MJD == NAN) { 473 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 474 "Time conversion to MJD failed. Invalid input time.\n"); 475 return NULL; 476 } 472 477 473 478 // Calculate number of Julian centuries since 2000 … … 630 635 631 636 double MJD = psTimeToMJD(time); 632 633 if (MJD < 41684.0 || MJD > 53334.0) { 634 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 635 "Invalid time input. Date, %lf, is out of range (41684-53334)\n", MJD); 636 return out; 637 } 638 637 if (MJD == NAN) { 638 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 639 "Time conversion to MJD failed. Invalid input time.\n"); 640 return NULL; 641 } 642 /* 643 if (MJD < 41684.0 || MJD > 53334.0) { 644 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 645 "Invalid time input. Date, %lf, is out of range (41684-53334)\n", MJD); 646 return out; 647 } 648 */ 639 649 // Check if EOC data loaded 640 650 if(!eocInitialized) { … … 854 864 } 855 865 double T = psTimeToJD(in); 866 if (T == NAN) { 867 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 868 "Time conversion to JD failed. Invalid input time.\n"); 869 return NULL; 870 } 856 871 T += -2451545.0; 857 872 double theta = 2.0 * M_PI * (0.7790572732640 + 1.00273781191135448 * T); … … 874 889 875 890 double MJD = psTimeToMJD(time); 876 /* 877 if (MJD < 41684.0 || (MJD > 53434.0 && bulletin == PS_IERS_B) || 878 (MJD > 53858.0 && bulletin == PS_IERS_A) ) { 879 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 880 "Invalid time input. Date, %lf, is out of range\n", MJD); 881 return out; 882 } 883 */ 891 if (MJD == NAN) { 892 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 893 "Time conversion to MJD failed. Invalid input time.\n"); 894 return NULL; 895 } 896 884 897 // Check if EOC data loaded 885 898 if(! eocInitialized) { … … 1007 1020 // Convert psTime to MJD 1008 1021 double MJD = psTimeToMJD(time); 1022 if (MJD == NAN) { 1023 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 1024 "Time conversion to MJD failed. Invalid input time.\n"); 1025 return NULL; 1026 } 1009 1027 1010 1028 // Calculate number of Julian centuries since 2000 … … 1086 1104 // Check for null parameter 1087 1105 PS_ASSERT_PTR_NON_NULL(time, NULL); 1088 if (time->type == PS_TIME_UT1) {1089 psError(PS_ERR_BAD_PARAMETER_VALUE, true,1090 "Invalid time input. Time cannot be of type UT1.\n");1091 return NULL;1092 }1093 1106 /* if (time->type == PS_TIME_UT1) { 1107 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 1108 "Invalid time input. Time cannot be of type UT1.\n"); 1109 return NULL; 1110 } 1111 */ 1094 1112 // Convert psTime to MJD 1095 1113 double MJD = psTimeToMJD(time); 1114 if (MJD == NAN) { 1115 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 1116 "Time conversion to MJD failed. Invalid input time.\n"); 1117 return NULL; 1118 } 1096 1119 1097 1120 // Calculate number of Julian centuries since 2000 … … 1438 1461 return out; 1439 1462 } 1463 1464 /****************************************************************************** 1465 psSpherePrecess(coords, fromTime, toTime): 1466 1467 XXX: Use static memory for tmpST. 1468 *****************************************************************************/ 1469 psSphere *psSpherePrecess(psSphere *coords, 1470 const psTime *fromTime, 1471 const psTime *toTime) 1472 { 1473 // Check input for NULL pointers 1474 PS_ASSERT_PTR_NON_NULL(coords, NULL); 1475 PS_ASSERT_PTR_NON_NULL(fromTime, NULL); 1476 PS_ASSERT_PTR_NON_NULL(toTime, NULL); 1477 1478 // Calculate Julian centuries 1479 psF64 fromMJD = psTimeToMJD(fromTime); 1480 psF64 toMJD = psTimeToMJD(toTime); 1481 psF64 T = (toMJD - fromMJD) / JULIAN_CENTURY; 1482 1483 // Calculate conversion constants 1484 // psF64 alphaP = DEG_TO_RAD(90.0) - ((DEG_TO_RAD(0.6406161) * T) + 1485 psF64 alphaP = DEG_TO_RAD(180.0) + ((DEG_TO_RAD(0.6406161) * T) + 1486 (DEG_TO_RAD(0.0000839) * T * T) + 1487 (DEG_TO_RAD(0.000005) * T * T * T)); 1488 1489 psF64 deltaP = (DEG_TO_RAD(0.5567530) * T) - 1490 (DEG_TO_RAD(0.0001185) * T * T) - 1491 (DEG_TO_RAD(0.0000116) * T * T * T); 1492 1493 // psF64 phiP = DEG_TO_RAD(90.0) + ((DEG_TO_RAD(0.6406161) * T) + 1494 psF64 phiP = DEG_TO_RAD(180.0) + ((DEG_TO_RAD(0.6406161) * T) + 1495 (DEG_TO_RAD(0.0003041) * T * T) + 1496 (DEG_TO_RAD(0.0000051) * T * T * T)); 1497 1498 // Create transform with proper constants 1499 psSphereRot* tmpST = psSphereRotAlloc(alphaP, deltaP, phiP); 1500 1501 // Apply transform to coordinates 1502 psSphere *out = psSphereRotApply(NULL, tmpST, coords); 1503 if (out->r < -0.0001) { 1504 out->r += 2.0 * M_PI; 1505 } 1506 1507 psFree(tmpST); 1508 1509 return(out); 1510 } -
trunk/psLib/src/astro/psEarthOrientation.h
r6030 r6039 9 9 * @author Robert Daniel DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-01-18 00:41:29$11 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-01-18 23:49:06 $ 13 13 * 14 14 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 176 176 ); 177 177 178 /** Generates the complete spherical rotation to account for precession 179 * between two times. The equinoxes shall be Julian equinoxes. 180 * 181 * @return psSphere* the resulting spherical rotation 182 */ 183 psSphere* psSpherePrecess( 184 psSphere *coords, ///< coordinates (modified in-place) 185 const psTime *fromTime, ///< equinox of coords input 186 const psTime *toTime ///< equinox of coords output 187 ); 188 189 178 190 #endif // #ifndef PS_EARTH_ORIENTATION -
trunk/psLib/src/astro/psSphereOps.c
r5493 r6039 8 8 * @author Dave Robbins, MHPCC 9 9 * 10 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $11 * @date $Date: 200 5-11-10 00:13:50$10 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-01-18 23:49:06 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 536 536 } 537 537 538 /****************************************************************************** 539 psSpherePrecess(coords, fromTime, toTime): 540 541 XXX: Use static memory for tmpST. 542 *****************************************************************************/ 543 psSphere *psSpherePrecess(psSphere *coords, 544 const psTime *fromTime, 545 const psTime *toTime) 546 { 547 // Check input for NULL pointers 548 PS_ASSERT_PTR_NON_NULL(coords, NULL); 549 PS_ASSERT_PTR_NON_NULL(fromTime, NULL); 550 PS_ASSERT_PTR_NON_NULL(toTime, NULL); 551 552 // Calculate Julian centuries 553 psF64 fromMJD = psTimeToMJD(fromTime); 554 psF64 toMJD = psTimeToMJD(toTime); 555 psF64 T = (toMJD - fromMJD) / JULIAN_CENTURY; 556 557 // Calculate conversion constants 558 // psF64 alphaP = DEG_TO_RAD(90.0) - ((DEG_TO_RAD(0.6406161) * T) + 559 psF64 alphaP = DEG_TO_RAD(180.0) + ((DEG_TO_RAD(0.6406161) * T) + 560 (DEG_TO_RAD(0.0000839) * T * T) + 561 (DEG_TO_RAD(0.000005) * T * T * T)); 562 563 psF64 deltaP = (DEG_TO_RAD(0.5567530) * T) - 564 (DEG_TO_RAD(0.0001185) * T * T) - 565 (DEG_TO_RAD(0.0000116) * T * T * T); 566 567 // psF64 phiP = DEG_TO_RAD(90.0) + ((DEG_TO_RAD(0.6406161) * T) + 568 psF64 phiP = DEG_TO_RAD(180.0) + ((DEG_TO_RAD(0.6406161) * T) + 569 (DEG_TO_RAD(0.0003041) * T * T) + 570 (DEG_TO_RAD(0.0000051) * T * T * T)); 571 572 // Create transform with proper constants 573 psSphereRot* tmpST = psSphereRotAlloc(alphaP, deltaP, phiP); 574 575 // Apply transform to coordinates 576 psSphere *out = psSphereRotApply(NULL, tmpST, coords); 577 if (out->r < -0.0001) { 578 out->r += 2.0 * M_PI; 579 } 580 581 psFree(tmpST); 582 583 return(out); 584 } 585 538 -
trunk/psLib/src/astro/psSphereOps.h
r5483 r6039 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $10 * @date $Date: 200 5-11-07 20:52:43$9 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-01-18 23:49:06 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 215 215 psSphereRot* psSphereRotGalacticToICRS(void); 216 216 217 /** Generates the complete spherical rotation to account for precession218 * between two times. The equinoxes shall be Julian equinoxes.219 *220 * @return psSphere* the resulting spherical rotation221 */222 psSphere* psSpherePrecess(223 psSphere *coords, ///< coordinates (modified in-place)224 const psTime *fromTime, ///< equinox of coords input225 const psTime *toTime ///< equinox of coords output226 );227 228 217 /// @} 229 218
Note:
See TracChangeset
for help on using the changeset viewer.
