IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3332


Ignore:
Timestamp:
Feb 25, 2005, 10:52:28 AM (21 years ago)
Author:
evanalst
Message:

Update psSphereTransformEclipticToICRS.

Location:
trunk/psLib/src
Files:
2 edited

Legend:

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

    r3325 r3332  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-02-25 02:49:00 $
     12*  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-02-25 20:52:28 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8484}
    8585
    86 // XXX: Must test psSphereAlloc() and sphereFree().
    87 // XXX: Must rewrite code and tests to use these functions.
    8886psSphere* psSphereAlloc(void)
    8987{
     
    352350psSphereTransform* psSphereTransformEclipticToICRS(psTime *time)
    353351{
     352    psF64 T;
     353
     354    // Check for null parameter
    354355    PS_PTR_CHECK_NULL(time, NULL);
     356
     357    // Convert psTime to MJD
    355358    psF64 MJD = psTimeToMJD(time);
    356     struct tm *tmTime = psTimeToTM(time);
    357     psF64 year = (psF64)(1900 - MJD + tmTime->tm_year);
    358     psF64 T = year / 100.0;
     359
     360    // Check the specified MJD is greater than 1900
     361    if ( MJD < MJD_1900 ) {
     362        psError(PS_ERR_BAD_PARAMETER_TYPE,true,PS_ERRORTEXT_psCoord_INVALID_MJD);
     363        return NULL;
     364    }
     365
     366    // Calculate number of Julian centuries since 1900
     367    T = ( MJD - MJD_1900 ) / JULIAN_CENTURY;
     368
    359369    psF64 alphaP = 0.0;
    360370    psF64 deltaP = DEG_TO_RAD(23.0) +
    361                    SEC_TO_RAD(27.0) +
    362                    MIN_TO_RAD(8.0) -
     371                   MIN_TO_RAD(27.0) +
     372                   SEC_TO_RAD(8.26) -
    363373                   (SEC_TO_RAD(46.845) * T) -
    364374                   (SEC_TO_RAD(0.0059) * T * T) +
     
    366376    psF64 phiP = 0.0;
    367377
    368     psFree(tmTime);
    369378    return (psSphereTransformAlloc(alphaP, deltaP, phiP));
    370379}
  • trunk/psLib/src/astronomy/psCoord.c

    r3325 r3332  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-02-25 02:49:00 $
     12*  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-02-25 20:52:28 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8484}
    8585
    86 // XXX: Must test psSphereAlloc() and sphereFree().
    87 // XXX: Must rewrite code and tests to use these functions.
    8886psSphere* psSphereAlloc(void)
    8987{
     
    352350psSphereTransform* psSphereTransformEclipticToICRS(psTime *time)
    353351{
     352    psF64 T;
     353
     354    // Check for null parameter
    354355    PS_PTR_CHECK_NULL(time, NULL);
     356
     357    // Convert psTime to MJD
    355358    psF64 MJD = psTimeToMJD(time);
    356     struct tm *tmTime = psTimeToTM(time);
    357     psF64 year = (psF64)(1900 - MJD + tmTime->tm_year);
    358     psF64 T = year / 100.0;
     359
     360    // Check the specified MJD is greater than 1900
     361    if ( MJD < MJD_1900 ) {
     362        psError(PS_ERR_BAD_PARAMETER_TYPE,true,PS_ERRORTEXT_psCoord_INVALID_MJD);
     363        return NULL;
     364    }
     365
     366    // Calculate number of Julian centuries since 1900
     367    T = ( MJD - MJD_1900 ) / JULIAN_CENTURY;
     368
    359369    psF64 alphaP = 0.0;
    360370    psF64 deltaP = DEG_TO_RAD(23.0) +
    361                    SEC_TO_RAD(27.0) +
    362                    MIN_TO_RAD(8.0) -
     371                   MIN_TO_RAD(27.0) +
     372                   SEC_TO_RAD(8.26) -
    363373                   (SEC_TO_RAD(46.845) * T) -
    364374                   (SEC_TO_RAD(0.0059) * T * T) +
     
    366376    psF64 phiP = 0.0;
    367377
    368     psFree(tmTime);
    369378    return (psSphereTransformAlloc(alphaP, deltaP, phiP));
    370379}
Note: See TracChangeset for help on using the changeset viewer.