IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5015


Ignore:
Timestamp:
Sep 12, 2005, 3:09:58 PM (21 years ago)
Author:
desonia
Message:

* empty log message *

Location:
trunk/psLib/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/Makefile.am

    r4981 r5015  
    11#Makefile for astronomy functions of psLib
    22#
    3 AM_CFLAGS=$(CFLAGS) -DPS_CONFIG_FILE_DEFAULT=\"$(sysconfdir)/pslib/psTime.config\"
     3AM_CFLAGS=$(CFLAGS) -DPS_CONFIG_FILE_DEFAULT=\"$(sysconfdir)/pslib/pslib.config\"
    44
    55noinst_LTLIBRARIES = libpslibastro.la
  • trunk/psLib/src/astro/psTime.c

    r4944 r5015  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-09-02 21:32:03 $
     12 *  @version $Revision: 1.70 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-09-13 01:09:58 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8888static char *cleanString(char *inString, int sLen);
    8989static char* getToken(char **inString, char *delimiter, psParseErrorType *status);
    90 static psF64 searchTables(psF64 index, psU64 column, char *metadataTableNames[],
    91                           psU32 nTables, psLookupStatusType* status);
    9290static psTime* convertTimeTAIUTC(psTime* time);
    9391static psTime* convertTimeUTCTAI(psTime* time);
     
    156154}
    157155
    158 // get the psTime.config filename by checking environment variable first, then original installation area.
     156// get the pslib.config filename by checking environment variable first, then original installation area.
    159157char* p_psGetConfigFileName()
    160158{
     
    171169// Searches time tables in priority order and performs interpolation if input index value is within a table.
    172170// If the index value is out of range, the status is set accordingly.
    173 static psF64 searchTables(psF64 index, psU64 column, char *metadataTableNames[],
    174                           psU32 nTables, psLookupStatusType* status)
     171psF64 p_psTimeSearchTables(psF64 index, psU64 column, char *metadataTableNames[],
     172                           psU32 nTables, psLookupStatusType* status)
    175173{
    176174    char*            tableName          = NULL;
     
    179177    psMetadataItem*  tableMetadataItem  = NULL;
    180178
    181     // Check time metadata. Function call reports errors.
    182     if(timeMetadata == NULL) {
    183         if(!p_psTimeInit(p_psGetConfigFileName()))
    184             *status = PS_LOOKUP_ERROR;
     179    // Check if psTime tables are already loaded
     180    if(!p_psTimeInit(p_psGetConfigFileName())) {
     181        *status = PS_LOOKUP_ERROR;
    185182        return NAN;
    186183    }
     
    254251    char metadataTableNames[4][MAX_STRING_LENGTH] = {"daily", "eopc",  "finals", "tai"};
    255252
    256     // Read time config file
     253    // Check if the p_psTimeInit has already been ran
     254    if (timeMetadata != NULL) {
     255        return true;
     256    }
     257
     258    // Read config file
    257259    timeMetadata = psMetadataConfigParse(timeMetadata, &nFail, fileName, true);
    258260    if(timeMetadata == NULL) {
     
    847849    // Attempt to find value through table lookup and interpolation
    848850    mjd = psTimeToMJD(time);
    849     result = searchTables(mjd,tableColumn,metadataTableNames,nTables,&status);
     851    result = p_psTimeSearchTables(mjd,tableColumn,metadataTableNames,nTables,&status);
    850852
    851853    // Value could not be found through table lookup and interpolation
     
    855857        psLogMsg(__func__,PS_LOG_WARN,PS_ERRORTEXT_psTime_TIME_PREDATES_TABLES,mjd,"UT1-UTC");
    856858
    857         // Lookup value from time metadata loaded from psTime.config
     859        // Lookup value from time metadata loaded from pslib.config
    858860        tableMetadataItem = psMetadataLookup(timeMetadata, "psLib.time.before.dut");
    859861        if(tableMetadataItem == NULL) {
     
    926928    // Attempt to find value through table lookup and interpolation
    927929    mjd = psTimeToMJD(time);
    928     //    x = searchTables(mjd, 0, &xStatus, metadataTableNames, nTables);
    929     x = searchTables(mjd, 0, metadataTableNames, nTables,&xStatus);
    930     //    y = searchTables(mjd, 0, &yStatus, metadataTableNames, nTables);
    931     y = searchTables(mjd, 0, metadataTableNames, nTables,&yStatus);
     930    //    x = p_psTimeSearchTables(mjd, 0, &xStatus, metadataTableNames, nTables);
     931    x = p_psTimeSearchTables(mjd, 0, metadataTableNames, nTables,&xStatus);
     932    //    y = p_psTimeSearchTables(mjd, 0, &yStatus, metadataTableNames, nTables);
     933    y = p_psTimeSearchTables(mjd, 0, metadataTableNames, nTables,&yStatus);
    932934
    933935    // Value could not be found through table lookup and interpolation
     
    10371039    PS_ASSERT_INT_WITHIN_RANGE(time->nsec,0,(psU32)((1e9)-1),NAN);
    10381040
    1039     // Check time metadata
    1040     if(timeMetadata == NULL) {
    1041         if(!p_psTimeInit(p_psGetConfigFileName())) {
    1042             psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_FILE_NOT_FOUND, "psTime.config");
    1043             return 0.0;
    1044         }
     1041    // Check if psTime tables are loaded/loadable
     1042    if(!p_psTimeInit(p_psGetConfigFileName())) {
     1043        psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_FILE_NOT_FOUND,
     1044                p_psGetConfigFileName());
     1045        return 0.0;
    10451046    }
    10461047
  • trunk/psLib/src/astro/psTime.h

    r4944 r5015  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-09-02 21:32:03 $
     13 *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-09-13 01:09:58 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "psType.h"
    2727#include "psImage.h"
     28#include "psLookupTable.h"
    2829#include "psCoord.h"
    2930
     
    360361char* p_psGetConfigFileName();
    361362
     363psF64 p_psTimeSearchTables(
     364    psF64 index,
     365    psU64 column,
     366    char *metadataTableNames[],
     367    psU32 nTables,
     368    psLookupStatusType* status
     369);
     370
    362371/// @}
    363372
  • trunk/psLib/src/sys/psString.h

    r4434 r5015  
    1313 *  @author Eric Van Alst, MHPCC
    1414 *
    15  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2005-06-30 00:33:36 $
     15 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2005-09-13 01:09:58 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6464psString psStringNCopy(
    6565    const char *string,                ///< Input string of characters to copy
    66     unsigned int nChar                          ///< Number of bytes to allocate for string copy
     66    unsigned int nChar                 ///< Number of bytes to allocate for string copy
    6767);
    6868
Note: See TracChangeset for help on using the changeset viewer.