gsfc.nssdc.cdf.util
Class CDFTT2000

java.lang.Object
  extended by gsfc.nssdc.cdf.util.CDFTT2000
All Implemented Interfaces:
CDFConstants

public class CDFTT2000
extends java.lang.Object
implements CDFConstants

This class contains the handy utility routines (methods) called by the CDF applications to handle epoch data of CDF's CDF_TIME_TT2000 data type.

Version:
1.0

Field Summary
 
Fields inherited from interface gsfc.nssdc.cdf.CDFConstants
AHUFF_COMPRESSION, ALPHAOSF1_DECODING, ALPHAOSF1_ENCODING, ALPHAVMSd_DECODING, ALPHAVMSd_ENCODING, ALPHAVMSg_DECODING, ALPHAVMSg_ENCODING, ALPHAVMSi_DECODING, ALPHAVMSi_ENCODING, ATTR_, ATTR_EXISTENCE_, ATTR_EXISTS, ATTR_MAXgENTRY_, ATTR_MAXrENTRY_, ATTR_MAXzENTRY_, ATTR_NAME_, ATTR_NAME_TRUNC, ATTR_NUMBER_, ATTR_NUMgENTRIES_, ATTR_NUMrENTRIES_, ATTR_NUMzENTRIES_, ATTR_SCOPE_, BACKWARD_, BACKWARDFILEoff, BACKWARDFILEon, BAD_ALLOCATE_RECS, BAD_ARGUMENT, BAD_ATTR_NAME, BAD_ATTR_NUM, BAD_BLOCKING_FACTOR, BAD_CACHE_SIZE, BAD_CDF_EXTENSION, BAD_CDF_ID, BAD_CDF_NAME, BAD_CDFSTATUS, BAD_CHECKSUM, BAD_COMPRESSION_PARM, BAD_DATA_TYPE, BAD_DECODING, BAD_DIM_COUNT, BAD_DIM_INDEX, BAD_DIM_INTERVAL, BAD_DIM_SIZE, BAD_ENCODING, BAD_ENTRY_NUM, BAD_FNC_OR_ITEM, BAD_FORMAT, BAD_INITIAL_RECS, BAD_MAJORITY, BAD_MALLOC, BAD_NEGtoPOSfp0_MODE, BAD_NUM_DIMS, BAD_NUM_ELEMS, BAD_NUM_VARS, BAD_READONLY_MODE, BAD_REC_COUNT, BAD_REC_INTERVAL, BAD_REC_NUM, BAD_SCOPE, BAD_SCRATCH_DIR, BAD_SPARSEARRAYS_PARM, BAD_VAR_NAME, BAD_VAR_NUM, BAD_zMODE, CANNOT_ALLOCATE_RECORDS, CANNOT_CHANGE, CANNOT_COMPRESS, CANNOT_COPY, CANNOT_SPARSEARRAYS, CANNOT_SPARSERECORDS, CDF_, CDF_ACCESS_, CDF_ATTR_NAME_LEN, CDF_ATTR_NAME_LEN256, CDF_BYTE, CDF_CACHESIZE_, CDF_CHAR, CDF_CHECKSUM_, CDF_CLOSE_ERROR, CDF_COMPRESSION_, CDF_COPYRIGHT_, CDF_COPYRIGHT_LEN, CDF_CREATE_ERROR, CDF_DECODING_, CDF_DELETE_ERROR, CDF_DOUBLE, CDF_ENCODING_, CDF_EPOCH, CDF_EPOCH16, CDF_EXISTS, CDF_FLOAT, CDF_FORMAT_, CDF_INCREMENT_, CDF_INFO_, CDF_INT1, CDF_INT2, CDF_INT4, CDF_INT8, CDF_INTERNAL_ERROR, CDF_MAJORITY_, CDF_MAX_DIMS, CDF_MAX_PARMS, CDF_MIN_DIMS, CDF_NAME_, CDF_NAME_TRUNC, CDF_NEGtoPOSfp0_MODE_, CDF_NUMATTRS_, CDF_NUMgATTRS_, CDF_NUMrVARS_, CDF_NUMvATTRS_, CDF_NUMzVARS_, CDF_OK, CDF_OPEN_ERROR, CDF_PATHNAME_LEN, CDF_READ_ERROR, CDF_READONLY_MODE_, CDF_REAL4, CDF_REAL8, CDF_RELEASE_, CDF_SAVE_ERROR, CDF_SCRATCHDIR_, CDF_STATUS_, CDF_STATUSTEXT_LEN, CDF_TIME_TT2000, CDF_UCHAR, CDF_UINT1, CDF_UINT2, CDF_UINT4, CDF_VAR_NAME_LEN, CDF_VAR_NAME_LEN256, CDF_VERSION_, CDF_WARN, CDF_WRITE_ERROR, CDF_zMODE_, CDFwithSTATS_, CHECKSUM_, CHECKSUM_ERROR, CHECKSUM_NOT_ALLOWED, CLOSE_, COLUMN_MAJOR, COMPRESS_CACHESIZE_, COMPRESSION_ERROR, CONFIRM_, CORRUPTED_V2_CDF, CORRUPTED_V3_CDF, CREATE_, CURgENTRY_EXISTENCE_, CURrENTRY_EXISTENCE_, CURzENTRY_EXISTENCE_, DATATYPE_MISMATCH, DATATYPE_SIZE_, DECOMPRESSION_ERROR, DECSTATION_DECODING, DECSTATION_ENCODING, DEFAULT_BYTE_PADVALUE, DEFAULT_CHAR_PADVALUE, DEFAULT_DOUBLE_PADVALUE, DEFAULT_EPOCH_PADVALUE, DEFAULT_EPOCH16_PADVALUE, DEFAULT_FLOAT_PADVALUE, DEFAULT_INT1_PADVALUE, DEFAULT_INT2_PADVALUE, DEFAULT_INT4_PADVALUE, DEFAULT_INT8_PADVALUE, DEFAULT_REAL4_PADVALUE, DEFAULT_REAL8_PADVALUE, DEFAULT_TT2000_PADVALUE, DEFAULT_UCHAR_PADVALUE, DEFAULT_UINT1_PADVALUE, DEFAULT_UINT2_PADVALUE, DEFAULT_UINT4_PADVALUE, DELETE_, DID_NOT_COMPRESS, EMPTY_COMPRESSED_CDF, END_OF_VAR, EPOCH_STRING_LEN, EPOCH_STRING_LEN_EXTEND, EPOCH1_STRING_LEN, EPOCH1_STRING_LEN_EXTEND, EPOCH2_STRING_LEN, EPOCH2_STRING_LEN_EXTEND, EPOCH3_STRING_LEN, EPOCH3_STRING_LEN_EXTEND, EPOCH4_STRING_LEN, EPOCH4_STRING_LEN_EXTEND, EPOCHx_FORMAT_MAX, EPOCHx_STRING_MAX, FILLED_TT2000_VALUE, FORCED_PARAMETER, gENTRY_, gENTRY_DATA_, gENTRY_DATASPEC_, gENTRY_DATATYPE_, gENTRY_EXISTENCE_, gENTRY_NUMELEMS_, GET_, GETCDFCHECKSUM_, GETCDFFILEBACKWARD_, GETCDFVALIDATE_, GETLEAPSECONDSENVVAR_, GLOBAL_SCOPE, GZIP_COMPRESSION, HOST_DECODING, HOST_ENCODING, HP_DECODING, HP_ENCODING, HUFF_COMPRESSION, IBM_PC_OVERFLOW, IBMPC_DECODING, IBMPC_ENCODING, IBMRS_DECODING, IBMRS_ENCODING, ILLEGAL_EPOCH_FIELD, ILLEGAL_EPOCH_VALUE, ILLEGAL_FOR_SCOPE, ILLEGAL_IN_zMODE, ILLEGAL_ON_V1_CDF, ILLEGAL_TT2000_VALUE, IS_A_NETCDF, LIB_COPYRIGHT_, LIB_INCREMENT_, LIB_RELEASE_, LIB_subINCREMENT_, LIB_VERSION_, MAC_DECODING, MAC_ENCODING, MD5_CHECKSUM, MULTI_FILE, MULTI_FILE_FORMAT, NA_FOR_VARIABLE, NEGATIVE_FP_ZERO, NEGtoPOSfp0off, NEGtoPOSfp0on, NETWORK_DECODING, NETWORK_ENCODING, NeXT_DECODING, NeXT_ENCODING, NO_ATTR_SELECTED, NO_CDF_SELECTED, NO_CHECKSUM, NO_COMPRESSION, NO_DELETE_ACCESS, NO_ENTRY_SELECTED, NO_MORE_ACCESS, NO_PADVALUE_SPECIFIED, NO_SPARSEARRAYS, NO_SPARSERECORDS, NO_STATUS_SELECTED, NO_SUCH_ATTR, NO_SUCH_CDF, NO_SUCH_ENTRY, NO_SUCH_RECORD, NO_SUCH_VAR, NO_VAR_SELECTED, NO_VARS_IN_CDF, NO_WRITE_ACCESS, NONE_CHECKSUM, NOT_A_CDF, NOT_A_CDF_OR_NOT_SUPPORTED, NOVARY, NULL_, OPEN_, OPTIMAL_ENCODING_TREES, OTHER_CHECKSUM, PAD_SPARSERECORDS, PPC_DECODING, PPC_ENCODING, PRECEEDING_RECORDS_ALLOCATED, PREV_SPARSERECORDS, PUT_, READ_ONLY_DISTRIBUTION, READ_ONLY_MODE, READONLYoff, READONLYon, rENTRY_, rENTRY_DATA_, rENTRY_DATASPEC_, rENTRY_DATATYPE_, rENTRY_EXISTENCE_, rENTRY_NAME_, rENTRY_NUMELEMS_, RLE_COMPRESSION, RLE_OF_ZEROs, ROW_MAJOR, rVAR_, rVAR_ALLOCATEBLOCK_, rVAR_ALLOCATEDFROM_, rVAR_ALLOCATEDTO_, rVAR_ALLOCATERECS_, rVAR_BLOCKINGFACTOR_, rVAR_CACHESIZE_, rVAR_COMPRESSION_, rVAR_DATA_, rVAR_DATASPEC_, rVAR_DATATYPE_, rVAR_DIMVARYS_, rVAR_EXISTENCE_, rVAR_HYPERDATA_, rVAR_INITIALRECS_, rVAR_MAXallocREC_, rVAR_MAXREC_, rVAR_NAME_, rVAR_nINDEXENTRIES_, rVAR_nINDEXLEVELS_, rVAR_nINDEXRECORDS_, rVAR_NUMallocRECS_, rVAR_NUMBER_, rVAR_NUMELEMS_, rVAR_NUMRECS_, rVAR_PADVALUE_, rVAR_RECORDS_, rVAR_RECORDS_RENUMBER_, rVAR_RECVARY_, rVAR_RESERVEPERCENT_, rVAR_SEQDATA_, rVAR_SEQPOS_, rVAR_SPARSEARRAYS_, rVAR_SPARSERECORDS_, rVARs_CACHESIZE_, rVARs_DIMCOUNTS_, rVARs_DIMINDICES_, rVARs_DIMINTERVALS_, rVARs_DIMSIZES_, rVARs_MAXREC_, rVARs_NUMDIMS_, rVARs_RECCOUNT_, rVARs_RECDATA_, rVARs_RECINTERVAL_, rVARs_RECNUMBER_, SAVE_, SCRATCH_CREATE_ERROR, SCRATCH_DELETE_ERROR, SCRATCH_READ_ERROR, SCRATCH_WRITE_ERROR, SELECT_, SGi_DECODING, SGi_ENCODING, SINGLE_FILE, SINGLE_FILE_FORMAT, SOME_ALREADY_ALLOCATED, STAGE_CACHESIZE_, STATUS_TEXT_, SUN_DECODING, SUN_ENCODING, TOO_MANY_PARMS, TOO_MANY_VARS, TT2000_0_STRING_LEN, TT2000_1_STRING_LEN, TT2000_2_STRING_LEN, TT2000_3_STRING_LEN, TT2000_TIME_ERROR, UNABLE_TO_PROCESS_CDF, UNKNOWN_COMPRESSION, UNKNOWN_SPARSENESS, UNSUPPORTED_OPERATION, VALIDATE_, VALIDATEFILEoff, VALIDATEFILEon, VAR_ALREADY_CLOSED, VAR_CLOSE_ERROR, VAR_CREATE_ERROR, VAR_DELETE_ERROR, VAR_EXISTS, VAR_NAME_TRUNC, VAR_OPEN_ERROR, VAR_READ_ERROR, VAR_SAVE_ERROR, VAR_WRITE_ERROR, VARIABLE_SCOPE, VARY, VAX_DECODING, VAX_ENCODING, VIRTUAL_RECORD_DATA, zENTRY_, zENTRY_DATA_, zENTRY_DATASPEC_, zENTRY_DATATYPE_, zENTRY_EXISTENCE_, zENTRY_NAME_, zENTRY_NUMELEMS_, zMODEoff, zMODEon1, zMODEon2, zVAR_, zVAR_ALLOCATEBLOCK_, zVAR_ALLOCATEDFROM_, zVAR_ALLOCATEDTO_, zVAR_ALLOCATERECS_, zVAR_BLOCKINGFACTOR_, zVAR_CACHESIZE_, zVAR_COMPRESSION_, zVAR_DATA_, zVAR_DATASPEC_, zVAR_DATATYPE_, zVAR_DIMCOUNTS_, zVAR_DIMINDICES_, zVAR_DIMINTERVALS_, zVAR_DIMSIZES_, zVAR_DIMVARYS_, zVAR_EXISTENCE_, zVAR_HYPERDATA_, zVAR_INITIALRECS_, zVAR_MAXallocREC_, zVAR_MAXREC_, zVAR_NAME_, zVAR_nINDEXENTRIES_, zVAR_nINDEXLEVELS_, zVAR_nINDEXRECORDS_, zVAR_NUMallocRECS_, zVAR_NUMBER_, zVAR_NUMDIMS_, zVAR_NUMELEMS_, zVAR_NUMRECS_, zVAR_PADVALUE_, zVAR_RECCOUNT_, zVAR_RECINTERVAL_, zVAR_RECNUMBER_, zVAR_RECORDS_, zVAR_RECORDS_RENUMBER_, zVAR_RECVARY_, zVAR_RESERVEPERCENT_, zVAR_SEQDATA_, zVAR_SEQPOS_, zVAR_SPARSEARRAYS_, zVAR_SPARSERECORDS_, zVARs_CACHESIZE_, zVARs_MAXREC_, zVARs_RECDATA_, zVARs_RECNUMBER_
 
