Overview of HEC API Scripting Part 1 and 2: DSS Files, DataContainer, HecTime, HecMath

undefined
 
H
E
C
 
A
P
I
 
S
C
R
I
P
T
I
N
G
 
P
A
R
T
 
1
 
A
N
D
 
2
:
D
S
S
 
F
I
L
E
S
,
 
D
A
T
A
C
O
N
T
A
I
N
E
R
,
 
H
E
C
T
I
M
E
,
 
H
E
C
M
A
T
H
 
Evan Heisman, PE
Eric Novotny, PhD
USACE IWR-HEC
 
 
O
U
T
L
I
N
E
 
Overview of HEC “DSS” API
 
Important Classes
 
Accessing files
 
DataContainers vs HecMath objects
 
HecTime
 
P
Y
T
H
O
N
 
V
S
 
J
A
V
A
 
Python is interpreted, compiled to a byte-code at runtime.  Java is
compiled to a byte-code prior to runtime.
 
Java has a very strict form of Object Oriented Programming (OOP),
Python is OOP but lets you easily write 
functional
 or 
procedural
 code
 
Each has a standard library with helpful functions.
Jython has all of Java’s, most of Python’s.
 
P
Y
T
H
O
N
 
V
S
 
J
Y
T
H
O
N
 
Jython compiles Python code to Java
byte-code, runs inside the Java Virtual
Machine
 
Jython uses Python syntax and library
Jython 2.5 ~= Python 2.5
Jython 2.7 ~= Python 2.7
 
Jython has access to Java’s libraries
Import from Java’s library as if Python
modules.
 
D
S
S
 
D
A
T
A
 
F
O
R
M
A
T
S
 
P
a
t
h
n
a
m
e
s
:
 
 
 
 
/
A
/
B
/
C
/
D
/
E
/
F
/
/watershed/location/parameter/date/interval/version/
Watershed (A Part)
Often name for a river or blank
Location (B Part)
physical location (gage name, resv. name)
model’s location name (junction/node/component name)
Parameter (C Part)
ELEV, STAGE, STOR, FLOW, FLOW-MAX
 
D
S
S
 
D
A
T
A
 
F
O
R
M
A
T
S
 
Range / Date (D Part)
For time-series data, the start date of the values or the range of values
contained (for a combined record)
Interval (E Part)
Time step between values, or irregular block size.
1DAY, 1HOUR, IR-DECADE
Records broken up differently depending on interval
Version (F Part)
Usually the source or model the data came from
(
USGS-RAW
, 
CC:WY1929:RESSIM-FLOODMODEL1
)
 
D
S
S
V
U
E
 
The “HEC Java API” used by all HEC Java applications provides common functionality
Reading/writing HEC-DSS files
Working with time series, gridded data, and rating curves
Generating plots and tables
Documentation included with HEC-DSSVue at link specified below
 
CWMS-Vue and HEC-DSSVue provides API for accessing user interface and creating plugins
Documentation available by selecting Help
Help from the menu bar or
 pressing F1
https://www.hec.usace.army.mil/confluence/dssdocs/dssvueum/  
in your default browser
 
HEC-ResSim to build utility scripts in model or to script model behavior in rules and state
variables
HEC-ResSim-specific API documentation provided in the HEC-ResSim script editor; ResSim JavaDocs
 
CWMS CAVI to access watershed and forecast information, interact w/ user interface, and be
executed in the program sequence during forecast computes
CWMS CAVI-specific API documentation provided in the CWMS CAVI script editor
 
Other languages with good Java support, like R and Matlab can be linked to it
 
S
C
R
I
P
T
I
N
G
 
A
P
I
 
H
E
C
-
D
S
S
V
u
e
 
s
c
r
i
p
t
s
 
n
o
r
m
a
l
l
y
 
w
o
r
k
 
w
i
t
h
 
d
a
t
a
 
i
n
 
l
o
c
a
l
 
