def __init__(self): # obtain configuration details for HEC applications for # python and jython scripts import hecConfig reload(hecConfig) self.config = hecConfig.HecConfig() print("***********new config***********")
def parent_config(hecConfig): # obtain configuration details for HEC applications for # python and jython scripts # try: # os.remove("hecConfig.pyc") # os.remove("hecConfig$py.class") # except Exception, e: # print("hecConfig.pyc or hecConfig$py.class does not yet exist.") rmCompiled() shutil.copyfile(hecConfig, "hecConfig.py") import hecConfig reload(hecConfig) config = hecConfig.HecConfig() try: os.remove(config.modelVersion + config.parent_hecConfig + ".py") except Exception, e: print(config.parent_hecConfig + ".py has never been copied for this model version.")
#sys.path.append("C:/Program Files (x86)/Java/jdk1.8.0_72/src/java") sys.path.append("C:/Users/nschiff2/Documents/MWRDGC_WSRR/Optimatics/optimizer-hecras-integration/src/HEC-DSSVue/java") sys.path.append("C:/Program Files/Java/javahelp-2.0.05.jar") sys.path.append("C:/Users/nschiff2/Documents/MWRDGC_WSRR/Optimatics/optimizer-hecras-integration/src/HEC-DSSVue/lib") sys.path.append("C:/Users/nschiff2/Documents/MWRDGC_WSRR/Optimatics/optimizer-hecras-integration/src") from hec.script import * from hec.heclib.dss import HecDss from hec.heclib.util import * from hec.io import * import java import pickle import hecConfig reload(hecConfig) config = hecConfig.HecConfig() print("Creating and inserting dummy storage-outflow curves for redeveloped subbasins in " + config.hmsProjectName + "...") try: dtf = open(config.getDataTransferFilePath(),'r+') tableList = pickle.load(dtf) dtf.close() for item in range(len(tableList)): loc = tableList[item][1] watershed = "Testingonly" xParam = "STORAGE" yParam = "FLOW" type= "TABLE" stages = [0, 0.4, 0.5, 1.0, 2.0, 5.0, 10.0, 12.0] flows = [0, 0.1, 3, 11, 57, 235, 1150, 3700] pdc = PairedDataContainer()