IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 14, 2006, 11:15:43 AM (20 years ago)
Author:
drobbin
Message:

Implemented testing for psEarthOrientation. Done with motion, working on corrections. Edited data file dir in Makefile.am and changed a couple of, if (MJD==NAN) to if (isnan(MJD))

File:
1 edited

Legend:

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

    r9665 r9976  
    88 *  @author Robert Daniel DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-10-20 00:17:21 $
     10 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-11-14 21:15:43 $
    1212 *
    1313 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
     
    284284        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    285285                "Aberration speed should not be equal to 0.\n");
     286        return NULL;
     287    }
     288    if (fabs(speed) > 1.0) {
     289        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     290                "Aberration speed should not greater than the speed of light!.\n");
    286291        return NULL;
    287292    }
     
    445450    // Convert psTime to MJD
    446451    double MJD = psTimeToMJD(time);
    447     if (MJD == NAN) {
     452    if (isnan(MJD)) {
    448453        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    449454                "Time conversion to MJD failed.  Invalid input time.\n");
     
    594599    //Convert the input time to MJD.  If NAN is returned, return NULL for the function.
    595600    double MJD = psTimeToMJD(time);
    596     if (MJD == NAN) {
     601    if (isnan(MJD)) {
    597602        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    598603                "Time conversion to MJD failed.  Invalid input time.\n");
     
    762767    //Check if tidal corrections should be included.
    763768    //If so, make sure values are positive and in the correct range.
    764     if (tidalCorr != NULL && tidalCorr->s != 0.0) {
     769    if (tidalCorr != NULL && fabs(tidalCorr->s) > FLT_EPSILON) {
    765770        int nsec = in->nsec + (int)(tidalCorr->s * 1e9);
    766771        if (nsec > 1e9) {
     
    777782    //Calculate the Julian Date from the input time in UT1 format.
    778783    double T = psTimeToJD(in);
    779     if (T == NAN) {
     784    if (isnan(T)) {
    780785        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    781786                "Time conversion to JD failed.  Invalid input time.\n");
     
    803808
    804809    double MJD = psTimeToMJD(time);
    805     if (MJD == NAN) {
     810    if ( isnan(MJD) ) {
    806811        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    807812                "Time conversion to MJD failed.  Invalid input time.\n");
     
    858863                k = 2;
    859864            }
    860             if (k > (numRows-2)) {
    861                 k = numRows-2;
    862             }
     865            //            if (k > (numRows-2)) {
     866            //                k = numRows-2;
     867            //            }
    863868            for (int m = k-1; m <= k+2; m++) {
    864869                xTerm = X->data.F64[m];
     
    935940    // Convert psTime to MJD
    936941    double MJD = psTimeToMJD(time);
    937     if (MJD == NAN) {
     942    if (isnan(MJD)) {
    938943        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    939944                "Time conversion to MJD failed.  Invalid input time.\n");
     
    10191024    double MJD = psTimeToMJD(time);
    10201025    //    printf("\nMJD check = %.13g\n", MJD);
    1021     if (MJD == NAN) {
     1026    if (isnan(MJD)) {
    10221027        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    10231028                "Time conversion to MJD failed.  Invalid input time.\n");
     
    12521257    // Calculate Julian centuries
    12531258    //If either input time is NULL, assume it to be J2000 -> from SDRS as of rev 18
     1259    psTime *from = NULL;
     1260    psTime *to = NULL;
    12541261    if (fromTime == NULL) {
    12551262        fromMJD = MJD_2000;
     1263        from = psTimeFromMJD(fromMJD);
    12561264    } else {
    12571265        fromMJD = psTimeToMJD(fromTime);
     1266        from = psTimeCopy(fromTime);
    12581267    }
    12591268    if (toTime == NULL) {
    12601269        toMJD = MJD_2000;
     1270        to = psTimeFromMJD(toMJD);
    12611271    } else {
    12621272        toMJD = psTimeToMJD(toTime);
    1263     }
    1264     psTime *from = NULL;
    1265     psTime *to = NULL;
     1273        to = psTimeCopy(toTime);
     1274    }
    12661275    if (fromMJD > toMJD) {
    12671276        psWarning("From time is later than to time in psSpherePrecess.\n");
     
    12901299        // Create transform with proper constants
    12911300        psSphereRot* tmpST = psSphereRotAlloc(alphaP, deltaP, phiP);
     1301        psFree(from);
     1302        psFree(to);
    12921303        return tmpST;
    12931304    } else if (mode == PS_PRECESS_IAU2000A) {
     
    12961307        //rotation corresponding to fromTime to the toTime rotation.
    12971308
    1298         //Since the time inputs are allowed to be NULL, either convert the MJD time
    1299         //or copy to non-NULL time
    1300         if (fromTime == NULL) {
    1301             from = psTimeFromMJD(fromMJD);
    1302         } else {
    1303             from = psTimeCopy(fromTime);
    1304         }
    1305         if (toTime == NULL) {
    1306             to = psTimeFromMJD(toMJD);
    1307         } else {
    1308             to = psTimeCopy(toTime);
    1309         }
    13101309        //Calculate the earthpoles and quaternions corresponding to each time (from, to).
    13111310        //Combine the quaternions to produce the output psSphereRot.
     
    13291328        //for COMPLETE_A come from the IERS Bulletin A.
    13301329
    1331         //Since the time inputs are allowed to be NULL, either convert the MJD time
    1332         //or copy to non-NULL time
    1333         if (fromTime == NULL) {
    1334             from = psTimeFromMJD(fromMJD);
    1335         } else {
    1336             from = psTimeCopy(fromTime);
    1337         }
    1338         if (toTime == NULL) {
    1339             to = psTimeFromMJD(toMJD);
    1340         } else {
    1341             to = psTimeCopy(toTime);
    1342         }
    13431330        //Calculate the earthpoles and quaternions corresponding to each time (from, to).
    13441331        //Add in the precession corrections from IERS bulletin A.
     
    13711358        //for COMPLETE_B come from the IERS Bulletin B.
    13721359
    1373         //Since the time inputs are allowed to be NULL, either convert the MJD time
    1374         //or copy to non-NULL time
    1375         if (fromTime == NULL) {
    1376             from = psTimeFromMJD(fromMJD);
    1377         } else {
    1378             from = psTimeCopy(fromTime);
    1379         }
    1380         if (toTime == NULL) {
    1381             to = psTimeFromMJD(toMJD);
    1382         } else {
    1383             to = psTimeCopy(toTime);
    1384         }
    1385 
    13861360        //Calculate the earthpoles and quaternions corresponding to each time (from, to).
    13871361        //Add in the precession corrections from IERS bulletin B.
Note: See TracChangeset for help on using the changeset viewer.