IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 18, 2006, 1:49:06 PM (21 years ago)
Author:
drobbin
Message:

chgd psMetadataType's to psDataType's. Moved SpherePrecess to EOC. checked in verified tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psEarthOrientation.c

    r6036 r6039  
    88 *  @author Robert Daniel DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-01-18 20:59:31 $
     10 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-01-18 23:49:06 $
    1212 *
    1313 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
     
    470470    // Convert psTime to MJD
    471471    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    }
    472477
    473478    // Calculate number of Julian centuries since 2000
     
    630635
    631636    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    */
    639649    // Check if EOC data loaded
    640650    if(!eocInitialized) {
     
    854864    }
    855865    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    }
    856871    T += -2451545.0;
    857872    double theta = 2.0 * M_PI * (0.7790572732640 + 1.00273781191135448 * T);
     
    874889
    875890    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
    884897    // Check if EOC data loaded
    885898    if(! eocInitialized) {
     
    10071020    // Convert psTime to MJD
    10081021    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    }
    10091027
    10101028    // Calculate number of Julian centuries since 2000
     
    10861104    // Check for null parameter
    10871105    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    */
    10941112    // Convert psTime to MJD
    10951113    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    }
    10961119
    10971120    // Calculate number of Julian centuries since 2000
     
    14381461    return out;
    14391462}
     1463
     1464/******************************************************************************
     1465psSpherePrecess(coords, fromTime, toTime):
     1466 
     1467XXX: Use static memory for tmpST.
     1468 *****************************************************************************/
     1469psSphere *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.