H
E
C
-
D
S
S
 
f
i
l
e
s
,
 
b
u
t
 
h
a
v
e
 
t
h
e
 
f
u
l
l
P
y
t
h
o
n
-
 
a
n
d
 
J
a
v
a
-
p
r
o
v
i
d
e
d
 
A
P
I
s
 
a
s
 
w
e
l
l
 
a
s
 
t
h
e
 
H
E
C
-
p
r
o
v
i
d
e
d
 
A
P
I
s
 
a
v
a
i
l
a
b
l
e
 
t
o
 
p
e
r
f
o
r
m
 
a
n
y
t
y
p
e
 
o
f
 
t
a
s
k
 
C
W
M
S
-
V
u
e
 
s
c
r
i
p
t
s
 
h
a
v
e
 
t
h
e
 
f
o
l
l
o
w
i
n
g
 
a
d
d
i
t
i
o
n
a
l
 
c
a
p
a
b
i
l
i
t
i
e
s
 
w
h
e
n
 
l
o
g
g
e
d
 
i
n
A
b
i
l
i
t
y
 
t
o
 
w
o
r
k
 
w
i
t
h
 
H
E
C
-
D
S
S
 
f
i
l
e
s
 
o
n
 
t
h
e
 
C
W
M
S
 
s
e
r
v
e
r
 
(
r
e
m
o
t
e
 
f
i
l
e
s
)
A
b
i
l
i
t
y
 
t
o
 
w
o
r
k
 
w
i
t
h
 
d
a
t
a
 
i
n
 
t
h
e
 
C
W
M
S
 
d
a
t
a
b
a
s
e
The DBAPI module provides access to the CWMS database using methods that mimic those used to access HEC-DSS files
 
Online help for scripting with HEC-DSSVue or CWMS-Vue is available by pressing F1 at the
main program window or selecting Help
Help from the main program window menu bar
 
H
E
C
-
D
S
S
V
U
E
 
A
N
D
 
C
W
M
S
-
V
U
E
 
S
C
R
I
P
T
I
N
G
 
HecDss
 – dealing with files
 
DataContainer:
TimeSeriesContainer
 – timeseries
PairedDataContainer
 - curves
 
HecMath
:  – math operations
TimeSeriesMath
PairedDataMath
 
HecTime
 - timestamps
 
Plot
 and 
Tablulate 
– create custom plots, adjust properties
 
H
E
C
 
C
L
A
S
S
E
S
 
To read and write dss files, you must use the the java objects DSS and DSSFile and their
methods which were designed to interact with DSS files.
 
To open a DSS file:
from hec.hecmath import DSS
myFile = DSS.open(str fileName)
myFile = DSS.open(str fileName, str timeWindow)   # limits to data within timeWindow
myFile = DSS.open(str fileName, str startTime, str endTime)  # another way
 
Returns a DSSFile object
The file handle for the DSSFile opened
 
NOTE – DSS is a static class.  You do not need to create an object of type
hec.hecmath.DSS in order to use it.
 
D
S
S
 
(
H
E
C
.
H
E
C
M
A
T
H
.
D
S
S
)
 
T
I
M
E
S
E
R
I
E
S
C
O
N
T
A
I
N
E
R
 
O
B
J
E
C
T
S
 
T
I
M
E
S
E
R
I
E
S
C
O
N
T
A
I
N
E
R
 
O
B
J
E
C
T
S
 
TimeSeriesContainers have Properties 
not
 Methods:
 
T
I
M
E
 
S
E
R
I
E
S
 
C
O
N
T
A
I
N
E
R
 
tsc.watershed =  “Green River”
tsc.location = “OakVile”
tsc.parameter = “Stage”
tsc.version = “OBS”
tsc.units = “FEET”
tsc.type = “INST-VAL”
 
tsc.interval = 60
tsc.values = [
Values List
]
tsc.times = [
int list from HecTimes
]
tsc.startTime = times[0]
tsc.endTime = times[-1]
tsc.numberValues = len(values)
 
