IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 11, 2005, 5:37:34 PM (21 years ago)
Author:
drobbin
Message:

Implemented PrecessionCorr function. Not verified, very possibly wrong.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astro/tst_psEarthOrientation.c

    r5493 r5507  
    55*  @author d-Rob, MHPCC
    66*
    7 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    8 *  @date $Date: 2005-11-10 00:13:51 $
     7*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     8*  @date $Date: 2005-11-12 03:37:34 $
    99*
    1010*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    139139psS32 testEOCPrecession(void)
    140140{
    141 
     141    psTime *empty = NULL;
     142    psTime *time = psTimeAlloc(PS_TIME_TAI);
     143    time->sec = 1131579114;
     144    time->nsec = 498489000;
     145    time->leapsecond = false;
     146
     147
     148    //Tests for Precession Correction function//
     149    //Return NULL for NULL time input
     150    psEarthPole *pcorr = NULL;
     151    pcorr = psEOC_PrecessionCorr(empty, PS_IERS_A);
     152    if (pcorr != NULL) {
     153        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     154                "psEOC_PrecessionCorr failed to return NULL for NULL time input.\n");
     155        return 4;
     156    }
     157
     158    //Return NULL for Invalid IERS table
     159    pcorr = psEOC_PrecessionCorr(time, 3);
     160    if (pcorr != NULL) {
     161        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     162                "psEOC_PrecessionCorr failed to return NULL for incorrect IERS table.\n");
     163        return 5;
     164    }
     165    psFree(pcorr);
     166
     167    //Check values from IERS table A
     168    pcorr = psEOC_PrecessionCorr(time, PS_IERS_A);
     169    if ( pcorr == NULL ) {
     170        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     171                "psEOC_PrecessionCorr returned NULL for valid inputs.\n");
     172        return 6;
     173    } else {
     174        printf("Precession Correction output (IERSA) = x,y,s = %.8g, %.8g, %.8g\n",
     175               pcorr->x, pcorr->y, pcorr->s);
     176    }
     177    psFree(pcorr);
     178
     179    //Check values from IERS table B
     180    pcorr = psEOC_PrecessionCorr(time, PS_IERS_B);
     181    if ( pcorr == NULL ) {
     182        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     183                "psEOC_PrecessionCorr returned NULL for valid inputs.\n");
     184        return 7;
     185    } else {
     186        printf("Precession Correction output (IERSB) = x,y,s = %.8g, %.8g, %.8g\n",
     187               pcorr->x, pcorr->y, pcorr->s);
     188    }
     189    psFree(pcorr);
     190
     191    psFree(time);
    142192    return 0;
    143193}
     
    167217    }
    168218
     219    psEarthPole *polarMotion = NULL;
     220    polarMotion = psEOC_GetPolarMotion(empty, PS_IERS_B);
     221    if (polarMotion != NULL) {
     222        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     223                "psEOC_GetPolarMotion failed to return NULL for NULL input time.\n");
     224        return 3;
     225    }
     226    polarMotion = psEOC_GetPolarMotion(in, PS_IERS_B);
     227    if (polarMotion == NULL) {
     228        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     229                "psEOC_GetPolarMotion returned NULL for valid input time.\n");
     230        return 4;
     231    }
     232
     233    psSphere *interm = p_psTimeGetPoleCoords(in);
     234    printf(" -- sphere = r=%.8g, d=%.8g\n", interm->r, interm->d);
    169235    printf(" -- Eop = x=%.8g, y=%.8g, s=%.8g\n", eop->x, eop->y, eop->s);
     236    printf(" -- PolarMotion = x=%.8g, y=%.8g, s=%.8g\n", polarMotion->x,
     237           polarMotion->y, polarMotion->s);
    170238    psFree(in);
    171239    psFree(eop);
     240    psFree(polarMotion);
     241    psFree(interm);
    172242    return 0;
    173243}
Note: See TracChangeset for help on using the changeset viewer.