ToThisTime TCL UTILITIES USER MANUAL ToThisTime
SYNOPSIS
Set the file descriptor to a specific time in a UDF file
PACKAGE
TCLUDF
NAME
ToThisTime
USAGE
set rV  ToThisTime  Key Ver Yr Dy Hr Mn Ss {pType}]
INPUT DEFINITIONS
Key - The data key associated with the with UDF hierarchy of the opened file. Key should have been obtained from a call to GetDataKey.
Ver - Version number associated this file
Yr - The year being positioned to in the file.
Dy - The day being positioned to in the file.
Hr - The hour being positioned to in the file.
Mn - The minute being positioned to in the file.
Ss - The minute being positioned to in the file.
pType - An optional input used to set the method to position the file descriptor within the file. The default setting is COARSE.
COARSE - Positions the file descriptor to the data record which starts closest to the requested begin time. This is useful in cases where data records contain full logical blocks of data, for example a full spin of data, and one wish to start at the beginning of a spin.
FINE - Positions the file descriptor at the measurement whose start time is closest to the requested begin time.
RETURN DEFINITION
1 - ALL_OKAY
0|NOFIND - Can't locate requested time
DESCRIPTION
ToThisTime positions the file descriptor in the file opened with the same Key and Verson at the either the data record or measurement closed to the requested begin time. The procedure can be invoked at anytime after the call to FileOpen and provides random access ability within a UDF data file. The the requested time is not found in the currently open file, the routine will close that file and open another. The time must be within the time range specified in the FileOpen call.
ERRORS
None Generated
C BACKING
No
EXAMPLE(S)
# INITIALIZE the UDF common variables

UDFInits

# GET the key for the UDF hierarchy IMAGE IMAGE1 OA ORBIT IMOORBIT

set KeY [GetDataKey IMAGE IMAGE1 OA ORBIT IMOORBIT]

# OPEN the data file containing the time 2001 198 1 0 0

FileOpen $KeY 0 2001 198 1 0 0 2001 198 6 0 0

# POSITION the file pointer to the beginning of the requested time

FilePos $KeY 0 2001 198 1 0 0 

# MAKE and initial read of the data and print the time.

ReadUDF $KeY 0 OA 0 0 0 
puts stderr "$ExDa(OA,BYR) $ExDa(OA,BDY) $ExDa(OA,BMSEC) to \
                        $ExDa(OA,EYR) $ExDa(OA,EDY) $ExDa(OA,EMSEC)"


# NOW read the data at 1 hour increments, printing the time after each read

for { set I 2 } { $I < 8 } { incr I } { 
   ToThisTime $KeY 0 2001 198 $I 0 0 FINE
   ReadUDF $KeY 0 OA 0 0 0 
   puts stderr "$ExDa(OA,BYR) $ExDa(OA,BDY) $ExDa(OA,BMSEC) to \
                        $ExDa(OA,EYR) $ExDa(OA,EDY) $ExDa(OA,EMSEC)"
}

> 2001 198 3600000 to  2001 198 3720000
> 2001 198 7200000 to  2001 198 7320000
> 2001 198 10800000 to  2001 198 10920000
> 2001 198 14400000 to  2001 198 14520000
> 2001 198 18000000 to  2001 198 18120000
> 2001 198 21600000 to  2001 198 21720000
> 2001 198 25200000 to  2001 198 25320000

      
Nov 15, 2006