Skip to content

Issues with Vertical Datum and scripts #139

Description

@katfeingold

Districts are having issues running scripts where the vertical datum associated with the TS is blank. This was not an issue until the latest schema update 26.02.17. They are using dbapi in their scripts.

Here is how it was first reported to me:
I'm having trouble generating some plots and tables from scripts. Attached is the biggest display script we run - the python has all the rules for generating plots/tables, with the TSID and formatting rules all in the csv. Plots/tables with flows and stages work fine, but anything with an Elev bombs out.

A successful plot and table give these in the console window:

Creating plot for '5-Day-OpsPlot'
Using time window from config: 12APR2026, 07:06 to 18APR2026, 07:06
Could not get forecast info from CAVI: 'hec2.rts.ui.DataAcqTab' object has no attribute 'getForecast'
Connected to Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production 155.80.183.107:1521:H0CWMSP1 as user H0RBWCK9, office LRD, via SERVER_SUITE_WO_DIALOG
Plot saved to: C:\WM\5-Day-OpsPlot.png

Creating table for 'LowFlow03-WaveTrackerStages'
Using time window from config: 11APR2026, 02:11 to 13APR2026, 14:11
Could not get forecast info from CAVI: 'hec2.rts.ui.DataAcqTab' object has no attribute 'getForecast'
Connected to Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production 155.80.183.107:1521:H0CWMSP1 as user H0RBWCK9, office LRD, via SERVER_SUITE_WO_DIALOG
Table saved to: C:\WM\LowFlowWaveTrackerStages.txt

But if I run anything with an Elev TSID, I get this:

Creating table for 'OperationCoordinationSheet'
Using time window from config: 12APR2026, 07:07 to 19APR2026, 07:07
Could not get forecast info from CAVI: 'hec2.rts.ui.DataAcqTab' object has no attribute 'getForecast'
Connected to Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production 155.80.183.107:1521:H0CWMSP1 as user H0RBWCK9, office LRD, via SERVER_SUITE_WO_DIALOG
uncaughtException:in Thread Thread[AWT-EventQueue-0,6,main] Error:Traceback (most recent call last):
File "", line 520, in
File "", line 216, in create_window
File "", line 367, in create_table
File "", line 180, in _get_timeseries_data
File "", line 180, in _get_timeseries_data
File "", line 180, in _get_timeseries_data
File "pyclasspath/DBAPI.py", line 2646, in get
File "pyclasspath/DBAPI.py", line 2604, in get_1
File "pyclasspath/DBAPI.py", line 2232, in getTimeSeriesContainer
at hec.io.VerticalDatumContainer.setVerticalDatumInfo(VerticalDatumContainer.java:353)
at hec.io.VerticalDatumContainer.(VerticalDatumContainer.java:68)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.python.core.PyReflectedConstructor.constructProxy(PyReflectedConstructor.java:213)
mil.army.usace.hec.metadata.VerticalDatumException: mil.army.usace.hec.metadata.VerticalDatumException: mil.army.usace.hec.metadata.VerticalDatumException: Cannot initialize with element of

Traceback (most recent call last):
File "", line 520, in
File "", line 216, in create_window
File "", line 367, in create_table
File "", line 180, in _get_timeseries_data
File "", line 180, in _get_timeseries_data
File "", line 180, in _get_timeseries_data
File "pyclasspath/DBAPI.py", line 2646, in get
File "pyclasspath/DBAPI.py", line 2604, in get_1
File "pyclasspath/DBAPI.py", line 2232, in getTimeSeriesContainer
at hec.io.VerticalDatumContainer.setVerticalDatumInfo(VerticalDatumContainer.java:353)
at hec.io.VerticalDatumContainer.(VerticalDatumContainer.java:68)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.python.core.PyReflectedConstructor.constructProxy(PyReflectedConstructor.java:213)
mil.army.usace.hec.metadata.VerticalDatumException: mil.army.usace.hec.metadata.VerticalDatumException: mil.army.usace.hec.metadata.VerticalDatumException: Cannot initialize with element of

Gemini said this:
Based on my analysis of the error log and the provided files, the issue appears to be with the metadata of one of the time series being requested from the Oracle database, rather than a bug in the Python script itself.
Analysis of the Error
The key to understanding the problem lies in the error message: mil.army.usace.hec.metadata.VerticalDatumException: Cannot initialize with element of.
Here's a breakdown of what this means:
VerticalDatumException: This error is related to the vertical datum of a time series. A vertical datum is a reference system for elevation or stage data (e.g., feet above sea level). This error indicates that the problem is with a Stage or Elev time series, not a Flow time series.
: In the CWMS database, some time series have their vertical datum set to "NATIVE". This means the data is stored in its original, unreferenced vertical units. The underlying HEC Java library that the script is using to fetch data is unable to process this "NATIVE" datum, which is causing the script to fail.
The error occurs within the _get_timeseries_data function when it tries to fetch data using db.get(tsid). Since the script processes the time series for a given table in the order they appear in the configuration file, the error is triggered by the first time series with this metadata issue.
...and then recommended commenting out Elev lines. That makes it work. If I comment out all Elevs, or replace them with other types of TSID, the tables and plots come up. Any Elev line makes it fail. So far, I've only tested this with Oracle connections, not with similar scripts in a forecast run. The scripts are smart enough to roll through TSIDs that are missing all data, so that's not the issue here. I think something in the schema update may have changed how the get functions are working. I wanted to run this past you before I try writing it all up on Discourse.

Image

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions