CDF_EPOCH_COMPARE

The CDF_EPOCH_COMPARE function compares two epoch (date and time) values.

Values can be scalars or an array of values. The epoch can be in any of the CDF formats, CDF_EPOCH, CDF_EPOCH16 or CDF_TIME_TT2000, as returned from one of the following routines:

Note: If the first epoch and base epoch are in different formats, they will be automatically converted before comparison. The base epoch and end epoch (if present) must be in the same time format.

If the base epoch is a scalar, it is used to compare with all values in the first epoch. If the base epoch is an array, the corresponding element in the source and base epoch array is compared. If a third argument, EndEpoch, is provided, the BaseEpoch and EndEpoch are used as the starting and ending epoch that the source epoch will be checked against.

Examples

; For CDF_EPOCH data type

CDF_VARGET, id, "Epoch", ep, REC_COUNT=1000,/ZVARIABLE

CDF_EPOCH, base, 2005,6,1,10,18,17,2,/COMPUTE

ret= CDF_EPOCH_COMPARE(ep,base)

HELP, ret

 

; For CDF_TIME_TT2000 data type

CDF_VARGET, id2, "Epoch", ep2, REC_COUNT=1000,/ZVARIABLE

CDF_TT2000, base2, 2005,6,1,10,18,17,2,3,4,/COMPUTE

ret2= CDF_EPOCH_COMPARE(ep2,base2)

HELP, ret2

 

; For CDF_EPOCH data type

CDF_VARGET, id3, "Epoch", ep3, REC_COUNT=1000,/ZVARIABLE

CDF_EPOCH, starting, 2005,6,1,10,18,17,2,/COMPUTE

CDF_EPOCH, ending, 2005,6,10,10,18,17,2,/COMPUTE

ret3= CDF_EPOCH_COMPARE(ep3,starting,ending)

HELP, ret3

Syntax

Result = CDF_EPOCH_COMPARE(Epoch, BaseEpoch)

or

Result = CDF_EPOCH_COMPARE(Epoch, BaseEpoch, EndEpoch)

Return Value

If the function uses two arguments, the return value is a scalar or an array of integer values (1, 0, or -1):

Result Condition

1

if epoch > BaseEpoch

0

if epoch = BaseEpoch

-1

if epoch < BaseEpoch

If the function uses three arguments, the return value is a scalar value or an array of integer values (1 or 0):

Result Condition

1

BaseEpochepochEndEpoch

0

Otherwise

Arguments

Epoch

A scalar or array of epoch value(s).

BaseEpoch

A scalar or array of epoch value(s).

EndEpoch

A scalar or array of epoch value(s) of the same dimensions as BaseEpoch.

Keywords

None

Version History

6.4

Introduced

8.6

Automatic conversion between different epoch data types.

See Also

CDF_EPOCH, CDF_EPOCH16, CDF_TT2000, CDF_VARGET, CDF_VARGET1