Package hec.heclib.dss
Class HecTimeSeries
- All Implemented Interfaces:
HecDssListener
,Serializable
,Cloneable
,EventListener
- Direct Known Subclasses:
DSSTimeSeriesTranslator
,HecTimePattern
,HecTimeSeriesMath
HecTimeSeries is used to read and write time series data to DSS.
TimeSeriesContainers are used for input and output transfer objects.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class hec.heclib.dss.HecDssCatalog
HecDssCatalog.WriteCatalogFileRunnable
-
Field Summary
FieldsFields inherited from class hec.heclib.dss.HecTimeSeriesBase
_defaultInterval, _interval, _retrieveAllTimes
Fields inherited from class hec.heclib.dss.HecDataManager
_recordData, logFileName, messageUnit
Fields inherited from class hec.heclib.dss.HecDSSDataAttributes
_arrayEndTime, _arraySize, _arrayStartTime, _checkedNumber, _dataLengthInts, _dataType, _defaultEndTime, _defaultStartTime, _desiredArraySize, _dirty, _dssPathname, _endTime, _localUnitSystem, _recordExists, _recordType, _slashPosition, _startTime, _timeSeries, _timeWindowSet, _typeX, _unitsX, ALBERS, ALBERS_GRID, ALBERS_GRID_WITH_TIME, DOUBLE_ARRAY, ENGLISH_UNITS, ERROR, FILE, FLOAT_ARRAY, HRAP, HRAP_GRID, HRAP_GRID_WITH_TIME, IMAGE, INT_ARRAY, IRREGULAR_TIME_PATTERN, IRREGULAR_TIME_SERIES, IRREGULAR_TIME_SERIES_DOUBLES, LOCATION_LEVEL, PAIRED, PAIRED_DOUBLES, REGULAR_TIME_PATTERN, REGULAR_TIME_SERIES, REGULAR_TIME_SERIES_DOUBLES, SI_UNITS, SINGLE_VALUE, SPECIFIED_GRID, SPECIFIED_GRID_TYPE, SPECIFIED_GRID_WITH_TIME, TEXT, UNDEFINED_GRID, UNDEFINED_GRID_TYPE, UNDEFINED_GRID_WITH_TIME, UNDEFINED_UNITS, UNKNOWN
Fields inherited from class hec.heclib.dss.HecDssCatalog
_catalogName, _forceNewCatalog, _listenerList, _observerThreads, _useCollectionGroups, crcValues, dataTypeEnd, dataTypeStart, endDates, lastWriteTimeFile, lastWriteTimeRecord, listIsCollection, listIsComplete, listIsSorted, maxNumberToRetrieve, pathnameAddresses, pathnameHash, pathnameList, pathnameWithWild, startDates, statusRead, statusWanted
Fields inherited from class hec.heclib.dss.HecDSSFileAccess
_defaultDirectory, _defaultDSSFileName, _fileData, _maxNumberReopensForError, _numberReopensForError, _severeErrorIndex, _severeErrorMessages, _severeErrorRaised, ABBREVIATED_CATALOG, CONDENSED_CATALOG, FULL_CATALOG, MESS_LEVEL_CRITICAL, MESS_LEVEL_GENERAL, MESS_LEVEL_INTERNAL_DIAG_1, MESS_LEVEL_INTERNAL_DIAG_2, MESS_LEVEL_NONE, MESS_LEVEL_TERSE, MESS_LEVEL_USER_DIAG, MESS_METHOD_ALIAS, MESS_METHOD_CATALOG, MESS_METHOD_CHECK, MESS_METHOD_COPY, MESS_METHOD_FILE_CHECK, MESS_METHOD_GENERAL, MESS_METHOD_GET, MESS_METHOD_GLOBAL, MESS_METHOD_JNI, MESS_METHOD_LOCKING, MESS_METHOD_OPEN, MESS_METHOD_PERM, MESS_METHOD_PUT, MESS_METHOD_READ, MESS_METHOD_TS_READ, MESS_METHOD_TS_WRITE, MESS_METHOD_UTILITY, MESS_METHOD_WRITE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
arraySizeOk
(int arraySize) protected int
checkTimeWindow
(boolean readData) void
clear()
protected void
static TimeSeriesContainer
contractProfileContainer
(Vector<TimeSeriesContainer> containers) DSSFileName
(boolean useDefault) static Vector<TimeSeriesContainer>
expandProfileContainer
(TimeSeriesContainer profileContainer) converts profile data from a TimeSeriesContainer into a Vector of TimeSeries containersprotected int
protected int
getBlockStartDate
(int jul, int[] block, int[] year, int[] month, int[] day) static int
getCoincidentTimes
(List<TimeSeriesContainer> timeSeriesContainers) Take a list of TimeSeriesContainers, and remove all data that is not coincident in time with all other containers in the list.String[]
getCollectionList
(String seedPathname) Returns a string array of all the pathnames in a single collection in a DSS file.int
getData
(doubleArrayContainer values) int
getData
(HecDoubleArray values) protected int
int
getFlags
(intArrayContainer flags) protected int
getInterval
(String ePart) int
getSeriesPathnameRange
(stringContainer firstPath, stringContainer lastPath, int searchOption) Get the first and last pathnames for an entire time series data set For an exhaustive search (which may be slower), set the searchOption to 0.int
getSeriesTimeRange
(HecTime startRange, HecTime endRange, int searchOption) Get the date and time of the first piece and last piece of data in an entire time series set (not just the pathname) For an exhaustive search (which may be slower), set the searchOption to 0.static String
getStandardPathDate
(String pathname) int
getStatistics
(doubleContainer minimum, HecTime minimumTime, doubleContainer maximum, HecTime maximumTime, doubleContainer average, intContainer totalNumberValues, intContainer numberMissing) boolean
int
getTimes
(HecTimeArray timeArray) int
getTimes
(intArrayContainer timesAsInts) Returns a SimpleTimeZone object for the time zone set If no time zone, returns nullboolean
double
incrementalValue
(HecTime valueStartTime, HecTime valueEndTime, intContainer status) protected static int
intIndex
(int[] intArray, int intValue) returns location of intValue in array intArray returns -1 if not found.protected int
int
read()
Deprecated.int
read
(doubleArrayContainer values) Deprecated.int
read
(doubleArrayContainer values, int unitSystem) Deprecated.int
read
(HecDoubleArray values) Deprecated.int
read
(HecTimeArray timeArray, doubleArrayContainer values) Deprecated.int
read
(HecTimeArray timeArray, doubleArrayContainer values, int unitSystem) Deprecated.int
read
(HecTimeArray timeArray, HecDoubleArray values) Deprecated.int
read
(HecTimeArray timeArray, HecDoubleArray values, int unitSystem) Deprecated.int
read
(intArrayContainer timeArray, doubleArrayContainer values) Deprecated.int
read
(intArrayContainer timeArray, doubleArrayContainer values, int unitSystem) Deprecated.int
read
(TimeSeriesCollectionContainer timeSeriesCollectionContainer, boolean removeMissing) int
read
(TimeSeriesCollectionContainer timeSeriesCollectionContainer, boolean removeMissing, boolean getCollectionTimes) int
read
(TimeSeriesContainer timeSeriesContainer, boolean removeMissing) static int
removeLeadingTrailingMissing
(HecTimeArray timeArray, HecDoubleArray arrayX) void
void
reset()
Get information about an individual time series record (pathname) This includes the time of the first and last values in the record, and the records units and type.void
protected int
retrieveData
(int unitSystem) int
Deprecated.void
setData
(double[] values) Deprecated.void
setData
(double[] values, int numberToWrite) Typical use of write functions..void
setData
(HecDoubleArray values) Deprecated.int
setFlags
(int[] flags) Deprecated.int
setFlags
(int[] flags, int nflags) void
setIrregularIntervalInFlag
(int inFlag) This is the "inFlag" variable in zsitsxvoid
setReadPreviousSubsquent
(boolean readPrevious, boolean readSubsequent) For irregular-interval data, this setting will indicate if the value previous to the set time window should also be read, and if the value after the time window should be read.void
setRegularIntervalStorePlan
(int regularStorePlan) This is the "plan" variable in zsrtsxvoid
setRetrieveAllTimes
(boolean retrieveAllTimes) Retrieve data for all times in the data base This ignores the start and end times, and searches all records for this time series sequence.void
setStoreDoubles
(boolean storeDoubles) int
setTimes
(int[] times) Deprecated.int
setTimes
(int[] times, int ntimes) int
setTimes
(HecTimeArray times) Deprecated.void
setTimeZone
(TimeZone timeZone) void
status()
int
protected int
updateArrayTime
(int number) double
value
(HecTime newTime, intContainer status) int
write()
Deprecated.int
write
(boolean writeToDisk) Deprecated.int
write
(double[] values, int numberToWrite, boolean writeToDisk) Deprecated.int
write
(int[] times, double[] values, int numberToWrite, boolean writeToDisk) Deprecated.int
write
(HecDoubleArray values, boolean writeToDisk) Deprecated.int
write
(HecTimeArray times, double[] values, boolean writeToDisk) Deprecated.int
write
(TimeSeriesCollectionContainer timeSeriesCollectionContainer) int
write
(TimeSeriesContainer timeSeriesContainer) int
ztsRetrieve
(TimeSeriesContainer tsc, String pathname, HecTime startDateTime, HecTime endDateTime, boolean retrieveQualityAndNotes, int retrieveFlag) int
int
ztsStore
(TimeSeriesContainer tsc, int storageFlag) Methods inherited from class hec.heclib.dss.HecTimeSeriesBase
getAppropriateEPart, getAppropriateIrregularBlock, getAppropriateRegularEPart, getDefaultUnitsType, getDpartFromTime, getEPartFromInterval, getIntervalFromEPart, getListOfEParts, getMostCommonInterval, getNumberValuesForArraySize, getTimeWindowFromPath, interval, isRegular, numberValues, precision, setDefaultEPart, setDefaultInterval, setDefaultPathnameParts, setEPart, setInterval, setPathname, setPathnameParts, setPrecision, setStartTime, setType, setUnits, type, units, zgintlFromEPart
Methods inherited from class hec.heclib.dss.HecDataManager
addAlias, addAlias, addAlias, addAliasList, aliasGetPrimary, aliasGetPrimary, aliasList, aliasList, aliasRemove, aliasRemove, aliasRemoveList, closeLogFile, closeMessageFile, convertUnitSystem, copyContainerToRecordData, copyRecordDataToContainer, displayLogFile, done, flushMessageFile, generateLogFileName, getLogFileName, getRecordInfo, getRecordInfo, getRecordInfo, getTSRecordInfo, numberArray, release, release, setLogFile, setMessageFile, setProgramName, windMessageFile, Xarray, Yarray, Yarray, zlocationRetrieve, zlocationStore
Methods inherited from class hec.heclib.dss.HecDSSDataAttributes
aPart, arrayEndTime, arrayStartTime, bPart, clearDefaultParts, convertDoubleUnits, convertUnits, cPart, createArrayObject, createObject, createPairedDataObject, createTextObject, createTimeSeriesObject, defaultAPart, defaultBPart, defaultCPart, defaultDPart, defaultEPart, defaultFPart, dirty, dPart, endTime, ePart, fPart, getLastWriteTime, getLastWriteTime, getLastWriteTimeMillis, getLastWriteTimeMillis, getRecordBasics, isGridRecord, isTimeWindowSet, localUnitSystem, pathname, pathnameDataType, readRawBytes, readRawBytes, readRawRecord, readRawShorts, readRawShorts, recordExists, recordsUpdated, recordType, recordType, recordTypes, setAPart, setBPart, setCPart, setDefaultAPart, setDefaultBPart, setDefaultCPart, setDefaultDPart, setDefaultFPart, setDefaultTimeWindow, setDefaultTimeWindow, setDPart, setDSSFileName, setEndTime, setFPart, setLocalUnitSystem, setTimeWindow, setTimeWindow, startTime, writeRawRecord
Methods inherited from class hec.heclib.dss.HecDssCatalog
addHecDssListener, addHecDssListener, addHecDssListener, addHecDssListener, addHecDssListener, addHecDssListener, addHecDssListener, buildCondensedList, buildSortedCatalog, callCatalog, callCatalog, callCatalog, callCatalogOriginal, catalogFile, cleanCatalogPart, clearList, clone, compareCondensedPaths, createNewCatalog, expandPathname, fireHecDssEvent, getCatalog, getCatalog, getCatalog, getCatalogName, getCatalogSortAddresses, getCondensedCatalog, getCondensedCatalog, getEndDates, getEPartLoc, getMaximumPartLengths, getMaximumPartLengths, getPathnameList, getPathnameList, getPathnameList6, getPathnameList7, getPathnameListAndDates, getPathnameListType, getPathnames, getSortedPathnameList, getStartDates, getStatusRead, getUseCollectionGroups, hecDssEventPerformed, isCatalogValid, isPathnamePartsString, numberCatalogedRecords, pathNamePartsToRegex, processSearchParts, readCatalog, removeHecDssListener, searchDSSCatalog, searchDSSCatalog, searchDSSPaths, searchDSSPaths, setCatalogSortAddresses, setForceNewCatalog, setMaxNumberToRetrieve, setPathnameList, setPathnameList, setPathWithWildChars, setStatusWanted, setTypeWanted, setUseCollectionGroups, sort, sortCatalog, startObserverThread, whatChanged, whatChanged, whatChangedCompare, whatChangedSetStart, whatChangedSetStart, whatChangedSetStart, wildCharsToRegex, writeCatalog
Methods inherited from class hec.heclib.dss.HecDSSFileAccess
allSevereErrorMessages, appendNameToDirectory, catchSevereErrors, checkAccessReset, checkAllPathnames, checkForError, checkForSevereError, checkForSevereError, checkForSevereFileError, checkLinks, checkPathnameBins, checkSystemError, cleanDSSFileName, clearError, clearSevereError, clearSevereError, clearStatus, close, close, closeAll, closeAllFiles, closeAndClear, closeDSSFile, debugLook, debugLook7, debugModify, defaultDirectory, defaultDSSFileName, doesDSSFileExist, DSSFileName, fileAccessible, fileOpened, fileStatus, flushMessages, forceMultiUserAccess, getCollectionSequenceList, getCollectionSize, getDssFileVersion, getDssFileVersion, getFileInfo, getFileLastWriteTime, getFileLastWriteTimeMillis, getIrregBeginningDate, getLastError, getMessageLevel, getNumberRecords, getProcessStatus, getTimeSeriesExtents, getTSRecordInfo, isFileRemote, lastSevereErrorMessage, nextTimeSeriesPathname, numberRecords, open, open, processStatus, requestSecondAccess, setDefaultDirectory, setDefaultDSSFileName, setDss, setDSSFileName, setDSSFileName, setDSSFileName, setInterrupt, setMessageLevel, setSpaceReclaimation, setSpaceReclaimationPerm, setUnit, writeAccess, zgetMessageLevel, zinqir, zinqir, zinquire, zmessage, zquery, zquery, zset, zsetFile, zsetMessageLevel
-
Field Details
-
_timeZone
-
-
Constructor Details
-
HecTimeSeries
public HecTimeSeries() -
HecTimeSeries
-
-
Method Details
-
ztsRetrieve
public int ztsRetrieve(TimeSeriesContainer tsc, String pathname, HecTime startDateTime, HecTime endDateTime, boolean retrieveQualityAndNotes, int retrieveFlag) -
computeTimes
-
ztsStore
-
ztsStore
-
expandProfileContainer
public static Vector<TimeSeriesContainer> expandProfileContainer(TimeSeriesContainer profileContainer) converts profile data from a TimeSeriesContainer into a Vector of TimeSeries containers- Parameters:
profileContainer
-- Returns:
-
contractProfileContainer
-
setRetrieveAllTimes
public void setRetrieveAllTimes(boolean retrieveAllTimes) Retrieve data for all times in the data base This ignores the start and end times, and searches all records for this time series sequence. The start and end times are retained as startTime() and endTime() -
setRegularIntervalStorePlan
public void setRegularIntervalStorePlan(int regularStorePlan) This is the "plan" variable in zsrtsx- Parameters:
regularStorePlan
- int A flag indicating if existing data should be written over or not: regularStorePlan = 0 Always replace data (default) regularStorePlan = 1 Only replace missing data. regularStorePlan = 2 Write regardless, even if all missing data. regularStorePlan = 3 If a record is all missing, do not write it and delete it from disk if it exists. regularStorePlan = 4 Do not allow a missing input data to replace a valid data piece.
-
setIrregularIntervalInFlag
public void setIrregularIntervalInFlag(int inFlag) This is the "inFlag" variable in zsitsx- Parameters:
inFlag
- int A flag indicating if existing data should be written over or not: inFlag = 0 Merge Data (replaces data with coincident times) inFlag = 1 Replace Data (replaces the entire time window)
-
setStoreDoubles
public void setStoreDoubles(boolean storeDoubles) -
getStoreDoubles
public boolean getStoreDoubles() -
getSupplementalInfo
-
read
public int read()Deprecated. Use read(TimeSeriesContainer) instead This read is for backwards compatibility -
setReadPreviousSubsquent
public void setReadPreviousSubsquent(boolean readPrevious, boolean readSubsequent) For irregular-interval data, this setting will indicate if the value previous to the set time window should also be read, and if the value after the time window should be read. This is often needed for interpolating a first or last value. A time window must be set to use this function- Parameters:
readPrevious
- booleanreadSubsequent
- boolean
-
getData
-
getData
-
getTimes
-
getTimes
-
getFlags
-
read
Deprecated. Use read(TimeSeriesContainer) instead This read is for backwards compatibility -
read
Deprecated. Use read(TimeSeriesContainer) instead This read is for backwards compatibility -
read
Deprecated. Use read(TimeSeriesContainer) instead This read is for backwards compatibility -
read
Deprecated. Use read(TimeSeriesContainer) instead This read is for backwards compatibility -
read
Deprecated. Use read(TimeSeriesContainer) instead This read is for backwards compatibility -
read
Deprecated. Use read(TimeSeriesContainer) instead This read is for backwards compatibility -
read
Deprecated. Use read(TimeSeriesContainer) instead This read is for backwards compatibility -
read
Deprecated. Use read(TimeSeriesContainer) instead This read is for backwards compatibility -
read
Deprecated. Use read(TimeSeriesContainer) instead This read is for backwards compatibility -
read
-
read
-
read
public int read(TimeSeriesCollectionContainer timeSeriesCollectionContainer, boolean removeMissing, boolean getCollectionTimes) -
setData
public void setData(double[] values, int numberToWrite) Typical use of write functions.. setDSSFileName(filename); setPathname(pathnmae); Regular Interval Time Series data: setStartTime(startTime); setData(dataValues, numberToWrite); write(); Irregular Interval setData(dataValues, numberToWrite); setTimes(timeArray); write(); -
setData
public void setData(double[] values) Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
setData
Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
setTimes
public int setTimes(int[] times) Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
setTimes
public int setTimes(int[] times, int ntimes) -
setTimes
Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
setFlags
public int setFlags(int[] flags) Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
setFlags
public int setFlags(int[] flags, int nflags) -
write
public int write()Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
write
public int write(boolean writeToDisk) Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
write
public int write(double[] values, int numberToWrite, boolean writeToDisk) Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
write
public int write(int[] times, double[] values, int numberToWrite, boolean writeToDisk) Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
write
Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
write
Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
write
-
write
-
saveDataToDisk
public int saveDataToDisk()Deprecated. Use write(TimeSeriesContainer) instead This method is for backwards compatibility -
DSSFileName
-
timeWindowNumber
public int timeWindowNumber() -
removeLeadingTrailingMissing
-
getCoincidentTimes
Take a list of TimeSeriesContainers, and remove all data that is not coincident in time with all other containers in the list. For example, one data set is hourly, and the other at six hours, this will return both data sets at six hour times (coincident times). The data and times that are not coincident will be removed from the containers. This will not change the identified interval or E part, it is not dependent on the data type (e.g., inst or average). It will change the number of values and length of the time, values and quality arrays.- Parameters:
timeSeriesContainers
- List- Returns:
- int
-
intIndex
protected static int intIndex(int[] intArray, int intValue) returns location of intValue in array intArray returns -1 if not found.- Parameters:
intArray
- The array to searchintValue
- The value to search for- Returns:
- The lowest index at which the value occurs, or -1 if not found
-
status
public void status()- Overrides:
status
in classHecTimeSeriesBase
-
getStatistics
public int getStatistics(doubleContainer minimum, HecTime minimumTime, doubleContainer maximum, HecTime maximumTime, doubleContainer average, intContainer totalNumberValues, intContainer numberMissing) -
value
-
incrementalValue
-
getSeriesPathnameRange
public int getSeriesPathnameRange(stringContainer firstPath, stringContainer lastPath, int searchOption) Get the first and last pathnames for an entire time series data set For an exhaustive search (which may be slower), set the searchOption to 0. When it is known that there are few or no missing pathnames in the series, set this to the search limit (on both sides) of pathnames found. Typically a number like 10 is good. For example, if you have hourly data (in blocks of months), this would work for data sets that had no more than 10 months of sequential missing data. If this number is above about 25, it probably would be better to do an exhaustive search, unless the file is very large (>10,000 pathnames) Returns the number of records found in the data set -
getStandardPathDate
-
getSeriesTimeRange
Get the date and time of the first piece and last piece of data in an entire time series set (not just the pathname) For an exhaustive search (which may be slower), set the searchOption to 0. When it is known that there are few or no missing pathnames in the series, set this to the search limit (on both sides) of pathnames found. Typically a number like 10 is good. For example, if you have hourly data (in blocks of months), this would work for data sets that had no more than 10 months of sequential missing data. If this number is above about 25, it probably would be better to do an exhaustive search, unless the file is very large (>10,000 pathnames) Returns status of 0 = OK, ERROR = error -
reset
public void reset()Get information about an individual time series record (pathname) This includes the time of the first and last values in the record, and the records units and type. This is for a single record, not an entire data set. Returns status of 0 = OK, ERROR = error -
clear
public void clear()- Overrides:
clear
in classHecDataManager
-
resetArrayTime
public void resetArrayTime() -
getTimeZone
Returns a SimpleTimeZone object for the time zone set If no time zone, returns null -
hasTimeZone
public boolean hasTimeZone() -
setTimeZone
-
removeTimeZone
public void removeTimeZone() -
getCollectionList
Description copied from class:HecDSSFileAccess
Returns a string array of all the pathnames in a single collection in a DSS file. Any of the pathnames from the collection can be used as a seed (defining the remainder of the pathname). The sequence for the seed does not have to exist (i.e., you can use "000000", even if there is not a pathname with the sequence 000000.- Overrides:
getCollectionList
in classHecDSSFileAccess
- Parameters:
seedPathname
- String- Returns:
- String[]
-
arraySizeOk
protected boolean arraySizeOk(int arraySize) -
retrieveData
protected int retrieveData(int unitSystem) -
prepareForWrite
protected int prepareForWrite() -
flushToDisk
protected int flushToDisk() -
updateArrayTime
protected int updateArrayTime(int number) -
getInterval
-
checkTimeWindow
protected int checkTimeWindow(boolean readData) -
getBlockStartDate
protected int getBlockStartDate(int jul, int[] block, int[] year, int[] month, int[] day) -
getDesiredArraySize
protected int getDesiredArraySize()
-