Constructor Summary
CDFTT2000()
           
 
Method Summary
static long[] breakdown(long nanoSecSinceJ2000)
          Breaks a TT2000 epoch value down into its full, UTC-based date/time component parts.
static long[][] breakdown(long[] nanoSecSinceJ2000)
          Breaks an array of TT2000 epoch values down into two dimensional array, the first dimension being the count of the epoch values, and the second dimension being their full, UTC-based date/time component parts for each value.
static long[] CDFgetLastDateinLeapSecondsTable()
          /** This method returns the last UTC date that a leap second was added in the leap second table used in the class.
static double[][] CDFgetLeapSecondsTable()
          This method returns the leap seconds table.
static int CDFgetLeapSecondsTableStatus()
          This method returns the status code reflecting whether the leap seconds are from a external file, defined by an environment variable, or the leap seconds are based on the hard-coded table in the class.
static int CDFgetRowsinLeapSecondsTable()
          This method returns the number of entries in the leap seconds table.
static long[] compute(long[] year, long[] month, long[] day)
          Computes an array of TT2000 epochs, nanoseconds since J2000, based on its UTC-based date/time component parts.
static long[] compute(long[] year, long[] month, long[] day, long[] hour)
          Computes an array of TT2000 epochs, nanoseconds since J2000, based on its UTC-based date/time component parts.
static long[] compute(long[] year, long[] month, long[] day, long[] hour, long[] minute)
          Computes an array of TT2000 epochs, nanoseconds since J2000, based on its * UTC-based date/time component parts.
static long[] compute(long[] year, long[] month, long[] day, long[] hour, long[] minute, long[] second)
          Computes an array of TT2000 epochs, nanoseconds since J2000, based on its * UTC-based date/time component parts.
static long[] compute(long[] year, long[] month, long[] day, long[] hour, long[] minute, long[] second, long[] msec)
          Computes an array of TT2000 epochs, nanoseconds since J2000, based on its * UTC-based date/time component parts.
static long[] compute(long[] year, long[] month, long[] day, long[] hour, long[] minute, long[] second, long[] msec, long[] usec)
          Computes an array of TT2000 epochs, nanoseconds since J2000, based on its * UTC-based date/time component parts.
static long[] compute(long[] year, long[] month, long[] day, long[] hour, long[] minute, long[] second, long[] msec, long[] usec, long[] nsec)
          Computes an array of TT2000 epochs, nanoseconds since J2000, based on its * UTC-based date/time component parts.
static long compute(long year, long month, long day, long hour, long minute, long second, long msec, long usec, long nsec)
          Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts.
static java.lang.String encode(long nanoSecSinceJ2000)
          Converts an epoch value in TT2000 type into a readable, UTC-based date/time string in ISO 8601 format.
static java.lang.String[] encode(long[] nanoSecSinceJ2000)
          Converts an array of epoch values in TT2000 type into an array of readable, UTC-based date/time strings in ISO 8601 format.
static java.lang.String encode(long nanoSecSinceJ2000, int format)
          Converts an epoch value in TT2000 type into a readable, UTC-based date/time string of chosen formats.
static long fromGregorianTime(java.util.GregorianCalendar gc)
          This method converts the UTC-based date/time in a GregorianCalendar class object to TT2000 time.
static long fromUTCEPOCH(double epoch)
          Convert an epoch value in CDF_EPOCH type to TT2000 type.
static long fromUTCEPOCH16(double[] epoch)
          Convert an epoch data in CDF_EPOCH16 type to TT2000 type.
static long fromUTCparts(double year, double month, double day)
          Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts.
static long fromUTCparts(double year, double month, double day, double hour)
          Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts.
static long fromUTCparts(double year, double month, double day, double hour, double minute)
          Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts.
static long fromUTCparts(double year, double month, double day, double hour, double minute, double second)
          Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts.
static long fromUTCparts(double year, double month, double day, double hour, double minute, double second, double milsec)
          Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts.
static long fromUTCparts(double year, double month, double day, double hour, double minute, double second, double milsec, double micsec)
          Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts.
static long fromUTCparts(double year, double month, double day, double hour, double minute, double second, double msec, double usec, double nsec)
          Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts.
static long fromUTCstring(java.lang.String string)
          This method parses an input, UTC-based, date/time string and returns a TT2000 epoch value, nanoseconds since J2000.
static java.lang.String getLeapSecondsTableEnvVar()
          Find the environment variable "CDF_LEAPSECONDSTABLE" that is defined for the leap seconds table for CDF.
static double LeapSecondsfromYMD(long year, long month, long day)
          Find the leap seconds from a given, UTC-based year/month/day.
static long parse(java.lang.String string)
          This method parses an input date/time string and returns a TT2000 epoch value, nanoseconds since J2000.
static long[] parse(java.lang.String[] strings)
          This method parses an array of input date/time strings and returns an array of TT2000 epoch values, nanoseconds since J2000.
static java.util.GregorianCalendar toGregorianTime(long tt2000)
          This method converts the UTC-based date/time in TT2000 type to a GregorianCalendar class object in default, local time zone.
static java.util.GregorianCalendar toGregorianTime(long tt2000, java.util.TimeZone tz)
          This method converts the UTC-based date/time in TT2000 type to a GregorianCalendar class object in specified time zone.
static double toUTCEPOCH(long nanoSecSinceJ2000)
          Convert an epoch value in TT2000 type to CDF_EPOCH type.
static double toUTCEPOCH16(long nanoSecSinceJ2000, double[] epoch)
          Convert an epoch value in TT2000 type to CDF_EPOCH16 type.
static long[] toUTCparts(long nanoSecSinceJ2000)
          Breaks a TT2000 epoch value down into its full, UTC-based date/time component parts.
static java.lang.String toUTCstring(long nanoSecSinceJ2000)
          Converts an epoch value in TT2000 type into a readable, UTC-based date/time string of ISO 8601 formats.
static java.lang.String toUTCstring(java.lang.Long nanoSecSinceJ2000)
          Converts an epoch value in TT2000 type into a readable, UTC-based date/time string of ISO 8601 formats.
static java.lang.String toUTCstring(long nanoSecSinceJ2000, int format)
          Converts an epoch value in TT2000 type into a readable, UTC-based date/time string of chosen formats.
static java.lang.String toUTCstring(java.lang.Long nanoSecSinceJ2000, int format)
          Converts an epoch value in TT2000 type into a readable, UTC-based date/time string of chosen formats.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDFTT2000

public CDFTT2000()
Method Detail

getLeapSecondsTableEnvVar

public static java.lang.String getLeapSecondsTableEnvVar()
Find the environment variable "CDF_LEAPSECONDSTABLE" that is defined for the leap seconds table for CDF.

Returns:
the leap seconds environment variable if defined null if not.

LeapSecondsfromYMD

public static double LeapSecondsfromYMD(long year,
                                        long month,
                                        long day)
Find the leap seconds from a given, UTC-based year/month/day.

Parameters:
year - the year
month - the month
day - the day
Returns:
the leap second value (TAI-UTC)

toUTCparts

public static long[] toUTCparts(long nanoSecSinceJ2000)
Breaks a TT2000 epoch value down into its full, UTC-based date/time component parts.

Parameters:
nanoSecSinceJ2000 - the epoch value, in nanoseconds since J2000, to break down
Returns:
an array of long containing the epoch parts:
IndexPart
0year
1month
2day
3hour
4minute
5second
6millisecond
7microsecond
8nanosecond

breakdown

public static long[] breakdown(long nanoSecSinceJ2000)
Breaks a TT2000 epoch value down into its full, UTC-based date/time component parts.

Parameters:
nanoSecSinceJ2000 - the epoch value, in nanoseconds since J2000, to break down
Returns:
an array of long containing the epoch parts:
IndexPart
0year
1month
2day
3hour
4minute
5second
6millisecond
7microsecond
8nanosecond

breakdown

public static long[][] breakdown(long[] nanoSecSinceJ2000)
Breaks an array of TT2000 epoch values down into two dimensional array, the first dimension being the count of the epoch values, and the second dimension being their full, UTC-based date/time component parts for each value.

Parameters:
nanoSecSinceJ2000 - an array of epoch values, in nanoseconds since J2000, to break down
Returns:
a 2-dim array of long, the first dimension being the value count while the second dimension containing the epoch parts, as follows:
IndexPart
0year
1month
2day
3hour
4minute
5second
6millisecond
7microsecond
8nanosecond
or null if null or an empty input array is detected

fromUTCparts

public static long fromUTCparts(double year,
                                double month,
                                double day)
                         throws CDFException
Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts. The day field can contain a fraction of a day.

Parameters:
year - the year, a full year in double
month - the month, a full month in double
day - the day in double
Returns:
the TT2000 epoch value in long
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

fromUTCparts

public static long fromUTCparts(double year,
                                double month,
                                double day,
                                double hour)
                         throws CDFException
Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts. The hour field can contain a fraction of a hour.

Parameters:
year - the year, a full year in double
month - the month, a full month in double
day - the day, a full day in double
hour - the hour in double
Returns:
the TT2000 epoch value in long
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

fromUTCparts

public static long fromUTCparts(double year,
                                double month,
                                double day,
                                double hour,
                                double minute)
                         throws CDFException
Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts. The minute field can contain a fraction of a minute.

Parameters:
year - the year, a full year in double
month - the month, a full month in double
day - the day, a full day in double
hour - the hour, a full hour in double
minute - the minute in double
Returns:
the TT2000 epoch value in long
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

fromUTCparts

public static long fromUTCparts(double year,
                                double month,
                                double day,
                                double hour,
                                double minute,
                                double second)
                         throws CDFException
Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts. The second field can contain a fraction of a second.

Parameters:
year - the year, a full year in double
month - the month, a full month in double
day - the day, a full day in double
hour - the hour, a full hour in double
minute - the minute, a full minute in double
second - the second in double
Returns:
the TT2000 epoch value in long
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

fromUTCparts

public static long fromUTCparts(double year,
                                double month,
                                double day,
                                double hour,
                                double minute,
                                double second,
                                double milsec)
                         throws CDFException
Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts. The millisecond field can contain a fraction of a millisecond.

Parameters:
year - the year, a full year in double
month - the month, a full month in double
day - the day, a full day in double
hour - the hour, a full hour in double
minute - the minute, a full minute in double
second - the second, a full second in double
milsec - the millisecond in double
Returns:
the TT2000 epoch value in long
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

fromUTCparts

public static long fromUTCparts(double year,
                                double month,
                                double day,
                                double hour,
                                double minute,
                                double second,
                                double milsec,
                                double micsec)
                         throws CDFException
Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts. The microsecond field can contain a fraction, which usually indicates the end of the parameter list.

Parameters:
year - the year, a full year in double
month - the month, a full month in double
day - the day, a full day in double
hour - the hour, a full hour in double
minute - the minute, a full minute in double
second - the second, a full second in double
milsec - the millisecond, a full millisecond in double
micsec - the microsecond in double
Returns:
the TT2000 epoch value in long
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

fromUTCparts

public static long fromUTCparts(double year,
                                double month,
                                double day,
                                double hour,
                                double minute,
                                double second,
                                double msec,
                                double usec,
                                double nsec)
                         throws CDFException
Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts.

Parameters:
year - the year, a full year in double
month - the month, a full month in double
day - the day, a full day in double
hour - the hour, a full hour in double
minute - the minute, a full minute in double
second - the second, a full second in double
msec - the millisecond, a full millisecond in double
usec - the microsecond, a full microsecond in double
nsec - the nanosecond, a full nanosecond in double
Returns:
the TT2000 epoch value in long
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

compute

public static long compute(long year,
                           long month,
                           long day,
                           long hour,
                           long minute,
                           long second,
                           long msec,
                           long usec,
                           long nsec)
                    throws CDFException
Computes a TT2000 epoch, nanoseconds since J2000, based on its UTC-based date/time component parts.

Parameters:
year - the year, a full year in long
month - the month, a full month in long
day - the day, a full day in long
hour - the hour, a full hour in long
minute - the minute, a full minute in long
second - the second, a full second in long
msec - the millisecond, a full millisecond in long
usec - the microsecond, a full microsecond in long
nsec - the nanosecond, a full nanosecond in long
Returns:
the TT2000 epoch value in long
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

compute

public static long[] compute(long[] year,
                             long[] month,
                             long[] day)
                      throws CDFException
Computes an array of TT2000 epochs, nanoseconds since J2000, based on its UTC-based date/time component parts.

Parameters:
year - an array of years, a full year in long
month - an array of months, a full month in long
day - an array of days, a full day in long
Returns:
the TT2000 epoch values in long or null if an invalid input array(s) is detected
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

compute

public static long[] compute(long[] year,
                             long[] month,
                             long[] day,
                             long[] hour)
                      throws CDFException
Computes an array of TT2000 epochs, nanoseconds since J2000, based on its UTC-based date/time component parts.

Parameters:
year - an array of years, a full year in long
month - an array of months, a full month in long
day - an array of days, a full day in long
hour - an array of hours, a full hour in long
Returns:
the TT2000 epoch value in long or null if an invalid input array(s) is detected
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

compute

public static long[] compute(long[] year,
                             long[] month,
                             long[] day,
                             long[] hour,
                             long[] minute)
                      throws CDFException
Computes an array of TT2000 epochs, nanoseconds since J2000, based on its * UTC-based date/time component parts.

Parameters:
year - an array of years, a full year in long
month - an array of months, a full month in long
day - an array of days, a full day in long
hour - an array of hours, a full hour in long
minute - an array of minutes, a full minute in long
Returns:
the TT2000 epoch values in long or null if an invalid input array(s) is detected
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

compute

public static long[] compute(long[] year,
                             long[] month,
                             long[] day,
                             long[] hour,
                             long[] minute,
                             long[] second)
                      throws CDFException
Computes an array of TT2000 epochs, nanoseconds since J2000, based on its * UTC-based date/time component parts.

Parameters:
year - an array of years, a full year in long
month - an array of months, a full month in long
day - an array of days, a full day in long
hour - an array of hours, a full hour in long
minute - an array of minutes, a full minute in long
second - an array of seconds, a full second in long
Returns:
the TT2000 epoch value in long or null if an invalid input array(s) is detected
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

compute

public static long[] compute(long[] year,
                             long[] month,
                             long[] day,
                             long[] hour,
                             long[] minute,
                             long[] second,
                             long[] msec)
                      throws CDFException
Computes an array of TT2000 epochs, nanoseconds since J2000, based on its * UTC-based date/time component parts.

Parameters:
year - an array of years, a full year in long
month - an array of months, a full month in long
day - an array of days, a full day in long
hour - an array of hours, a full hour in long
minute - an array of minutes, a full minute in long
second - an array of seconds, a full second in long
msec - an array of milliseconds, a full millisecond in long
Returns:
the TT2000 epoch values in long or null if an invalid input array(s) is detected
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

compute

public static long[] compute(long[] year,
                             long[] month,
                             long[] day,
                             long[] hour,
                             long[] minute,
                             long[] second,
                             long[] msec,
                             long[] usec)
                      throws CDFException
Computes an array of TT2000 epochs, nanoseconds since J2000, based on its * UTC-based date/time component parts.

Parameters:
year - an array of years, a full year in long
month - an array of months, a full month in long
day - an array of days, a full day in long
hour - an array of hours, a full hour in long
minute - an array of minutes, a full minute in long
second - an array of seconds, a full second in long
msec - an array of milliseconds, a full millisecond in long
usec - an array of microseconds, a full microsecond in long
Returns:
the TT2000 epoch value in long or null if an invalid input array(s) is detected
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

compute

public static long[] compute(long[] year,
                             long[] month,
                             long[] day,
                             long[] hour,
                             long[] minute,
                             long[] second,
                             long[] msec,
                             long[] usec,
                             long[] nsec)
                      throws CDFException
Computes an array of TT2000 epochs, nanoseconds since J2000, based on its * UTC-based date/time component parts.

Parameters:
year - an array of years, a full year in long
month - an array of months, a full month in long
day - an array of days, a full day in long
hour - an array of hours, a full hour in long
minute - an array of minutes, a full minute in long
second - an array of seconds, a full second in long
msec - an array of milliseconds, a full millisecond in long
usec - an array of microseconds, a full microsecond in long
nsec - an array of nanoseconds, a full nanosecond in long
Returns:
the TT2000 epoch values in long or null if an invalid input array(s) is detected
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

toUTCEPOCH

public static double toUTCEPOCH(long nanoSecSinceJ2000)
                         throws CDFException
Convert an epoch value in TT2000 type to CDF_EPOCH type.

Parameters:
nanoSecSinceJ2000 - the nanoseconds since J2000
Returns:
the epoch value
Throws:
CDFException - an ILLEGAL_EPOCH_FIELD if an illegal component value is detected.

fromUTCEPOCH

public static long fromUTCEPOCH(double epoch)
                         throws CDFException
Convert an epoch value in CDF_EPOCH type to TT2000 type. Reset the predefined CDF_EPOCH value of -1.0E31, -1.0E-31, or the default 0.0 or -0.0 (all are invalid for TT2000) to 0.

Parameters:
epoch - the CDF_EPOCH value
Returns:
the TT2000 epoch in nanoseconds since J2000
Throws:
CDFException - an TT2000_TIME_ERROR if date is out of the valid range for TT2000.

toUTCEPOCH16

public static double toUTCEPOCH16(long nanoSecSinceJ2000,
                                  double[] epoch)
                           throws CDFException
Convert an epoch value in TT2000 type to CDF_EPOCH16 type.

Parameters:
nanoSecSinceJ2000 - the nanoseconds since J2000
epoch - the returned CDF_EPOCH16 value, a double[2] object
Returns:
the status
Throws:
CDFException - an ILLEGAL_EPOCH_FIELD if an illegal component value is detected.

fromUTCEPOCH16

public static long fromUTCEPOCH16(double[] epoch)
                           throws CDFException
Convert an epoch data in CDF_EPOCH16 type to TT2000 type. Reset the predefined CDF_EPOCH value of -1.0E31, -1.0E-31, or the default 0.0 or -0.0 (all are invalid for TT2000) to 0.

Parameters:
epoch - the CDF_EPOCH16 value, a double[2] object
Returns:
the TT2000 epoch in nanoseconds since J2000
Throws:
CDFException - an TT2000_TIME_ERROR if date is out of the valid range for TT2000.

toUTCstring

public static java.lang.String toUTCstring(java.lang.Long nanoSecSinceJ2000)
Converts an epoch value in TT2000 type into a readable, UTC-based date/time string of ISO 8601 formats.

            yyyy-mm-ddThh:mm:ss.ccccccccc
 Examples:  1990-04-01T03:05:02.000000000
            1993-10-10T23:45:49.777888999
 

Parameters:
nanoSecSinceJ2000 - the TT2000 epoch value, nanoseconds since J2000, in Long object
Returns:
A string representation of the epoch in ISO 8601

toUTCstring

public static java.lang.String toUTCstring(long nanoSecSinceJ2000)
Converts an epoch value in TT2000 type into a readable, UTC-based date/time string of ISO 8601 formats.
            yyyy-mm-ddThh:mm:ss.ccccccccc
 Examples:  1990-04-01T03:05:02.000000000
            1993-10-10T23:45:49.777888999
 
These formats are the same as those expected by fromUTCstring.

Parameters:
nanoSecSinceJ2000 - the TT2000 epoch value, nanoseconds since J2000, in long
Returns:
A string representation of the epoch

toUTCstring

public static java.lang.String toUTCstring(java.lang.Long nanoSecSinceJ2000,
                                           int format)
Converts an epoch value in TT2000 type into a readable, UTC-based date/time string of chosen formats.
 Format:0   dd-mmm-yyyy hh:mm:ss.ccccccccc
 Examples:  01-Apr-1990 03:05:02.000000000
            10-Oct-1993 23:45:49.777888999

 Format:1   yyyymmdd.cccccccccc
 Examples:  19900401.1234567890
            19931010.9998887776

 Format:2   yyyymmddhhmmss
 Examples:  19900401030502
            19931010234549

 Format:3   yyyy-mm-ddThh:mm:ss.ccccccccc
 Examples:  1990-04-01T03:05:02.000000000
            1993-10-10T23:45:49.777888999
 This is the default, ISO 8601, output.
 
These formats are the same as those expected by fromUTCstring.

Parameters:
nanoSecSinceJ2000 - the TT2000 epoch value, nanoseconds since J2000, in Long object
format - the format (from 0 to 3, as the default), an optional
Returns:
A string representation of the epoch

toUTCstring

public static java.lang.String toUTCstring(long nanoSecSinceJ2000,
                                           int format)
Converts an epoch value in TT2000 type into a readable, UTC-based date/time string of chosen formats.
 Format:0   dd-mmm-yyyy hh:mm:ss.ccccccccc
 Examples:  01-Apr-1990 03:05:02.000000000
            10-Oct-1993 23:45:49.777888999

 Format:1   yyyymmdd.cccccccccc
 Examples:  19900401.1234567890
            19931010.9998887776

 Format:2   yyyymmddhhmmss
 Examples:  19900401030502
            19931010234549

 Format:3   yyyy-mm-ddThh:mm:ss.ccccccccc
 Examples:  1990-04-01T03:05:02.000000000
            1993-10-10T23:45:49.777888999
 This is the default, ISO 8601, output.
 
These formats are the same as those expected by fromUTCstring.

Parameters:
nanoSecSinceJ2000 - the TT2000 epoch value, nanoseconds since J2000, in long
format - the format (from 0 to 3, as the default), an optional
Returns:
A string representation of the epoch

encode

public static java.lang.String encode(long nanoSecSinceJ2000)
Converts an epoch value in TT2000 type into a readable, UTC-based date/time string in ISO 8601 format.
            yyyy-mm-ddThh:mm:ss.ccccccccc
 Examples:  1990-04-01T03:05:02.000000000
            1993-10-10T23:45:49.777888999
 

Parameters:
nanoSecSinceJ2000 - the TT2000 epoch value, nanoseconds since J2000, in long
Returns:
A string representation of the epoch

encode

public static java.lang.String[] encode(long[] nanoSecSinceJ2000)
Converts an array of epoch values in TT2000 type into an array of readable, UTC-based date/time strings in ISO 8601 format.
            yyyy-mm-ddThh:mm:ss.ccccccccc
 Examples:  1990-04-01T03:05:02.000000000
            1993-10-10T23:45:49.777888999
 

Parameters:
nanoSecSinceJ2000 - the TT2000 epoch value, nanoseconds since J2000, in long
Returns:
strings representing the epochs or null if null or an empty input array is detected

encode

public static java.lang.String encode(long nanoSecSinceJ2000,
                                      int format)
Converts an epoch value in TT2000 type into a readable, UTC-based date/time string of chosen formats.
 Format:0   dd-mmm-yyyy hh:mm:ss.ccccccccc
 Examples:  01-Apr-1990 03:05:02.000000000
            10-Oct-1993 23:45:49.777888999

 Format:1   yyyymmdd.cccccccccc
 Examples:  19900401.1234567890
            19931010.9998887776

 Format:2   yyyymmddhhmmss
 Examples:  19900401030502
            19931010234549

 Format:3   yyyy-mm-ddThh:mm:ss.ccccccccc
 Examples:  1990-04-01T03:05:02.000000000
            1993-10-10T23:45:49.777888999
 This is the default, ISO 8601, output.
 
These formats are the same as those expected by fromUTCstring.

Parameters:
nanoSecSinceJ2000 - the TT2000 epoch value, nanoseconds since J2000, in long
format - the format (from 0 to 3, as the default), an optional
Returns:
A string representation of the epoch

fromUTCstring

public static long fromUTCstring(java.lang.String string)
                          throws CDFException
This method parses an input, UTC-based, date/time string and returns a TT2000 epoch value, nanoseconds since J2000. The string must be in one of the formats as shown below. Month abbreviations may be in any case and are always the first three letters of the month.
 Format:0   dd-mmm-yyyy hh:mm:ss.ccccccccc
 Examples:  01-Apr-1990 03:05:02.000000000
            10-Oct-1993 23:45:49.777888999

 Format:1   yyyymmdd.cccccccccc
 Examples:  19900401.1234567890
            19931010.9998887776

 Format:2   yyyymmddhhmmss
 Examples:  19900401030502
            19931010234549
 
 Format:3   yyyy-mm-ddThh:mm:ss.ccccccccc
 Examples:  1990-04-01T03:05:02.000000000
            1993-10-10T23:45:49.777888999
 
These formats are the same as those created by toUTCstring.

Parameters:
string - the epoch in string representation
Returns:
A TT2000 epoch the epoch value in nanoseconds since J2000
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

parse

public static long parse(java.lang.String string)
                  throws CDFException
This method parses an input date/time string and returns a TT2000 epoch value, nanoseconds since J2000. The string must be in one of the formats as shown below. Month abbreviations may be in any case and are always the first three letters of the month.
 Format:0   dd-mmm-yyyy hh:mm:ss.ccccccccc
 Examples:  01-Apr-1990 03:05:02.000000000
            10-Oct-1993 23:45:49.777888999

 Format:1   yyyymmdd.cccccccccc
 Examples:  19900401.1234567890
            19931010.9998887776

 Format:2   yyyymmddhhmmss
 Examples:  19900401030502
            19931010234549

 Format:3   yyyy-mm-ddThh:mm:ss.ccccccccc
 Examples:  1990-04-01T03:05:02.000000000
            1993-10-10T23:45:49.777888999
 
These formats are the same as those created by toUTCstring.

Parameters:
string - the epoch in string representation
Returns:
A TT2000 epoch the epoch value in nanoseconds since J2000
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

parse

public static long[] parse(java.lang.String[] strings)
                    throws CDFException
This method parses an array of input date/time strings and returns an array of TT2000 epoch values, nanoseconds since J2000. The string must be in one of the formats as shown below. Month abbreviations may be in any case and are always the first three letters of the month.
 Format:0   dd-mmm-yyyy hh:mm:ss.ccccccccc
 Examples:  01-Apr-1990 03:05:02.000000000
            10-Oct-1993 23:45:49.777888999

 Format:1   yyyymmdd.cccccccccc
 Examples:  19900401.1234567890
            19931010.9998887776

 Format:2   yyyymmddhhmmss
 Examples:  19900401030502
            19931010234549
 
 Format:3   yyyy-mm-ddThh:mm:ss.ccccccccc
 Examples:  1990-04-01T03:05:02.000000000
            1993-10-10T23:45:49.777888999
 
These formats are the same as those created by toUTCstring.

Parameters:
strings - an array of epochs in string representation
Returns:
TT2000 epoch values in nanoseconds since J2000 or null if null or an empty input array is detected
Throws:
CDFException - an TT2000_TIME_ERROR if an illegal component value is detected.

CDFgetLastDateinLeapSecondsTable

public static long[] CDFgetLastDateinLeapSecondsTable()
/** This method returns the last UTC date that a leap second was added in the leap second table used in the class. This can be used to check whether the table is up-to-date.

Returns:
the date (year, month, day) in a long array

fromGregorianTime

public static long fromGregorianTime(java.util.GregorianCalendar gc)
This method converts the UTC-based date/time in a GregorianCalendar class object to TT2000 time.

Returns:
the TT2000 time
Throws:
CDFException - an TT2000_TIME_ERROR if a GregorianCalendar component value is detected.

toGregorianTime

public static java.util.GregorianCalendar toGregorianTime(long tt2000)
This method converts the UTC-based date/time in TT2000 type to a GregorianCalendar class object in default, local time zone.

Returns:
a GregorianCalendar object

toGregorianTime

public static java.util.GregorianCalendar toGregorianTime(long tt2000,
                                                          java.util.TimeZone tz)
This method converts the UTC-based date/time in TT2000 type to a GregorianCalendar class object in specified time zone.

Returns:
a GregorianCalendar object

CDFgetLeapSecondsTableStatus

public static int CDFgetLeapSecondsTableStatus()
This method returns the status code reflecting whether the leap seconds are from a external file, defined by an environment variable, or the leap seconds are based on the hard-coded table in the class.

Returns:
status 1 if form a file, 0 hard-coded

CDFgetLeapSecondsTable

public static double[][] CDFgetLeapSecondsTable()
This method returns the leap seconds table.

Returns:
table The table contents of the leap seconds

CDFgetRowsinLeapSecondsTable

public static int CDFgetRowsinLeapSecondsTable()
This method returns the number of entries in the leap seconds table.

Returns:
enrtyCnt The entry count in the leap seconds table