A
n
 
H
e
c
M
a
t
h
 
o
b
j
e
c
t
 
r
e
p
r
e
s
e
n
t
s
 
d
a
t
a
 
t
h
a
t
 
c
a
n
 
b
e
 
s
t
o
r
e
d
 
i
n
 
a
n
 
H
E
C
-
D
S
S
 
f
i
l
e
 
(
a
k
a
,
 
a
 
d
a
t
a
s
e
t
)
.
T
h
e
 
s
u
b
c
l
a
s
s
e
s
 
o
f
 
H
e
c
M
a
t
h
 
a
r
e
:
PairedDataMath
 – represents lookup tables (e.g., ratings)
TimeSeriesMath
 – represents time series data
 
TimeSeriesMath
 objects have many methods that allow manipulation or analysis of 
the whole
time series
, but they do 
not
 allow access to 
individual
 data values.4
 
H
E
C
M
A
T
H
 
O
B
J
E
C
T
S
 
Use a 
TimeSeriesContainer
 to set the data in a 
TimeSeriesMath
 Object:
 
 
tsMath.setData(tsContainer)
 
 
TimeSeriesMath objects use Methods:
setLocation(string location)
setParameter(string parameter)
setPathname(string pathname)
setTimeInterval(string interval)
setType(string type)
setUnits(string units)
setVersion(string version)
setWatershed(string watershed)
 
T
I
M
E
 
S
E
R
I
E
S
 
M
A
T
H
 
TimeSeriesMath.getData()
 
returns a reference to the 
TimeSeriesContainer
 object
contained in the 
TimeSeriesMath
 object.
 
N
O
T
E
 
 
T
i
m
e
S
e
r
i
e
s
M
a
t
h
 
a
l
s
o
 
h
a
s
 
a
 
g
e
t
T
i
m
e
S
e
r
i
e
s
C
o
n
t
a
i
n
e
r
(
)
 
m
e
t
h
o
d
,
 
b
u
t
 
i
t
 
r
e
t
u
r
n
s
 
a
 
c
o
p
y
 
o
f
 
t
h
e
 
d
a
t
a
 
i
n
 
t
h
e
T
i
m
e
S
e
r
i
e
s
M
a
t
h
 
o
b
j
e
c
t
 
s
o
 
c
h
a
n
g
e
s
 
t
o
 
t
h
e
 
c
o
p
y
 
d
o
 
n
o
t
 
a
f
f
e
c
t
 
t
h
e
 
T
i
m
e
S
e
r
i
e
s
M
a
t
h
 
o
b
j
e
c
t
s
 
d
a
t
a
.
 
 
TimeSeriesMath
 objects may be created from 
TimeSeriesContainer
 objects by using the
constructor:
 
tsMath = TimeSeriesMath(tsContainer)
 
H
E
C
M
A
T
H
 
O
B
J
E
C
T
S
 
TimeSeriesMath
Data and Methods
Used for Math Functions
U
s
e
 
r
e
a
d
(
)
 
&
 
w
r
i
t
e
(
)
 
H
e
c
D
s
s
 
m
e
t
h
o
d
s
tsMath = dssFile.read(“/A/B/C/D/E/F/”)
dssFile.write(tsMath)
 
HecMath
 methods, which include 
TimeSeriesMath
 methods, are indexed and described in detail in
the HEC-DSSVue User’s Manual.
 
T
I
M
E
S
E
R
I
E
S
M
A
T
H
 
M
E
T
H
O
D
S
 
H
H
E
E
C
C
M
M
A
A
T
T
H
H
 
 
F
F
U
U
N
N
C
C
T
T
I
I
O
O
N
N
S
S
 
D
A
T
A
C
O
N
T
A
I
N
E
R
 
A
N
D
 
H
E
C
M
A
T
H
 
C
O
M
P
A
R
I
S
O
N
 
