#Use ListSelection to open manual data entry dialog and save to mydb.dss

from hec.script import Plot, MessageBox
# from hec.io import TimeSeriesContainer
# from hec.io import PairedDataContainer
# from hec.hecmath import TimeSeriesMath
# from hec.hecmath import PairedDataMath
from hec.heclib.dss import HecDss, DSSPathname
from hec.dssgui import ListSelection
from hec.heclib.util import HecTime
import java
import sys

mw = ListSelection.getMainWindow()
mw.setIsInteractive(1, 0)  # Turn off popups
mw.open(sys.argv[1] + "\\mydb.dss")

time = HecTime()
time.setCurrent()
time.setTime("0800")
time.addDays(-5)

mw.timeSeriesDataEntry("/GREEN/OAK/FLOW//1DAY/OBS", time.dateAndTime(4))
# mw.finish()  # Batch mode only
from hec.heclib.dss import HecDss
from hec.heclib.util import HecTime
from hec.hecmath import TimeSeriesMath
from hec.io import TimeSeriesContainer

# Need to import the ParseMathExpr module. Update this depending on where you stored
# the ParseMathExpr.py script, and make sure this path is on the sys.path
from NWDJyLib import ParseMathExpr

startTW = HecTime()  # Starting time window
endTW = HecTime()  # Ending time window
startTW.setYearMonthDay(1928, 7, 1, 1440)  # July 1st, 1928 at midnight
endTW.setYearMonthDay(2008, 9, 30, 1440)  # September 30th, 2008 at midnight

# Convert to readable string
startTW = startTW.dateAndTime(4).upper()
endTW = endTW.dateAndTime(4).upper()

# Set up DSS file name and open the file
dssInputFileName = "example_input.dss"
dssInputFile = HecDss.open(dssInputFileName)

variables = ["ARDB", "MCDB"]
dssPaths = [
    "//ARROW LAKES_IN/FLOW-UNREG//1DAY/COMPUTED/",
    "/COLUMBIA/MICA_IN/FLOW-IN//1DAY/NWP/"
]

# Load DSS timeseries into TimeSeriesMath objects and place into a  dictionary
inputs = {}
for variable, dssPath in zip(variables, dssPaths):
Example #3
0
        "DSS was unable to open the RAS DSS file. \n The filename provided is: %s \n Please check to see that your RAS project is exporting data to this file!"
        % (dss_filename), "DSS unable to open file!")

dss_file = HecDss.open(dss_filename, start_time, end_time)
try:
    math = dss_file.read(pathname)
    dss_file.done()
    tsc = math.getData()
    values = tsc.values
    times = tsc.times

    time_str = HecTime()
    time_list = []
    for t in times:
        time_str.set(t)
        time_list.append(HecTime.dateAndTime(time_str))

    text_file = open(output_filename, "w")
    text_file.write("Data: \n %s \n" % values)
    text_file.write("Time String: \n %s \n" % time_list)
    text_file.write("Time Minutes: \n %s" % times)
    text_file.close()
except:

    text_file = open(output_filename, "w")
    text_file.write("NO DATA")
    text_file.close()
    MessageBox.showError(
        "DSS was unable to find the path associated with the file. \n The DSS File is: %s \n The Path is: %s \n Please check to see that your DSS file contains the specified path!"
        % (dss_filename, pathname), "DSS unable to find computed path!")