IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 9, 2005, 2:13:51 PM (21 years ago)
Author:
drobbin
Message:

Implemented functions PolarTideCorr, SphereRot CEOtoGCRS & ITRStoTEO (& tests) - still need verification!

File:
1 edited

Legend:

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

    r5483 r5493  
    55*  @author d-Rob, MHPCC
    66*
    7 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    8 *  @date $Date: 2005-11-07 20:52:43 $
     7*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     8*  @date $Date: 2005-11-10 00:13:51 $
    99*
    1010*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6969    //    direction->r = 0.2035;
    7070    //    direction->d = 0.2035;
    71     direction->r = DEG_TO_RAD(48.0);
     71    //    direction->r = DEG_TO_RAD(48.0);
     72    direction->r = DEG_TO_RAD(-157.0);
    7273    direction->d = DEG_TO_RAD(20.7072);
    7374
     
    108109    sun->r = 0.2;
    109110    sun->d = 0.2;
    110     actual->r = 0.2035;
    111     actual->d = 0.2035;
     111    actual->r = 0.61001;
     112    actual->d = 0.01999;
    112113
    113114    empty = psGravityDeflection(apparent, empty, sun);
     
    126127    apparent = psGravityDeflection(apparent, actual, sun);
    127128    psSphere *result = psSphereSetOffset(actual, apparent, PS_SPHERICAL, PS_RADIAN);
    128     printf("\nActual r,d = %.13g,%.13g    Apparent r,d = %.13g, %.13g \n",
     129    printf("\nActual r,d = %.13g,%.13g    Apparent r,d = %.16g, %.16g \n",
    129130           actual->r, actual->d, result->r, result->d);
    130131    psFree(result);
     
    144145psS32 testEOCPolar(void)
    145146{
    146 
     147    //    psTime *in = psTimeGetNow(PS_TIME_TAI);
     148    psTime *in = psTimeAlloc(PS_TIME_TAI);
     149    in->sec = 1131579114;
     150    in->nsec = 498489000;
     151    in->leapsecond = false;
     152    psTime *empty = NULL;
     153    psEarthPole *eop = NULL;
     154
     155    eop = psEOC_PolarTideCorr(empty);
     156    if (eop != NULL) {
     157        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     158                "psEOC_PolarTideCorr failed to return NULL for NULL input time.\n");
     159        return 1;
     160    }
     161
     162    eop = psEOC_PolarTideCorr(in);
     163    if (eop == NULL) {
     164        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     165                "psEOC_PolarTideCorr returned NULL for valid input time.\n");
     166        return 2;
     167    }
     168
     169    printf(" -- Eop = x=%.8g, y=%.8g, s=%.8g\n", eop->x, eop->y, eop->s);
     170    psFree(in);
     171    psFree(eop);
    147172    return 0;
    148173}
     
    170195psS32 testSphereRot_CEOtoGCRS(void)
    171196{
     197    psEarthPole *in = psEarthPoleAlloc();
     198    psEarthPole *empty = NULL;
     199    psSphereRot *rot = NULL;
     200
     201    in->x = M_PI / 4.0;
     202    in->y = M_PI / 6.0;
     203    in->s = M_PI / 8.0;
     204
     205    rot = psSphereRot_CEOtoGCRS(empty);
     206    if (rot != NULL) {
     207        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     208                "psSphereRot_CEOtoGCRS failed to return NULL for NULL input psEarthPole.\n");
     209        return 1;
     210    }
     211
     212    rot = psSphereRot_CEOtoGCRS(in);
     213    if (rot == NULL) {
     214        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     215                "psSphereRot_CEOtoGCRS return NULL for valid psEarthPole input.\n");
     216        return 2;
     217    }
     218
     219    psSphere *test = psSphereAlloc();
     220    test->r = 0.0;
     221    test->d = 0.0;
     222    test = psSphereRotApply(test, rot, test);
     223    printf("\n  Sphere -test- has values r,d = %.8g, %.8g \n", test->r, test->d);
     224
     225    psFree(test);
     226    psFree(rot);
     227    psFree(in);
    172228    return 0;
    173229}
     
    175231psS32 testSphereRot_ITRStoTEO(void)
    176232{
    177     return 0;
    178 }
    179 
     233    psEarthPole *in = psEarthPoleAlloc();
     234    psEarthPole *empty = NULL;
     235    psSphereRot *rot = NULL;
     236
     237    in->x = M_PI / 4.0;
     238    in->y = M_PI / 6.0;
     239    in->s = M_PI / 8.0;
     240
     241    rot = psSphereRot_ITRStoTEO(empty);
     242    if (rot != NULL) {
     243        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     244                "psSphereRot_ITRStoTEO failed to return NULL for NULL input psEarthPole.\n");
     245        return 1;
     246    }
     247
     248    rot = psSphereRot_ITRStoTEO(in);
     249    if (rot == NULL) {
     250        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     251                "psSphereRot_ITRStoTEO return NULL for valid psEarthPole input.\n");
     252        return 2;
     253    }
     254
     255    psSphere *test = psSphereAlloc();
     256    test->r = 0.0;
     257    test->d = 0.0;
     258    test = psSphereRotApply(test, rot, test);
     259    printf("\n  Sphere -test- has values r,d = %.8g, %.8g \n", test->r, test->d);
     260
     261    psFree(test);
     262    psFree(rot);
     263    psFree(in);
     264    return 0;
     265}
     266
Note: See TracChangeset for help on using the changeset viewer.