H
E
C
T
I
M
E
 
M
E
T
H
O
D
S
 
The 
HecTime
 class and its methods are described in detail in the HEC-DSSVue User’s Manual
(also available from HEC-DSSVue Help menu).
 
H
E
C
T
I
M
E
 
C
L
A
S
S
 
Useful for manipulating timestamps
 
Functions to add/subtract time, compare times, find where a timestamp is on a calendar (e.g. get
month or day of week)
 
Internally wraps an integer (typically minutes since midnight Dec 31
st
 1900)
Integer is what gets stored in 
TimeSeriesContainer.times
Day of midnight value depends on 
TimeSeriesContainer
‘s type
 
H
E
C
T
I
M
E
 
O
B
J
E
C
T
S
 
An 
HecTime
 object represents a specific date and time.
 
HecTime
 objects are initialized to specific resolutions
 
SECOND_INCREMENT
MINUTE_INCREMENT (default)
HOUR_INCREMENT
DAY_INCREMENT
 
The “specific resolution” affects how time is calculated when added and how it is reported.
 
H
E
C
T
I
M
E
 
O
B
J
E
C
T
S
 
H
e
c
T
i
m
e
 
o
b
j
e
c
t
s
 
h
a
v
e
 
a
n
 
i
n
t
e
r
n
a
l
 
v
a
l
u
e
 
t
h
a
t
 
s
p
e
c
i
f
i
e
s
 
t
h
e
 
t
i
m
e
 
a
s
 
a
n
 
o
f
f
s
e
t
 
i
n
 
r
e
s
o
l
u
t
i
o
n
 
u
n
i
t
s
f
r
o
m
 
a
 
b
a
s
e
 
d
a
t
e
.
 
For resolution units of minutes, hours or days, the base date is 31 December 1899 00:00
(Thus, 01Jan1900 at 0000 is day 1).
 
For resolution units of seconds, the base date is 19Jan1970 at 0000 (which is the UNIX 
epoch
).
 
For dates before the base date, the offset is negative.
 
T
h
e
 
H
e
c
T
i
m
e
 
f
o
l
d
e
r
 
i
n
 
t
h
e
 
A
P
I
s
 
t
r
e
e
 
p
r
o
v
i
d
e
s
 
a
 
l
i
s
t
 
o
f
 
t
h
e
 
t
h
e
 
H
e
c
T
i
m
e
 
m
e
t
h
o
d
s
 
a
n
d
 
g
i
v
e
s
 
y
o
u
a
c
c
e
s
s
 
t
o
 
t
h
e
 
j
a
v
a
d
o
c
s
 
f
o
r
 
H
e
c
T
i
m
e
.
 
C
L
A
S
S
E
S
 
W
I
T
H
 
S
I
M
I
L
A
R
 
F
U
N
C
T
I
O
N
A
L
I
T
Y
 
HEC-ResSim’s 
RunTimeStep
 vs 
HecTime
RunTimeStep
 uses integer to track model
timestep
HecTime
 used to manipulate and examine
values
 
HecTime
 vs 
java.time 
or python modules
time
/
datetime
User preference, HecTime expected by
many HEC API calls
Different methods and fields, cannot
substitute one for another in API calls
 
C
L
A
S
S
E
S
 
W
I
T
H
 
S
I
M
I
L
A
R
 
F
U
N
C
T
I
O
N
A
L
I
T
Y
 
TSRecord
 
vs
 
TimeSeriesContainer
 
vs
 
TimeSeriesMath
 
TSRecord
 (interface)
 TSRecordImpl
 (class)
internal to ResSim for model variables and state variables
 
TimeSeriesContainer
 and 
TimeSeriesMath
Inherits from 
DataContainer
 / 
HecMath
Used in DSSVue and other programs
Allow manipulation of values – directly for TSC, or with math functions for TSM
 
R
E
V
I
E
W
 
 
hec.hecmath.DSS 
class to call 
DSS.open(filename)
 
