Changeset 6039 for trunk/psLib/src/astro/psEarthOrientation.c
- Timestamp:
- Jan 18, 2006, 1:49:06 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psEarthOrientation.c (modified) (8 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 }
Note:
See TracChangeset
for help on using the changeset viewer.