Use this class to manipulate whole files – e.g. bulk copy records
 
read/write HecMath
 to do mathematical operations
 
get/put DataContainer
 (
TimeSeriesContainer
 / 
PairedDataContainer
)
 
to access metadata/values
 
HecTime
 to do calculations with timestamps
Slide Note
Embed
Share

This report delves into the HEC API scripting involving DSS files, DataContainer, HecTime, and HecMath. It covers important classes, accessing files, and the distinction between DataContainers and HecMath objects. Additionally, it compares Python and Java, highlighting their differences in interpreted vs. compiled code, object-oriented programming approaches, and library functionalities. The use of Jython, which compiles Python code into Java byte-code, is also discussed. Detailed information on DSS data formats, pathnames, and ranges is provided, along with insights into the HEC Java API for working with HEC-DSS files, time series data, and more.


Uploaded on May 15, 2024 | 2 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. HEC API SCRIPTING PART 1 AND 2: DSS FILES, DATACONTAINER, HECTIME, HECMATH Evan Heisman, PE Eric Novotny, PhD USACE IWR-HEC The views, opinions and findings contained in this report are those of the authors(s) and should not be construed as an official Department of the Army position, policy or decision, unless so designated by other official documentation.

  2. 2 OUTLINE Overview of HEC DSS API Important Classes Accessing files DataContainers vs HecMath objects HecTime

  3. 3 PYTHON VS JAVA Python is interpreted, compiled to a byte-code at runtime. Java is compiled to a byte-code prior to runtime. Java has a very strict form of Object Oriented Programming (OOP), Python is OOP but lets you easily write functional or procedural code Each has a standard library with helpful functions. Jython has all of Java s, most of Python s.

  4. 4 PYTHON VS JYTHON Jython compiles Python code to Java byte-code, runs inside the Java Virtual Machine Jython uses Python syntax and library Jython 2.5 ~= Python 2.5 Jython 2.7 ~= Python 2.7 Jython has access to Java s libraries Import from Java s library as if Python modules.

  5. 5 DSS DATA FORMATS Pathnames: /A/B/C/D/E/F/ /watershed/location/parameter/date/interval/version/ Watershed (A Part) Often name for a river or blank Location (B Part) physical location (gage name, resv. name) model s location name (junction/node/component name) Parameter (C Part) ELEV, STAGE, STOR, FLOW, FLOW-MAX

  6. 6 DSS DATA FORMATS Range / Date (D Part) For time-series data, the start date of the values or the range of values contained (for a combined record) Interval (E Part) Time step between values, or irregular block size. 1DAY, 1HOUR, IR-DECADE Records broken up differently depending on interval Version (F Part) Usually the source or model the data came from (USGS-RAW, CC:WY1929:RESSIM-FLOODMODEL1)

  7. 7 DSSVUE

  8. 8 SCRIPTING API The HEC Java API used by all HEC Java applications provides common functionality Reading/writing HEC-DSS files Working with time series, gridded data, and rating curves Generating plots and tables Documentation included with HEC-DSSVue at link specified below CWMS-Vue and HEC-DSSVue provides API for accessing user interface and creating plugins Documentation available by selecting Help Help from the menu bar or pressing F1 https://www.hec.usace.army.mil/confluence/dssdocs/dssvueum/ in your default browser HEC-ResSim to build utility scripts in model or to script model behavior in rules and state variables HEC-ResSim-specific API documentation provided in the HEC-ResSim script editor; ResSim JavaDocs CWMS CAVI to access watershed and forecast information, interact w/ user interface, and be executed in the program sequence during forecast computes CWMS CAVI-specific API documentation provided in the CWMS CAVI script editor Other languages with good Java support, like R and Matlab can be linked to it

  9. 9 HEC-DSSVUE AND CWMS-VUE SCRIPTING HEC-DSSVue scripts normally work with data in local HEC-DSS files, but have the full Python- and Java-provided APIs as well as the HEC-provided APIs available to perform any type of task CWMS-Vue scripts have the following additional capabilities when logged in Ability to work with HEC-DSS files on the CWMS server (remote files) Ability to work with data in the CWMS database The DBAPI module provides access to the CWMS database using methods that mimic those used to access HEC-DSS files Online help for scripting with HEC-DSSVue or CWMS-Vue is available by pressing F1 at the main program window or selecting Help Help from the main program window menu bar

  10. 10

  11. 11 HEC CLASSES HecDss dealing with files DataContainer: TimeSeriesContainer timeseries PairedDataContainer - curves HecMath: math operations TimeSeriesMath PairedDataMath HecTime - timestamps Plot and Tablulate create custom plots, adjust properties

  12. 12 DSS (HEC.HECMATH.DSS) To read and write dss files, you must use the the java objects DSS and DSSFile and their methods which were designed to interact with DSS files. To open a DSS file: from hec.hecmath import DSS myFile = DSS.open(str fileName) myFile = DSS.open(str fileName, str timeWindow) # limits to data within timeWindow myFile = DSS.open(str fileName, str startTime, str endTime) # another way Returns a DSSFile object The file handle for the DSSFile opened NOTE DSS is a static class. You do not need to create an object of type hec.hecmath.DSS in order to use it.

  13. TIMESERIESCONTAINER OBJECTS 13 TimeSeriesContainer is a subclass of DataContainer. It is a simple, generic container class that holds time series data and some related information. Since most of the member data is public, the class includes few methods for accessing and manipulating the data. DataContainer and TimeSeriesContainer objects are described in detail in the HEC- DSSVue User s Manual TimeSeriesContainer Data Only Used for Plotting Use get() & put() HecDss methods tsContainer = dssFile.get( /A/B/C/D/E/F/ ) dssFile.put(tsContainer)

  14. 14 TIMESERIESCONTAINER OBJECTS

  15. 15 TIME SERIES CONTAINER TimeSeriesContainers have Properties not Methods: tsc.watershed = Green River tsc.location = OakVile tsc.parameter = Stage tsc.version = OBS tsc.units = FEET tsc.type = INST-VAL tsc.interval = 60 tsc.values = [Values List] tsc.times = [int list from HecTimes] tsc.startTime = times[0] tsc.endTime = times[-1] tsc.numberValues = len(values)

  16. 16 HECMATH OBJECTS AnHecMath object represents data that can be stored in an HEC-DSS file (aka, a dataset). The subclasses of HecMath are: PairedDataMath represents lookup tables (e.g., ratings) TimeSeriesMath represents time series data TimeSeriesMath objects have many methods that allow manipulation or analysis of the whole time series, but they do not allow access to individual data values.4

  17. 17 TIME SERIES MATH Use a TimeSeriesContainer to set the data in a TimeSeriesMath Object: tsMath.setData(tsContainer) TimeSeriesMath objects use Methods: setLocation(string location) setParameter(string parameter) setPathname(string pathname) setTimeInterval(string interval) setType(string type) setUnits(string units) setVersion(string version) setWatershed(string watershed)

  18. 18 HECMATH OBJECTS TimeSeriesMath.getData()returns a reference to the TimeSeriesContainer object contained in the TimeSeriesMath object. NOTE TimeSeriesMath also has a getTimeSeriesContainer() method, but it returns a copy of the data in the TimeSeriesMath object so changes to the copy do not affect the TimeSeriesMath object s data. TimeSeriesMath objects may be created from TimeSeriesContainer objects by using the constructor: tsMath = TimeSeriesMath(tsContainer) TimeSeriesMath Data and Methods Used for Math Functions Use read() & write() HecDss methods tsMath = dssFile.read( /A/B/C/D/E/F/ ) dssFile.write(tsMath)

  19. 19 TIMESERIESMATH METHODS HecMath methods, which include TimeSeriesMath methods, are indexed and described in detail in the HEC-DSSVue User s Manual.

  20. HECMATH FUNCTIONS 20

  21. 21 DATACONTAINER AND HECMATH COMPARISON Read from file Write to file Timeseries series of values with associated timestamps: flow, stage, storage Paired Data paired points or sets of curves, e.g. rating curves stage-damage tables HecMath myFile.read(pathname) myFile.read(pathname, timeWindow) myFile.write(HecMath object) myTsMath = TimeSeriesMath.createInstance(myTSC) # OR myTsMath = TimeSeriesMath() myTsMath.setData(myTSC) myPdMath.interpolate(xVal) Returns HecMath newTsMath = myTsMath.add(otherTsMath) maxVal = newTsMath.max() summaryHydrograph = newTsMath.cyclicAnalysis() DataContainer myFile.get(pathname) myFile.get(pathname, True), whole timeseries if D-part is blank myFile.put(DataContainer object) myTSC = myTsMath.getData() myPDC.xOrdinates = [ ] # single list myTSC.values = [ ] myTSC.times = [ ] myPDC.yOrdinates = [[ ],[ ]] # list of lists Returns DataContainer Can use HecMath constructors and static methods to convert # you could do this maxVal = max(myTSC.values)

  22. 22 HECTIME METHODS The HecTime class and its methods are described in detail in the HEC-DSSVue User s Manual (also available from HEC-DSSVue Help menu).

  23. 23 HECTIME CLASS Useful for manipulating timestamps Functions to add/subtract time, compare times, find where a timestamp is on a calendar (e.g. get month or day of week) Internally wraps an integer (typically minutes since midnight Dec 31st 1900) Integer is what gets stored in TimeSeriesContainer.times Day of midnight value depends on TimeSeriesContainer s type

  24. 24 HECTIME OBJECTS An HecTime object represents a specific date and time. HecTime objects are initialized to specific resolutions SECOND_INCREMENT MINUTE_INCREMENT (default) HOUR_INCREMENT DAY_INCREMENT The specific resolution affects how time is calculated when added and how it is reported. Granularity In Seconds Granularity in Minutes Granularity in Hours Granularity in Days SECOND_INCREMENT 1 MINUTE_INCREMENT 60 1 HOUR_INCREMENT 3600 60 1 DAY_INCREMENT 86400 1440 24 1

  25. 25 HECTIME OBJECTS HecTime objects have an internal value that specifies the time as an offset in resolution units from a base date. For resolution units of minutes, hours or days, the base date is 31 December 1899 00:00 (Thus, 01Jan1900 at 0000 is day 1). For resolution units of seconds, the base date is 19Jan1970 at 0000 (which is the UNIX epoch). For dates before the base date, the offset is negative. The HecTime folder in the APIs tree provides a list of the the HecTime methods and gives you access to the javadocs for HecTime.

  26. 26 CLASSES WITH SIMILAR FUNCTIONALITY HEC-ResSim sRunTimeStep vs HecTime RunTimeStep uses integer to track model timestep HecTime used to manipulate and examine values HecTime vs java.time or python modules time/datetime User preference, HecTime expected by many HEC API calls Different methods and fields, cannot substitute one for another in API calls

  27. 27 CLASSES WITH SIMILAR FUNCTIONALITY TSRecordvsTimeSeriesContainervsTimeSeriesMath TSRecord (interface) TSRecordImpl (class) internal to ResSim for model variables and state variables TimeSeriesContainer and TimeSeriesMath Inherits from DataContainer / HecMath Used in DSSVue and other programs Allow manipulation of values directly for TSC, or with math functions for TSM

  28. 28 REVIEW hec.hecmath.DSS class to call DSS.open(filename) Use this class to manipulate whole files e.g. bulk copy records read/write HecMath to do mathematical operations get/put DataContainer (TimeSeriesContainer / PairedDataContainer) to access metadata/values HecTime to do calculations with timestamps

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#