diff --git a/district-scripts/SWF/GateFlow5.py b/district-scripts/SWF/GateFlow5.py index f64000c..d0d4e3f 100644 --- a/district-scripts/SWF/GateFlow5.py +++ b/district-scripts/SWF/GateFlow5.py @@ -1,196 +1,206 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -# the gate flow calculations requires a start and end time. -# here we create a java Calendar object that will be used to create the start Date -startCal = Calendar.getInstance(timeZone) -# startCal.clear() -startCal.add(Calendar.DAY_OF_MONTH, -8) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) -# startCal.set(Calendar.YEAR, 2015) -# startCal.set(Calendar.MONTH, 9) - -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance(timeZone) -# endCal.clear() -endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.set(Calendar.HOUR_OF_DAY, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -# endCal.set(Calendar.YEAR, 2015) -# endCal.set(Calendar.MONTH, 11) - -officeID = "SWF" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") -# By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out -# or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate - - -calculateSingleFlowGroups = False -flowGroupGate = "Gated_Total" -flowGroupTotal = "Project_Total" -flowGroupTurbine = "Turbine_Total" -flowGroupPumpOutBelow = "Pump_Out_Below_Total" -flowGroupUncontrol = "Uncontrolled_Total" -flowGroupJSPturbine1 = "Turbine1" -flowGroupJSPturbine2 = "Turbine2" - - -locationList = ["BNBT2", - "GGLT2", - "LEWT2", - "LVNT2", - "SCLT2" - ] -ohit2Group = ["OHIT2"] -# the calculation can also be performed for all the associated groups -# the computeAll method takes: -# officeId -# projectId -# startDate -# endDate -# By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. -# Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. - -calculateAllFlowGroups = True - -FlowGroupList = [ "ACTT2", - "ALAT2", - "BDWT2", - "BLNT2", - "BSLT2", - "CLDL1", - "DAWT2", - "GPET2", - "GNGT2", - "GPVT2", - "HORT2", - "JPLT2", - "JFNT2", - "JSPT2", - "TBLT2", - "PCTT2", - "RRLT2", - "FRHT2", - "SAGT2", - "SMCT2", - "SOMT2", - "STIT2", - "TXKT2", - "WTYT2", - "TRNT2", - "FFLT2", - "EAMT2", - "FLWT2", - "LLST2", - "GBYT2", - "PSMT2", - "SAGT2", - "BPRT2", - "TBRT2", - "MSDT2", - "BNBT2", - "GGLT2", - "LEWT2", - "LVNT2", - "SCLT2", - "OHIT2" - ] - -tempList = ["JFNT2"] - -#if calculateSingleFlowGroups: -# for location in locationList: -# print "Now Running", location, "SINGLE" -# compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupGate) -# compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTotal) -# compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTurbine) -# compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUncontrol) -# compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpOutBelow) -#compute_Single_Flowgroup(officeID, "GGLT2", startCal, endCal, "Spillway GGL_Total") - -if calculateAllFlowGroups: - for location in FlowGroupList: - print "Now Running", location, "GROUP" - compute_All_Flowgroups(officeID, location, startCal, endCal) - -compute_Single_Flowgroup(officeID, "JSPT2", startCal, endCal, "Turbine1") -compute_Single_Flowgroup(officeID, "JSPT2", startCal, endCal, "Turbine2") - - -#if calculateSingleFlowGroups: -# for location in ohit2Group: -# print "Now Running", location, "SINGLE" -# compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTotal) +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + # the gate flow calculations requires a start and end time. + # here we create a java Calendar object that will be used to create the start Date + startCal = Calendar.getInstance(timeZone) + # startCal.clear() + startCal.add(Calendar.DAY_OF_MONTH, -8) + startCal.set(Calendar.HOUR_OF_DAY, 0) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + # startCal.set(Calendar.YEAR, 2015) + # startCal.set(Calendar.MONTH, 9) + + # create a java Calendar object that will be used to create the end Date + endCal = Calendar.getInstance(timeZone) + # endCal.clear() + endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.set(Calendar.HOUR_OF_DAY, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + # endCal.set(Calendar.YEAR, 2015) + # endCal.set(Calendar.MONTH, 11) + + officeID = "SWF" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + # By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out + # or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate + + + calculateSingleFlowGroups = False + flowGroupGate = "Gated_Total" + flowGroupTotal = "Project_Total" + flowGroupTurbine = "Turbine_Total" + flowGroupPumpOutBelow = "Pump_Out_Below_Total" + flowGroupUncontrol = "Uncontrolled_Total" + flowGroupJSPturbine1 = "Turbine1" + flowGroupJSPturbine2 = "Turbine2" + + + locationList = ["BNBT2", + "GGLT2", + "LEWT2", + "LVNT2", + "SCLT2" + ] + ohit2Group = ["OHIT2"] + # the calculation can also be performed for all the associated groups + # the computeAll method takes: + # officeId + # projectId + # startDate + # endDate + # By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. + # Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. + + calculateAllFlowGroups = True + + FlowGroupList = [ "ACTT2", + "ALAT2", + "BDWT2", + "BLNT2", + "BSLT2", + "CLDL1", + "DAWT2", + "GPET2", + "GNGT2", + "GPVT2", + "HORT2", + "JPLT2", + "JFNT2", + "JSPT2", + "TBLT2", + "PCTT2", + "RRLT2", + "FRHT2", + "SAGT2", + "SMCT2", + "SOMT2", + "STIT2", + "TXKT2", + "WTYT2", + "TRNT2", + "FFLT2", + "EAMT2", + "FLWT2", + "LLST2", + "GBYT2", + "PSMT2", + "SAGT2", + "BPRT2", + "TBRT2", + "MSDT2", + "BNBT2", + "GGLT2", + "LEWT2", + "LVNT2", + "SCLT2", + "OHIT2" + ] + + tempList = ["JFNT2"] + + #if calculateSingleFlowGroups: + # for location in locationList: + # print "Now Running", location, "SINGLE" + # compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupGate) + # compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTotal) + # compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTurbine) + # compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUncontrol) + # compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpOutBelow) + #compute_Single_Flowgroup(officeID, "GGLT2", startCal, endCal, "Spillway GGL_Total") + + if calculateAllFlowGroups: + for location in FlowGroupList: + print("Now Running", location, "GROUP") + compute_All_Flowgroups(officeID, location, startCal, endCal) + + compute_Single_Flowgroup(officeID, "JSPT2", startCal, endCal, "Turbine1") + compute_Single_Flowgroup(officeID, "JSPT2", startCal, endCal, "Turbine2") + + + #if calculateSingleFlowGroups: + # for location in ohit2Group: + # print "Now Running", location, "SINGLE" + # compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTotal) + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWF/GateFlow_MonthlyPumpBackFill.py b/district-scripts/SWF/GateFlow_MonthlyPumpBackFill.py index 704ef93..7bb1ae5 100644 --- a/district-scripts/SWF/GateFlow_MonthlyPumpBackFill.py +++ b/district-scripts/SWF/GateFlow_MonthlyPumpBackFill.py @@ -1,202 +1,212 @@ -from java.util import Calendar -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# the gate flow calculations requires a start and end time. -# here we create a java Calendar object that will be used to create the start Date -startCal = Calendar.getInstance() -# startCal.clear() -startCal.set(Calendar.HOUR, 0) ### set startCal hour/minute/second/millisecond to 0 for midnight -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) -startCal.add(Calendar.YEAR, -1) ### go back one year to today -startCal.set(Calendar.MONTH, 9) ### change month to month 9 (october) -startCal.set(Calendar.DAY_OF_MONTH, 1) ### change start date to start of the month day 1 - -getYear = startCal.get(Calendar.YEAR) ### get value of startCal year/month/day to print and to initilize endCal -getMonth = startCal.get(Calendar.MONTH) -getDayofMonth = startCal.get(Calendar.DAY_OF_MONTH) - -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance() -# endCal.clear() -endCal.set(Calendar.HOUR, 0) ### set endCal hour/minute/second/millisecond to 0 for midnight -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -###endCal will be set to current date unless reset with the following 4 lines -#endCal.set(Calendar.YEAR, getYear) ### set endCal year same as startCal -#endCal.set(Calendar.MONTH, getMonth) ### set endCal month same as startCal -#endCal.add(Calendar.MONTH, 12) ##add 1 month to startcal month -#endCal.set(Calendar.DAY_OF_MONTH, 1) ### set to day one - -### time window starts 01Feb2019(one year ago) and ends 01Mar2019 (one year ago plus one month) - -getEndDay = endCal.get(Calendar.DAY_OF_MONTH) -getEndYear = endCal.get(Calendar.YEAR) -getEndMonth = endCal.get(Calendar.MONTH) - - -officeID = "SWF" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") -# By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out -# or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate -# by changing the "flowGroup" variable. -calculateSingleFlowGroups = True -flowGroupGate = "ConduitGate_Total" -flowGroupTotal = "Project_Total" -flowGroupTurbine = "Turbine_Total" -flowGroupPumpOutBelow = "Pump_Out_Below_Total" -flowGroupPumpOut = "Pump_Out_Total" -flowGroupPumpIn = "Pump_In_Total" -flowGroupUncontrol = "Uncontrolled_Total" - -locationList = [ - "ACTT2", - "ALAT2", - "BDWT2", - "BLNT2", - "BNBT2", - "DAWT2", - "GGLT2", - "GNGT2", - "GPVT2", - "HORT2", - "JFNT2", - "HORT2", - "JPLT2", - "LEWT2", - "LVNT2", - "PCTT2", - "RRLT2", - "SCLT2", - "SMCT2", - "SOMT2", - "STIT2", - "TXKT2", - "SAGT2", - "BCAT2", - "WTYT2" - ] - -# the calculation can also be performed for all the associated groups -# the computeAll method takes: -# officeId -# projectId -# startDate -# endDate -# By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. -# Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. - -calculateAllFlowGroups = False -FlowGroupList = [ - "ACTT2", - "ALAT2", - "BDWT2", - "BLNT2", - "BNBT2", - "DAWT2", - "GGLT2", - "GNGT2", - "GPVT2", - "HORT2", - "JFNT2", - "HORT2", - "JPLT2", - "LEWT2", - "LVNT2", - "PCTT2", - "RRLT2", - "SCLT2", - "SMCT2", - "SOMT2", - "STIT2", - "TXKT2", - "BCAT2", - "SAGT2", - "WTYT2" - ] - - -if calculateSingleFlowGroups: - for location in locationList: - print "Now Running", location, "SINGLE" - #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupGate) - #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTotal) - #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTurbine) - #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUncontrol) - #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpOutBelow) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpOut) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpIn) -if calculateAllFlowGroups: - for location in FlowGroupList: - print "Now Running", location, "GROUP" - #compute_All_Flowgroups(officeID, location, startCal, endCal) - - - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # the gate flow calculations requires a start and end time. + # here we create a java Calendar object that will be used to create the start Date + startCal = Calendar.getInstance() + # startCal.clear() + startCal.set(Calendar.HOUR, 0) ### set startCal hour/minute/second/millisecond to 0 for midnight + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + startCal.add(Calendar.YEAR, -1) ### go back one year to today + startCal.set(Calendar.MONTH, 9) ### change month to month 9 (october) + startCal.set(Calendar.DAY_OF_MONTH, 1) ### change start date to start of the month day 1 + + getYear = startCal.get(Calendar.YEAR) ### get value of startCal year/month/day to print and to initilize endCal + getMonth = startCal.get(Calendar.MONTH) + getDayofMonth = startCal.get(Calendar.DAY_OF_MONTH) + + # create a java Calendar object that will be used to create the end Date + endCal = Calendar.getInstance() + # endCal.clear() + endCal.set(Calendar.HOUR, 0) ### set endCal hour/minute/second/millisecond to 0 for midnight + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + ###endCal will be set to current date unless reset with the following 4 lines + #endCal.set(Calendar.YEAR, getYear) ### set endCal year same as startCal + #endCal.set(Calendar.MONTH, getMonth) ### set endCal month same as startCal + #endCal.add(Calendar.MONTH, 12) ##add 1 month to startcal month + #endCal.set(Calendar.DAY_OF_MONTH, 1) ### set to day one + + ### time window starts 01Feb2019(one year ago) and ends 01Mar2019 (one year ago plus one month) + + getEndDay = endCal.get(Calendar.DAY_OF_MONTH) + getEndYear = endCal.get(Calendar.YEAR) + getEndMonth = endCal.get(Calendar.MONTH) + + + officeID = "SWF" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + # By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out + # or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate + # by changing the "flowGroup" variable. + calculateSingleFlowGroups = True + flowGroupGate = "ConduitGate_Total" + flowGroupTotal = "Project_Total" + flowGroupTurbine = "Turbine_Total" + flowGroupPumpOutBelow = "Pump_Out_Below_Total" + flowGroupPumpOut = "Pump_Out_Total" + flowGroupPumpIn = "Pump_In_Total" + flowGroupUncontrol = "Uncontrolled_Total" + + locationList = [ + "ACTT2", + "ALAT2", + "BDWT2", + "BLNT2", + "BNBT2", + "DAWT2", + "GGLT2", + "GNGT2", + "GPVT2", + "HORT2", + "JFNT2", + "HORT2", + "JPLT2", + "LEWT2", + "LVNT2", + "PCTT2", + "RRLT2", + "SCLT2", + "SMCT2", + "SOMT2", + "STIT2", + "TXKT2", + "SAGT2", + "BCAT2", + "WTYT2" + ] + + # the calculation can also be performed for all the associated groups + # the computeAll method takes: + # officeId + # projectId + # startDate + # endDate + # By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. + # Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. + + calculateAllFlowGroups = False + FlowGroupList = [ + "ACTT2", + "ALAT2", + "BDWT2", + "BLNT2", + "BNBT2", + "DAWT2", + "GGLT2", + "GNGT2", + "GPVT2", + "HORT2", + "JFNT2", + "HORT2", + "JPLT2", + "LEWT2", + "LVNT2", + "PCTT2", + "RRLT2", + "SCLT2", + "SMCT2", + "SOMT2", + "STIT2", + "TXKT2", + "BCAT2", + "SAGT2", + "WTYT2" + ] + + + if calculateSingleFlowGroups: + for location in locationList: + print("Now Running", location, "SINGLE") + #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupGate) + #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTotal) + #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTurbine) + #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUncontrol) + #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpOutBelow) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpOut) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpIn) + if calculateAllFlowGroups: + for location in FlowGroupList: + print("Now Running", location, "GROUP") + #compute_All_Flowgroups(officeID, location, startCal, endCal) + + + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWF/GateFlow_PumpBackFill.py b/district-scripts/SWF/GateFlow_PumpBackFill.py index cb5b818..bc58977 100644 --- a/district-scripts/SWF/GateFlow_PumpBackFill.py +++ b/district-scripts/SWF/GateFlow_PumpBackFill.py @@ -1,186 +1,196 @@ -from java.util import Calendar -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# the gate flow calculations requires a start and end time. -# here we create a java Calendar object that will be used to create the start Date -startCal = Calendar.getInstance() -# startCal.clear() -startCal.add(Calendar.DAY_OF_MONTH, -1) -startCal.set(Calendar.HOUR, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) -# startCal.set(Calendar.YEAR, 2015) -# startCal.set(Calendar.MONTH, 9) - -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance() -# endCal.clear() -endCal.add(Calendar.DAY_OF_MONTH, 0) -endCal.set(Calendar.HOUR, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -# endCal.set(Calendar.YEAR, 2015) -# endCal.set(Calendar.MONTH, 11) - -officeID = "SWF" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") -# By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out -# or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate -# by changing the "flowGroup" variable. -calculateSingleFlowGroups = True -flowGroupGate = "ConduitGate_Total" -flowGroupTotal = "Project_Total" -flowGroupTurbine = "Turbine_Total" -flowGroupPumpOutBelow = "Pump_Out_Below_Total" -flowGroupPumpOut = "Pump_Out_Total" -flowGroupPumpIn = "Pump_In_Total" -flowGroupUncontrol = "Uncontrolled_Total" -flowGroupNTMWD = "Pump_NTMWD" -flowGroupUTRWD = "Pump_UTRWD" -flowGroupSS= "Pump_Sulphur_Springs" -flowGroupIrving = "Pump_Irving" -flowGroupLewisville = "Lewisville" -flowGroupUTRWD_Out = "UTRWD_Out" -flowGroupUTRWD_In = "UTRWD_In" -flowGroupIrv = "Irving" -flowGroupDenton = "Denton" -flowGroupBenbrook = "Benbrook" -flowGroupTRWD = "TRWD" -flowGroupWeatherford = "Weatherford" -flowGroupGeorgetown = "Georgetown" -flowGroupRound_Rock = "Round_Rock" -flowGroupBrushy_Ck = "Brushy_Ck" -flowGroupNTMWD_LVN = "NTMWD" -flowGroupCooper = "Cooper" -flowGroupEast_Fork = "East_Fork" -flowGroupTawakoni = "Tawakoni" - - -locationList = ["BNBT2", - "GGLT2", - "LEWT2", - "LVNT2", - "SCLT2" - ] - -# the calculation can also be performed for all the associated groups -# the computeAll method takes: -# officeId -# projectId -# startDate -# endDate -# By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. -# Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. - -calculateAllFlowGroups = False -FlowGroupList = ["BNBT2", - "GGLT2", - "LEWT2", - "LVNT2", - "SCLT2" - ] - - -if calculateSingleFlowGroups: - for location in locationList: - print "Now Running", location, "SINGLE" - #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupGate) - #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTotal) - #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTurbine) - #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUncontrol) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpOutBelow) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpOut) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpIn) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupNTMWD) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUTRWD) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupSS) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupIrving) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupLewisville) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUTRWD_Out) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUTRWD_In) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupIrv) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupDenton) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupBenbrook) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTRWD) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupWeatherford) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupGeorgetown) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupRound_Rock) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupBrushy_Ck) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupNTMWD_LVN) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupCooper) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupEast_Fork) - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTawakoni) -if calculateAllFlowGroups: - for location in FlowGroupList: - print "Now Running", location, "GROUP" - #compute_All_Flowgroups(officeID, location, startCal, endCal) - - - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # the gate flow calculations requires a start and end time. + # here we create a java Calendar object that will be used to create the start Date + startCal = Calendar.getInstance() + # startCal.clear() + startCal.add(Calendar.DAY_OF_MONTH, -1) + startCal.set(Calendar.HOUR, 0) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + # startCal.set(Calendar.YEAR, 2015) + # startCal.set(Calendar.MONTH, 9) + + # create a java Calendar object that will be used to create the end Date + endCal = Calendar.getInstance() + # endCal.clear() + endCal.add(Calendar.DAY_OF_MONTH, 0) + endCal.set(Calendar.HOUR, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + # endCal.set(Calendar.YEAR, 2015) + # endCal.set(Calendar.MONTH, 11) + + officeID = "SWF" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + # By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out + # or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate + # by changing the "flowGroup" variable. + calculateSingleFlowGroups = True + flowGroupGate = "ConduitGate_Total" + flowGroupTotal = "Project_Total" + flowGroupTurbine = "Turbine_Total" + flowGroupPumpOutBelow = "Pump_Out_Below_Total" + flowGroupPumpOut = "Pump_Out_Total" + flowGroupPumpIn = "Pump_In_Total" + flowGroupUncontrol = "Uncontrolled_Total" + flowGroupNTMWD = "Pump_NTMWD" + flowGroupUTRWD = "Pump_UTRWD" + flowGroupSS= "Pump_Sulphur_Springs" + flowGroupIrving = "Pump_Irving" + flowGroupLewisville = "Lewisville" + flowGroupUTRWD_Out = "UTRWD_Out" + flowGroupUTRWD_In = "UTRWD_In" + flowGroupIrv = "Irving" + flowGroupDenton = "Denton" + flowGroupBenbrook = "Benbrook" + flowGroupTRWD = "TRWD" + flowGroupWeatherford = "Weatherford" + flowGroupGeorgetown = "Georgetown" + flowGroupRound_Rock = "Round_Rock" + flowGroupBrushy_Ck = "Brushy_Ck" + flowGroupNTMWD_LVN = "NTMWD" + flowGroupCooper = "Cooper" + flowGroupEast_Fork = "East_Fork" + flowGroupTawakoni = "Tawakoni" + + + locationList = ["BNBT2", + "GGLT2", + "LEWT2", + "LVNT2", + "SCLT2" + ] + + # the calculation can also be performed for all the associated groups + # the computeAll method takes: + # officeId + # projectId + # startDate + # endDate + # By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. + # Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. + + calculateAllFlowGroups = False + FlowGroupList = ["BNBT2", + "GGLT2", + "LEWT2", + "LVNT2", + "SCLT2" + ] + + + if calculateSingleFlowGroups: + for location in locationList: + print("Now Running", location, "SINGLE") + #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupGate) + #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTotal) + #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTurbine) + #compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUncontrol) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpOutBelow) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpOut) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupPumpIn) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupNTMWD) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUTRWD) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupSS) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupIrving) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupLewisville) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUTRWD_Out) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupUTRWD_In) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupIrv) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupDenton) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupBenbrook) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTRWD) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupWeatherford) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupGeorgetown) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupRound_Rock) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupBrushy_Ck) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupNTMWD_LVN) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupCooper) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupEast_Fork) + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroupTawakoni) + if calculateAllFlowGroups: + for location in FlowGroupList: + print("Now Running", location, "GROUP") + #compute_All_Flowgroups(officeID, location, startCal, endCal) + + + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWF/GateSettings.py b/district-scripts/SWF/GateSettings.py index 1a0a938..b94e476 100644 --- a/district-scripts/SWF/GateSettings.py +++ b/district-scripts/SWF/GateSettings.py @@ -1,79 +1,89 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from usace.rowcps.headless import LoggingOptions - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Gate Settings object -gateSettings = registry.getCalculation(1.0, "Gate Settings") - -# configure the start calendar -startCal = Calendar.getInstance() -#startCal.clear() -startCal.add(Calendar.DAY_OF_MONTH, -5) -startCal.set(Calendar.HOUR, 0) ######use Calendar.HOUR_OF_DAY -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance() -endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.set(Calendar.HOUR, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -#endCal.clear() -#endCal.set(Calendar.YEAR, 2016) -#endCal.set(Calendar.MONTH, 4) - - -# gateSettings contains four callable methods -# void createGateSettings(String officeId, String locationStr, Date startDate, Date end) throws Exception; -# void createGateSettingsGroup(String officeId, String locationStr, Date startDate, Date end, String groupId) throws Exception; -# void createGateSettingsOutlet(String officeId, String locationStr, Date startDate, Date end, String outletId) throws Exception; -# void createGateSettingsOutletFromTs(String officeId, String locationStr, Date startDate, Date end, String outletId, String tsId) throws Exception; - -gateSettings.createGateSettingsOutletFromTs("SWF", "FFLT2", startCal.getTime(), endCal.getTime(), "Release", "FFLT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) -gateSettings.createGateSettingsOutletFromTs("SWF", "EAMT2", startCal.getTime(), endCal.getTime(), "Release", "EAMT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) -gateSettings.createGateSettingsOutletFromTs("SWF", "TRNT2", startCal.getTime(), endCal.getTime(), "Release", "TRNT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) -gateSettings.createGateSettingsOutletFromTs("SWF", "BPRT2", startCal.getTime(), endCal.getTime(), "Release", "BPRT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) -gateSettings.createGateSettingsOutletFromTs("SWF", "LLST2", startCal.getTime(), endCal.getTime(), "Release", "LLST2.Opening.Const.0.0.Rev-BRA-Decodes" ) -gateSettings.createGateSettingsOutletFromTs("SWF", "GBYT2", startCal.getTime(), endCal.getTime(), "Release", "GBYT2.Opening.Const.0.0.Rev-BRA-Decodes" ) -gateSettings.createGateSettingsOutletFromTs("SWF", "PSMT2", startCal.getTime(), endCal.getTime(), "Release", "PSMT2.Opening.Const.0.0.Rev-BRA-Decodes" ) -gateSettings.createGateSettingsOutletFromTs("SWF", "MSDT2", startCal.getTime(), endCal.getTime(), "Release", "MSDT2.Opening.Const.0.0.Rev-LCRA-Decodes" ) -gateSettings.createGateSettingsOutletFromTs("SWF", "FRHT2", startCal.getTime(), endCal.getTime(), "Release", "FRHT2.Opening.Const.0.0.Raw-Observer" ) -gateSettings.createGateSettingsOutletFromTs("SWF", "GPET2", startCal.getTime(), endCal.getTime(), "Release", "GPET2.Opening.Const.0.0.Raw-Observer" ) +from regi_python import regi_session, run_headless +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + # the java Calendar class is used to create java Date objects + from java.util import Calendar + from usace.rowcps.headless import LoggingOptions + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # this gets a scriptable Gate Settings object + gateSettings = registry.getCalculation(1.0, "Gate Settings") + + # configure the start calendar + startCal = Calendar.getInstance() + #startCal.clear() + startCal.add(Calendar.DAY_OF_MONTH, -5) + startCal.set(Calendar.HOUR, 0) ######use Calendar.HOUR_OF_DAY + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + # create a java Calendar object that will be used to create the end Date + endCal = Calendar.getInstance() + endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.set(Calendar.HOUR, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + #endCal.clear() + #endCal.set(Calendar.YEAR, 2016) + #endCal.set(Calendar.MONTH, 4) + + + # gateSettings contains four callable methods + # void createGateSettings(String officeId, String locationStr, Date startDate, Date end) throws Exception; + # void createGateSettingsGroup(String officeId, String locationStr, Date startDate, Date end, String groupId) throws Exception; + # void createGateSettingsOutlet(String officeId, String locationStr, Date startDate, Date end, String outletId) throws Exception; + # void createGateSettingsOutletFromTs(String officeId, String locationStr, Date startDate, Date end, String outletId, String tsId) throws Exception; + + gateSettings.createGateSettingsOutletFromTs("SWF", "FFLT2", startCal.getTime(), endCal.getTime(), "Release", "FFLT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) + gateSettings.createGateSettingsOutletFromTs("SWF", "EAMT2", startCal.getTime(), endCal.getTime(), "Release", "EAMT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) + gateSettings.createGateSettingsOutletFromTs("SWF", "TRNT2", startCal.getTime(), endCal.getTime(), "Release", "TRNT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) + gateSettings.createGateSettingsOutletFromTs("SWF", "BPRT2", startCal.getTime(), endCal.getTime(), "Release", "BPRT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) + gateSettings.createGateSettingsOutletFromTs("SWF", "LLST2", startCal.getTime(), endCal.getTime(), "Release", "LLST2.Opening.Const.0.0.Rev-BRA-Decodes" ) + gateSettings.createGateSettingsOutletFromTs("SWF", "GBYT2", startCal.getTime(), endCal.getTime(), "Release", "GBYT2.Opening.Const.0.0.Rev-BRA-Decodes" ) + gateSettings.createGateSettingsOutletFromTs("SWF", "PSMT2", startCal.getTime(), endCal.getTime(), "Release", "PSMT2.Opening.Const.0.0.Rev-BRA-Decodes" ) + gateSettings.createGateSettingsOutletFromTs("SWF", "MSDT2", startCal.getTime(), endCal.getTime(), "Release", "MSDT2.Opening.Const.0.0.Rev-LCRA-Decodes" ) + gateSettings.createGateSettingsOutletFromTs("SWF", "FRHT2", startCal.getTime(), endCal.getTime(), "Release", "FRHT2.Opening.Const.0.0.Raw-Observer" ) + gateSettings.createGateSettingsOutletFromTs("SWF", "GPET2", startCal.getTime(), endCal.getTime(), "Release", "GPET2.Opening.Const.0.0.Raw-Observer" ) + + + + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWF/InflowCalcComputeEvapAsFlow.py b/district-scripts/SWF/InflowCalcComputeEvapAsFlow.py index 589a7f6..fd6f4e3 100644 --- a/district-scripts/SWF/InflowCalcComputeEvapAsFlow.py +++ b/district-scripts/SWF/InflowCalcComputeEvapAsFlow.py @@ -1,49 +1,59 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone - - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar -##startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -## -## -##startCal.clear() -##startCal.set(Calendar.YEAR, 2018) -##startCal.set(Calendar.MONTH, 11) -## -##endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -##endCal.clear() -##endCal.set(Calendar.YEAR, 2019) -##endCal.set(Calendar.MONTH, 0) -##endCal.set(Calendar.DAY_OF_MONTH, 7) - -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -# startCal.clear() -startCal.add(Calendar.DAY_OF_MONTH, -5) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) -# startCal.set(Calendar.YEAR, 2015) -# startCal.set(Calendar.MONTH, 9) - -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -# endCal.clear() -endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.set(Calendar.HOUR_OF_DAY, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) - -locationList = ["WTYT2","JSPT2","TBLT2","SCLT2","TXKT2","BSLT2","JFNT2","CLDL1", - "BPRT2","EAMT2","FLWT2","BNBT2","JPLT2","GPET2","RRLT2","LEWT2", - "GPVT2","LVNT2","FRHT2","TRNT2","DAWT2","BDWT2","FFLT2","PSMT2", - "GBYT2","ALAT2","ACTT2","PCTT2","BLNT2","STIT2","GGLT2","GNGT2", - "SOMT2","LLST2","TBRT2","SAGT2","HORT2","MSDT2","SMCT2"] - -for loc in locationList: - inflowCalc.computeEvapAsFlow("SWF", loc, startCal.getTime(), endCal.getTime()) +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + # the java Calendar class is used to create java Date objects + from java.util import Calendar + from java.util import TimeZone + + + # this gets a ScriptableInflow instance. + inflowCalc = registry.getCalculation(1.0, "Inflow") + + # configure the start calendar + ##startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + ## + ## + ##startCal.clear() + ##startCal.set(Calendar.YEAR, 2018) + ##startCal.set(Calendar.MONTH, 11) + ## + ##endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + ##endCal.clear() + ##endCal.set(Calendar.YEAR, 2019) + ##endCal.set(Calendar.MONTH, 0) + ##endCal.set(Calendar.DAY_OF_MONTH, 7) + + startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + # startCal.clear() + startCal.add(Calendar.DAY_OF_MONTH, -5) + startCal.set(Calendar.HOUR_OF_DAY, 0) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + # startCal.set(Calendar.YEAR, 2015) + # startCal.set(Calendar.MONTH, 9) + + # create a java Calendar object that will be used to create the end Date + endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + # endCal.clear() + endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.set(Calendar.HOUR_OF_DAY, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + + locationList = ["WTYT2","JSPT2","TBLT2","SCLT2","TXKT2","BSLT2","JFNT2","CLDL1", + "BPRT2","EAMT2","FLWT2","BNBT2","JPLT2","GPET2","RRLT2","LEWT2", + "GPVT2","LVNT2","FRHT2","TRNT2","DAWT2","BDWT2","FFLT2","PSMT2", + "GBYT2","ALAT2","ACTT2","PCTT2","BLNT2","STIT2","GGLT2","GNGT2", + "SOMT2","LLST2","TBRT2","SAGT2","HORT2","MSDT2","SMCT2"] + + for loc in locationList: + inflowCalc.computeEvapAsFlow("SWF", loc, startCal.getTime(), endCal.getTime()) + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWF/InflowCalcComputedInflow.py b/district-scripts/SWF/InflowCalcComputedInflow.py index ff2e4d9..99d5331 100644 --- a/district-scripts/SWF/InflowCalcComputedInflow.py +++ b/district-scripts/SWF/InflowCalcComputedInflow.py @@ -1,64 +1,74 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.calculator.inflow import InflowComputationStorageOption +from regi_python import regi_session, run_headless -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") -# configure the start calendar -##startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -## -## -##startCal.clear() -##startCal.set(Calendar.YEAR, 2019) -##startCal.set(Calendar.MONTH, 1) -## -##endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -##endCal.clear() -##endCal.set(Calendar.YEAR, 2019) -##endCal.set(Calendar.MONTH, 1) -##endCal.set(Calendar.DAY_OF_MONTH, 4) +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + # the java Calendar class is used to create java Date objects + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless.calculator.inflow import InflowComputationStorageOption -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -startCal.add(Calendar.DAY_OF_MONTH, -4) -startCal.set(Calendar.HOUR, 0) ######use Calendar.HOUR_OF_DAY -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.set(Calendar.HOUR, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) + # this gets a ScriptableInflow instance. + inflowCalc = registry.getCalculation(1.0, "Inflow") -# inflowCalc includes a setComputationStorageOptions function, which takes in either one or many -# InflowComputationStorageOption values. This is used by computeInflow to determine if it should save additional -# computed values like evaporation as flow and project releases. -# -# The InflowComputationStorageOption enum contains two values: -# EVAP_AS_FLOW -# PROJECT_RELEASES -# -# None is supported by setComputationStorageOptions as well, and clears out all storage options. -# -# inflowCalc.setComputationStorageOptions is entirely optional, and if it's not used no additional computed values will -# be stored with the computed inflow -# -# Example uses: -#inflowCalc.setComputationStorageOptions(None) -#inflowCalc.setComputationStorageOptions(InflowComputationStorageOption.EVAP_AS_FLOW) -#inflowCalc.setComputationStorageOptions(InflowComputationStorageOption.PROJECT_RELEASES) + # configure the start calendar + ##startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + ## + ## + ##startCal.clear() + ##startCal.set(Calendar.YEAR, 2019) + ##startCal.set(Calendar.MONTH, 1) + ## + ##endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + ##endCal.clear() + ##endCal.set(Calendar.YEAR, 2019) + ##endCal.set(Calendar.MONTH, 1) + ##endCal.set(Calendar.DAY_OF_MONTH, 4) -#inflowCalc.setComputationStorageOptions(InflowComputationStorageOption.EVAP_AS_FLOW, InflowComputationStorageOption.PROJECT_RELEASES) + startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + startCal.add(Calendar.DAY_OF_MONTH, -4) + startCal.set(Calendar.HOUR, 0) ######use Calendar.HOUR_OF_DAY + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + # create a java Calendar object that will be used to create the end Date + endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.set(Calendar.HOUR, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + # inflowCalc includes a setComputationStorageOptions function, which takes in either one or many + # InflowComputationStorageOption values. This is used by computeInflow to determine if it should save additional + # computed values like evaporation as flow and project releases. + # + # The InflowComputationStorageOption enum contains two values: + # EVAP_AS_FLOW + # PROJECT_RELEASES + # + # None is supported by setComputationStorageOptions as well, and clears out all storage options. + # + # inflowCalc.setComputationStorageOptions is entirely optional, and if it's not used no additional computed values will + # be stored with the computed inflow + # + # Example uses: + #inflowCalc.setComputationStorageOptions(None) + #inflowCalc.setComputationStorageOptions(InflowComputationStorageOption.EVAP_AS_FLOW) + #inflowCalc.setComputationStorageOptions(InflowComputationStorageOption.PROJECT_RELEASES) -locationList = ["WTYT2","JSPT2","TBLT2","SCLT2","TXKT2","BSLT2","JFNT2","CLDL1", - "BPRT2","EAMT2","FLWT2","BNBT2","JPLT2","GPET2","RRLT2","LEWT2", - "GPVT2","LVNT2","FRHT2","TRNT2","DAWT2","BDWT2","FFLT2","PSMT2", - "GBYT2","ALAT2","ACTT2","PCTT2","BLNT2","STIT2","GGLT2","GNGT2", - "SOMT2","LLST2","TBRT2","SAGT2","HORT2","SMCT2","MSDT2"] -for loc in locationList: - inflowCalc.computeInflow("SWF", loc, startCal.getTime(), endCal.getTime()) + #inflowCalc.setComputationStorageOptions(InflowComputationStorageOption.EVAP_AS_FLOW, InflowComputationStorageOption.PROJECT_RELEASES) + + + locationList = ["WTYT2","JSPT2","TBLT2","SCLT2","TXKT2","BSLT2","JFNT2","CLDL1", + "BPRT2","EAMT2","FLWT2","BNBT2","JPLT2","GPET2","RRLT2","LEWT2", + "GPVT2","LVNT2","FRHT2","TRNT2","DAWT2","BDWT2","FFLT2","PSMT2", + "GBYT2","ALAT2","ACTT2","PCTT2","BLNT2","STIT2","GGLT2","GNGT2", + "SOMT2","LLST2","TBRT2","SAGT2","HORT2","SMCT2","MSDT2"] + for loc in locationList: + inflowCalc.computeInflow("SWF", loc, startCal.getTime(), endCal.getTime()) + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWL/Big3-GateFlow.py b/district-scripts/SWL/Big3-GateFlow.py index bc72ce4..3b09287 100644 --- a/district-scripts/SWL/Big3-GateFlow.py +++ b/district-scripts/SWL/Big3-GateFlow.py @@ -1,134 +1,144 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -# the gate flow calculations requires a start and end time. -# here we create a java Calendar object that will be used to create the start Date -startCal = Calendar.getInstance(timeZone) -# startCal.clear() -startCal.add(Calendar.DAY_OF_MONTH, -5) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -# startCal.set(Calendar.YEAR, 2015) -# startCal.set(Calendar.MONTH, 9) -startCal.set(Calendar.MILLISECOND, 0) - -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance(timeZone) -# endCal.clear() -##################endCal.add(Calendar.DAY_OF_MONTH, 5) -endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.set(Calendar.HOUR_OF_DAY, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -# endCal.set(Calendar.YEAR, 2015) -# endCal.set(Calendar.MONTH, 11) -endCal.set(Calendar.MILLISECOND, 0) - -officeID = "SWL" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") -# By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out -# or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate -# by changing the "flowGroup" variable. -calculateSingleFlowGroups = False -flowGroup = "ConduitGate_Total" -locationList = ["ACTT2", -# "MSDT2", - ] - -# the calculation can also be performed for all the associated groups -# the computeAll method takes: -# officeId -# projectId -# startDate -# endDate -# By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. -# Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. - -calculateAllFlowGroups = True -FlowGroupList = ["Blue_Mtn_Dam", - "Nimrod_Dam", - "Clearwater_Dam", - ] - - -if calculateSingleFlowGroups: - for location in locationList: - print "Now Running", location, "SINGLE" - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup) - -if calculateAllFlowGroups: - for location in FlowGroupList: - print "Now Running", location, "GROUP" - compute_All_Flowgroups(officeID, location, startCal, endCal) - - - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + # the gate flow calculations requires a start and end time. + # here we create a java Calendar object that will be used to create the start Date + startCal = Calendar.getInstance(timeZone) + # startCal.clear() + startCal.add(Calendar.DAY_OF_MONTH, -5) + startCal.set(Calendar.HOUR_OF_DAY, 0) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + # startCal.set(Calendar.YEAR, 2015) + # startCal.set(Calendar.MONTH, 9) + startCal.set(Calendar.MILLISECOND, 0) + + # create a java Calendar object that will be used to create the end Date + endCal = Calendar.getInstance(timeZone) + # endCal.clear() + ##################endCal.add(Calendar.DAY_OF_MONTH, 5) + endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.set(Calendar.HOUR_OF_DAY, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + # endCal.set(Calendar.YEAR, 2015) + # endCal.set(Calendar.MONTH, 11) + endCal.set(Calendar.MILLISECOND, 0) + + officeID = "SWL" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + # By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out + # or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate + # by changing the "flowGroup" variable. + calculateSingleFlowGroups = False + flowGroup = "ConduitGate_Total" + locationList = ["ACTT2", + # "MSDT2", + ] + + # the calculation can also be performed for all the associated groups + # the computeAll method takes: + # officeId + # projectId + # startDate + # endDate + # By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. + # Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. + + calculateAllFlowGroups = True + FlowGroupList = ["Blue_Mtn_Dam", + "Nimrod_Dam", + "Clearwater_Dam", + ] + + + if calculateSingleFlowGroups: + for location in locationList: + print("Now Running", location, "SINGLE") + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup) + + if calculateAllFlowGroups: + for location in FlowGroupList: + print("Now Running", location, "GROUP") + compute_All_Flowgroups(officeID, location, startCal, endCal) + + + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWL/Big3-InflowCalcMultipleActions.py b/district-scripts/SWL/Big3-InflowCalcMultipleActions.py index 25340e4..5a8378e 100644 --- a/district-scripts/SWL/Big3-InflowCalcMultipleActions.py +++ b/district-scripts/SWL/Big3-InflowCalcMultipleActions.py @@ -1,125 +1,135 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def inflow_Actions(function, officeID, location, startCal, endCal, uselimits, freezerain): - # Takes in locations defined by user in group and computes the given command at the given station. - try: - if function.lower() == "cloneinflows": - inflowCalc.cloneInflows(officeID, location, startCal.getTime()) - elif function.lower() == "computeinflow": - inflowCalc.computeInflow(officeID, location, startCal.getTime(), endCal.getTime()) - elif function.lower() == "zeronegatives": - inflowCalc.zeroNegatives(officeID, location, startCal.getTime()) - elif function.lower() == "balanceall": - inflowCalc.balanceAll(officeID, location, startCal.getTime()) - elif function.lower() == "autoadjust": - inflowCalc.autoAdjust(officeID, location, startCal.getTime(), uselimits, freezerain) - else: - print "Input command", function, "is not recognized. Please edit your input and try again." - except Exception as e: - print "Error Completing action {0} at {1} {2}".format(function, officeID, location) - print e - print "" -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar' -#startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -timeZone = TimeZone.getTimeZone("US/Central") - -#startCal.clear() -#startCal.set(Calendar.YEAR, 2015) -#startCal.set(Calendar.MONTH, 4) - -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -7) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - -endCal = Calendar.getInstance(timeZone) -endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.set(Calendar.HOUR_OF_DAY, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) - -officeID = "SWL" - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# UseLimits and FreezeRain are also controllable arguments for AutoAdjust. By setting "useLimits_ON" to True, -# the function will use the "useLimits command. By setting it to "False", it will be turned off. This functions the same way for "freezeRain_ON" -# If the Auto Adjust command is not used, these arguments will have no influence on the other commands. -useLimits_ON = False -freezeRain_ON = False - -# Commands can be input in a list format as seen below. The format is as follows "[ACTION] @ [LOCATION]", reading like "Perform [ACITON] at [LOCATION]. -# The action must come first, and they must be separated by a "@" symbol. -# Spaces between the Action/Location and "@" symbol can vary, although 1 space is recommended for readability. Lines can be commented out as needed. -actions = ["computeInflow @ Blue_Mtn_Dam", - "cloneInflows @ Blue_Mtn_Dam", - "autoAdjust @ Blue_Mtn_Dam", - "computeInflow @ Nimrod_Dam", - "cloneInflows @ Nimrod_Dam", - "autoAdjust @ Nimrod_Dam", - "computeInflow @ Clearwater_Dam", - "cloneInflows @ Clearwater_Dam", - "autoAdjust @ Clearwater_Dam", - ] - -for command in actions: - location = command.split('@')[1].strip() - function = command.split('@')[0].strip() - print "" - print "Now running", function, "at", location - print "" - inflow_Actions(function, officeID, location, startCal, endCal, useLimits_ON, freezeRain_ON) +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + # the java Calendar class is used to create java Date objects + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def inflow_Actions(function, officeID, location, startCal, endCal, uselimits, freezerain): + # Takes in locations defined by user in group and computes the given command at the given station. + try: + if function.lower() == "cloneinflows": + inflowCalc.cloneInflows(officeID, location, startCal.getTime()) + elif function.lower() == "computeinflow": + inflowCalc.computeInflow(officeID, location, startCal.getTime(), endCal.getTime()) + elif function.lower() == "zeronegatives": + inflowCalc.zeroNegatives(officeID, location, startCal.getTime()) + elif function.lower() == "balanceall": + inflowCalc.balanceAll(officeID, location, startCal.getTime()) + elif function.lower() == "autoadjust": + inflowCalc.autoAdjust(officeID, location, startCal.getTime(), uselimits, freezerain) + else: + print("Input command", function, "is not recognized. Please edit your input and try again.") + except Exception as e: + print("Error Completing action {0} at {1} {2}".format(function, officeID, location)) + print(e) + print("") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # this gets a scriptable Pool Percent object + inflowCalc = registry.getCalculation(1.0, "Inflow") + + # configure the start calendar' + #startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + timeZone = TimeZone.getTimeZone("US/Central") + + #startCal.clear() + #startCal.set(Calendar.YEAR, 2015) + #startCal.set(Calendar.MONTH, 4) + + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -7) + startCal.set(Calendar.HOUR_OF_DAY, 0) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + endCal = Calendar.getInstance(timeZone) + endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.set(Calendar.HOUR_OF_DAY, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + + officeID = "SWL" + + # inflowCalc contains 4 callable methods: + # autoAdjust + # balanceAll + # cloneInflows + # zeroNegatives + + # Each method takes the following arguments: + # officeId + # locationId + # startDate + + # autoAdjust also takes booleans: + # useLimits + # freezeRain + + # UseLimits and FreezeRain are also controllable arguments for AutoAdjust. By setting "useLimits_ON" to True, + # the function will use the "useLimits command. By setting it to "False", it will be turned off. This functions the same way for "freezeRain_ON" + # If the Auto Adjust command is not used, these arguments will have no influence on the other commands. + useLimits_ON = False + freezeRain_ON = False + + # Commands can be input in a list format as seen below. The format is as follows "[ACTION] @ [LOCATION]", reading like "Perform [ACITON] at [LOCATION]. + # The action must come first, and they must be separated by a "@" symbol. + # Spaces between the Action/Location and "@" symbol can vary, although 1 space is recommended for readability. Lines can be commented out as needed. + actions = ["computeInflow @ Blue_Mtn_Dam", + "cloneInflows @ Blue_Mtn_Dam", + "autoAdjust @ Blue_Mtn_Dam", + "computeInflow @ Nimrod_Dam", + "cloneInflows @ Nimrod_Dam", + "autoAdjust @ Nimrod_Dam", + "computeInflow @ Clearwater_Dam", + "cloneInflows @ Clearwater_Dam", + "autoAdjust @ Clearwater_Dam", + ] + + for command in actions: + location = command.split('@')[1].strip() + function = command.split('@')[0].strip() + print("") + print("Now running", function, "at", location) + print("") + inflow_Actions(function, officeID, location, startCal, endCal, useLimits_ON, freezeRain_ON) + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWL/Millwd-Tri-Lks-GateFlow.py b/district-scripts/SWL/Millwd-Tri-Lks-GateFlow.py index 730f364..998bddc 100644 --- a/district-scripts/SWL/Millwd-Tri-Lks-GateFlow.py +++ b/district-scripts/SWL/Millwd-Tri-Lks-GateFlow.py @@ -1,135 +1,145 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -# the gate flow calculations requires a start and end time. -# here we create a java Calendar object that will be used to create the start Date -startCal = Calendar.getInstance(timeZone) -# startCal.clear() -startCal.add(Calendar.DAY_OF_MONTH, -5) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -# startCal.set(Calendar.YEAR, 2015) -# startCal.set(Calendar.MONTH, 9) -startCal.set(Calendar.MILLISECOND, 0) - -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance(timeZone) -# endCal.clear() -##################endCal.add(Calendar.DAY_OF_MONTH, 5) -endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.set(Calendar.HOUR_OF_DAY, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -# endCal.set(Calendar.YEAR, 2015) -# endCal.set(Calendar.MONTH, 11) -endCal.set(Calendar.MILLISECOND, 0) - -officeID = "SWL" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") -# By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out -# or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate -# by changing the "flowGroup" variable. -calculateSingleFlowGroups = False -flowGroup = "ConduitGate_Total" -locationList = ["ACTT2", -# "MSDT2", - ] - -# the calculation can also be performed for all the associated groups -# the computeAll method takes: -# officeId -# projectId -# startDate -# endDate -# By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. -# Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. - -calculateAllFlowGroups = True -FlowGroupList = ["Millwood_Dam", - "DeQueen_Dam", - "Dierks_Dam", - "Gillham_Dam", - ] - - -if calculateSingleFlowGroups: - for location in locationList: - print "Now Running", location, "SINGLE" - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup) - -if calculateAllFlowGroups: - for location in FlowGroupList: - print "Now Running", location, "GROUP" - compute_All_Flowgroups(officeID, location, startCal, endCal) - - - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + # the gate flow calculations requires a start and end time. + # here we create a java Calendar object that will be used to create the start Date + startCal = Calendar.getInstance(timeZone) + # startCal.clear() + startCal.add(Calendar.DAY_OF_MONTH, -5) + startCal.set(Calendar.HOUR_OF_DAY, 0) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + # startCal.set(Calendar.YEAR, 2015) + # startCal.set(Calendar.MONTH, 9) + startCal.set(Calendar.MILLISECOND, 0) + + # create a java Calendar object that will be used to create the end Date + endCal = Calendar.getInstance(timeZone) + # endCal.clear() + ##################endCal.add(Calendar.DAY_OF_MONTH, 5) + endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.set(Calendar.HOUR_OF_DAY, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + # endCal.set(Calendar.YEAR, 2015) + # endCal.set(Calendar.MONTH, 11) + endCal.set(Calendar.MILLISECOND, 0) + + officeID = "SWL" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + # By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out + # or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate + # by changing the "flowGroup" variable. + calculateSingleFlowGroups = False + flowGroup = "ConduitGate_Total" + locationList = ["ACTT2", + # "MSDT2", + ] + + # the calculation can also be performed for all the associated groups + # the computeAll method takes: + # officeId + # projectId + # startDate + # endDate + # By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. + # Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. + + calculateAllFlowGroups = True + FlowGroupList = ["Millwood_Dam", + "DeQueen_Dam", + "Dierks_Dam", + "Gillham_Dam", + ] + + + if calculateSingleFlowGroups: + for location in locationList: + print("Now Running", location, "SINGLE") + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup) + + if calculateAllFlowGroups: + for location in FlowGroupList: + print("Now Running", location, "GROUP") + compute_All_Flowgroups(officeID, location, startCal, endCal) + + + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWL/Millwd-Tri-Lks-InflowCalcMultipleActions.py b/district-scripts/SWL/Millwd-Tri-Lks-InflowCalcMultipleActions.py index 567bcb3..5c04e5a 100644 --- a/district-scripts/SWL/Millwd-Tri-Lks-InflowCalcMultipleActions.py +++ b/district-scripts/SWL/Millwd-Tri-Lks-InflowCalcMultipleActions.py @@ -1,129 +1,139 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def inflow_Actions(function, officeID, location, startCal, endCal, uselimits, freezerain): - # Takes in locations defined by user in group and computes the given command at the given station. - try: - if function.lower() == "cloneinflows": - inflowCalc.cloneInflows(officeID, location, startCal.getTime()) - elif function.lower() == "computeinflow": - inflowCalc.computeInflow(officeID, location, startCal.getTime(), endCal.getTime()) - elif function.lower() == "zeronegatives": - inflowCalc.zeroNegatives(officeID, location, startCal.getTime()) - elif function.lower() == "balanceall": - inflowCalc.balanceAll(officeID, location, startCal.getTime()) - elif function.lower() == "autoadjust": - inflowCalc.autoAdjust(officeID, location, startCal.getTime(), uselimits, freezerain) - else: - print "Input command", function, "is not recognized. Please edit your input and try again." - except Exception as e: - print "Error Completing action {0} at {1} {2}".format(function, officeID, location) - print e - print "" -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar' -#startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -timeZone = TimeZone.getTimeZone("US/Central") - -#startCal.clear() -#startCal.set(Calendar.YEAR, 2015) -#startCal.set(Calendar.MONTH, 4) - -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -7) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - -endCal = Calendar.getInstance(timeZone) -endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.set(Calendar.HOUR_OF_DAY, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) - -officeID = "SWL" - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# UseLimits and FreezeRain are also controllable arguments for AutoAdjust. By setting "useLimits_ON" to True, -# the function will use the "useLimits command. By setting it to "False", it will be turned off. This functions the same way for "freezeRain_ON" -# If the Auto Adjust command is not used, these arguments will have no influence on the other commands. -useLimits_ON = False -freezeRain_ON = False - -# Commands can be input in a list format as seen below. The format is as follows "[ACTION] @ [LOCATION]", reading like "Perform [ACITON] at [LOCATION]. -# The action must come first, and they must be separated by a "@" symbol. -# Spaces between the Action/Location and "@" symbol can vary, although 1 space is recommended for readability. Lines can be commented out as needed. -actions = ["computeInflow @ Dequeen_Dam", - "cloneInflows @ Dequeen_Dam", - "autoAdjust @ Dequeen_Dam", - "computeInflow @ Dierks_Dam", - "cloneInflows @ Dierks_Dam", - "autoAdjust @ Dierks_Dam", - "computeInflow @ Gillham_Dam", - "cloneInflows @ Gillham_Dam", - "autoAdjust @ Gillham_Dam", - "computeInflow @ Millwood_Dam", - "cloneInflows @ Millwood_Dam", - "autoAdjust @ Millwood_Dam", - ] - -for command in actions: - location = command.split('@')[1].strip() - function = command.split('@')[0].strip() - print "" - print "Now running", function, "at", location - print "" - inflow_Actions(function, officeID, location, startCal, endCal, useLimits_ON, freezeRain_ON) - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + # the java Calendar class is used to create java Date objects + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def inflow_Actions(function, officeID, location, startCal, endCal, uselimits, freezerain): + # Takes in locations defined by user in group and computes the given command at the given station. + try: + if function.lower() == "cloneinflows": + inflowCalc.cloneInflows(officeID, location, startCal.getTime()) + elif function.lower() == "computeinflow": + inflowCalc.computeInflow(officeID, location, startCal.getTime(), endCal.getTime()) + elif function.lower() == "zeronegatives": + inflowCalc.zeroNegatives(officeID, location, startCal.getTime()) + elif function.lower() == "balanceall": + inflowCalc.balanceAll(officeID, location, startCal.getTime()) + elif function.lower() == "autoadjust": + inflowCalc.autoAdjust(officeID, location, startCal.getTime(), uselimits, freezerain) + else: + print("Input command", function, "is not recognized. Please edit your input and try again.") + except Exception as e: + print("Error Completing action {0} at {1} {2}".format(function, officeID, location)) + print(e) + print("") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # this gets a scriptable Pool Percent object + inflowCalc = registry.getCalculation(1.0, "Inflow") + + # configure the start calendar' + #startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + timeZone = TimeZone.getTimeZone("US/Central") + + #startCal.clear() + #startCal.set(Calendar.YEAR, 2015) + #startCal.set(Calendar.MONTH, 4) + + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -7) + startCal.set(Calendar.HOUR_OF_DAY, 0) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + endCal = Calendar.getInstance(timeZone) + endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.set(Calendar.HOUR_OF_DAY, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + + officeID = "SWL" + + # inflowCalc contains 4 callable methods: + # autoAdjust + # balanceAll + # cloneInflows + # zeroNegatives + + # Each method takes the following arguments: + # officeId + # locationId + # startDate + + # autoAdjust also takes booleans: + # useLimits + # freezeRain + + # UseLimits and FreezeRain are also controllable arguments for AutoAdjust. By setting "useLimits_ON" to True, + # the function will use the "useLimits command. By setting it to "False", it will be turned off. This functions the same way for "freezeRain_ON" + # If the Auto Adjust command is not used, these arguments will have no influence on the other commands. + useLimits_ON = False + freezeRain_ON = False + + # Commands can be input in a list format as seen below. The format is as follows "[ACTION] @ [LOCATION]", reading like "Perform [ACITON] at [LOCATION]. + # The action must come first, and they must be separated by a "@" symbol. + # Spaces between the Action/Location and "@" symbol can vary, although 1 space is recommended for readability. Lines can be commented out as needed. + actions = ["computeInflow @ Dequeen_Dam", + "cloneInflows @ Dequeen_Dam", + "autoAdjust @ Dequeen_Dam", + "computeInflow @ Dierks_Dam", + "cloneInflows @ Dierks_Dam", + "autoAdjust @ Dierks_Dam", + "computeInflow @ Gillham_Dam", + "cloneInflows @ Gillham_Dam", + "autoAdjust @ Gillham_Dam", + "computeInflow @ Millwood_Dam", + "cloneInflows @ Millwood_Dam", + "autoAdjust @ Millwood_Dam", + ] + + for command in actions: + location = command.split('@')[1].strip() + function = command.split('@')[0].strip() + print("") + print("Now running", function, "at", location) + print("") + inflow_Actions(function, officeID, location, startCal, endCal, useLimits_ON, freezeRain_ON) + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWL/WhiteR-GateFlow.py b/district-scripts/SWL/WhiteR-GateFlow.py index 1cce0db..270a0f4 100644 --- a/district-scripts/SWL/WhiteR-GateFlow.py +++ b/district-scripts/SWL/WhiteR-GateFlow.py @@ -1,137 +1,147 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -# the gate flow calculations requires a start and end time. -# here we create a java Calendar object that will be used to create the start Date -startCal = Calendar.getInstance(timeZone) -# startCal.clear() -startCal.add(Calendar.DAY_OF_MONTH, -5) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -# startCal.set(Calendar.YEAR, 2015) -# startCal.set(Calendar.MONTH, 9) -startCal.set(Calendar.MILLISECOND, 0) - -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance(timeZone) -# endCal.clear() -##################endCal.add(Calendar.DAY_OF_MONTH, 5) -#endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.set(Calendar.HOUR_OF_DAY, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -# endCal.set(Calendar.YEAR, 2015) -# endCal.set(Calendar.MONTH, 11) -endCal.set(Calendar.MILLISECOND, 0) - -officeID = "SWL" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") -# By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out -# or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate -# by changing the "flowGroup" variable. -calculateSingleFlowGroups = False -flowGroup = "ConduitGate_Total" -locationList = ["ACTT2", -# "MSDT2", - ] - -# the calculation can also be performed for all the associated groups -# the computeAll method takes: -# officeId -# projectId -# startDate -# endDate -# By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. -# Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. - -calculateAllFlowGroups = True -FlowGroupList = ["Beaver_Dam", - "Table_Rock_Dam", - "Bull_Shoals_Dam", - "Norfork_Dam", - "GreersFerry_Dam", - ] - - -if calculateSingleFlowGroups: - for location in locationList: - print "Now Running", location, "SINGLE" - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup) - -if calculateAllFlowGroups: - for location in FlowGroupList: - print "Now Running", location, "GROUP" - compute_All_Flowgroups(officeID, location, startCal, endCal) - - - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + # the gate flow calculations requires a start and end time. + # here we create a java Calendar object that will be used to create the start Date + startCal = Calendar.getInstance(timeZone) + # startCal.clear() + startCal.add(Calendar.DAY_OF_MONTH, -5) + startCal.set(Calendar.HOUR_OF_DAY, 0) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + # startCal.set(Calendar.YEAR, 2015) + # startCal.set(Calendar.MONTH, 9) + startCal.set(Calendar.MILLISECOND, 0) + + # create a java Calendar object that will be used to create the end Date + endCal = Calendar.getInstance(timeZone) + # endCal.clear() + ##################endCal.add(Calendar.DAY_OF_MONTH, 5) + #endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.set(Calendar.HOUR_OF_DAY, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + # endCal.set(Calendar.YEAR, 2015) + # endCal.set(Calendar.MONTH, 11) + endCal.set(Calendar.MILLISECOND, 0) + + officeID = "SWL" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + # By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out + # or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate + # by changing the "flowGroup" variable. + calculateSingleFlowGroups = False + flowGroup = "ConduitGate_Total" + locationList = ["ACTT2", + # "MSDT2", + ] + + # the calculation can also be performed for all the associated groups + # the computeAll method takes: + # officeId + # projectId + # startDate + # endDate + # By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. + # Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. + + calculateAllFlowGroups = True + FlowGroupList = ["Beaver_Dam", + "Table_Rock_Dam", + "Bull_Shoals_Dam", + "Norfork_Dam", + "GreersFerry_Dam", + ] + + + if calculateSingleFlowGroups: + for location in locationList: + print("Now Running", location, "SINGLE") + compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup) + + if calculateAllFlowGroups: + for location in FlowGroupList: + print("Now Running", location, "GROUP") + compute_All_Flowgroups(officeID, location, startCal, endCal) + + + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWL/WhiteR-InflowCalcMultipleActions.py b/district-scripts/SWL/WhiteR-InflowCalcMultipleActions.py index eb1fd6c..a92dbef 100644 --- a/district-scripts/SWL/WhiteR-InflowCalcMultipleActions.py +++ b/district-scripts/SWL/WhiteR-InflowCalcMultipleActions.py @@ -1,131 +1,141 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def inflow_Actions(function, officeID, location, startCal, endCal, uselimits, freezerain): - # Takes in locations defined by user in group and computes the given command at the given station. - try: - if function.lower() == "cloneinflows": - inflowCalc.cloneInflows(officeID, location, startCal.getTime()) - elif function.lower() == "computeinflow": - inflowCalc.computeInflow(officeID, location, startCal.getTime(), endCal.getTime()) - elif function.lower() == "zeronegatives": - inflowCalc.zeroNegatives(officeID, location, startCal.getTime()) - elif function.lower() == "balanceall": - inflowCalc.balanceAll(officeID, location, startCal.getTime()) - elif function.lower() == "autoadjust": - inflowCalc.autoAdjust(officeID, location, startCal.getTime(), uselimits, freezerain) - else: - print "Input command", function, "is not recognized. Please edit your input and try again." - except Exception as e: - print "Error Completing action {0} at {1} {2}".format(function, officeID, location) - print e - print "" -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar' -#startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -timeZone = TimeZone.getTimeZone("US/Central") - -#startCal.clear() -#startCal.set(Calendar.YEAR, 2015) -#startCal.set(Calendar.MONTH, 4) - -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -7) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - -endCal = Calendar.getInstance(timeZone) -endCal.add(Calendar.DAY_OF_MONTH, 1) -endCal.set(Calendar.HOUR_OF_DAY, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) - -officeID = "SWL" - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# UseLimits and FreezeRain are also controllable arguments for AutoAdjust. By setting "useLimits_ON" to True, -# the function will use the "useLimits command. By setting it to "False", it will be turned off. This functions the same way for "freezeRain_ON" -# If the Auto Adjust command is not used, these arguments will have no influence on the other commands. -useLimits_ON = True -freezeRain_ON = True - -# Commands can be input in a list format as seen below. The format is as follows "[ACTION] @ [LOCATION]", reading like "Perform [ACITON] at [LOCATION]. -# The action must come first, and they must be separated by a "@" symbol. -# Spaces between the Action/Location and "@" symbol can vary, although 1 space is recommended for readability. Lines can be commented out as needed. -actions = ["computeInflow @ Beaver_Dam", - "cloneInflows @ Beaver_Dam", - "autoAdjust @ Beaver_Dam", - "computeInflow @ Table_Rock_Dam", - "cloneInflows @ Table_Rock_Dam", - "autoAdjust @ Table_Rock_Dam", - "computeInflow @ Bull_Shoals_Dam", - "cloneInflows @ Bull_Shoals_Dam", - "autoAdjust @ Bull_Shoals_Dam", - "computeInflow @ Norfork_Dam", - "cloneInflows @ Norfork_Dam", - "autoAdjust @ Nofork_Dam", - "computeInflow @ GreersFerry_Dam", - "cloneInflows @ GreersFerry_Dam", - "autoAdjust @ GreersFerry_Dam", - ] - -for command in actions: - location = command.split('@')[1].strip() - function = command.split('@')[0].strip() - print "" - print "Now running", function, "at", location - print "" - inflow_Actions(function, officeID, location, startCal, endCal, useLimits_ON, freezeRain_ON) +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + # the java Calendar class is used to create java Date objects + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def inflow_Actions(function, officeID, location, startCal, endCal, uselimits, freezerain): + # Takes in locations defined by user in group and computes the given command at the given station. + try: + if function.lower() == "cloneinflows": + inflowCalc.cloneInflows(officeID, location, startCal.getTime()) + elif function.lower() == "computeinflow": + inflowCalc.computeInflow(officeID, location, startCal.getTime(), endCal.getTime()) + elif function.lower() == "zeronegatives": + inflowCalc.zeroNegatives(officeID, location, startCal.getTime()) + elif function.lower() == "balanceall": + inflowCalc.balanceAll(officeID, location, startCal.getTime()) + elif function.lower() == "autoadjust": + inflowCalc.autoAdjust(officeID, location, startCal.getTime(), uselimits, freezerain) + else: + print("Input command", function, "is not recognized. Please edit your input and try again.") + except Exception as e: + print("Error Completing action {0} at {1} {2}".format(function, officeID, location)) + print(e) + print("") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # this gets a scriptable Pool Percent object + inflowCalc = registry.getCalculation(1.0, "Inflow") + + # configure the start calendar' + #startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + timeZone = TimeZone.getTimeZone("US/Central") + + #startCal.clear() + #startCal.set(Calendar.YEAR, 2015) + #startCal.set(Calendar.MONTH, 4) + + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -7) + startCal.set(Calendar.HOUR_OF_DAY, 0) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + endCal = Calendar.getInstance(timeZone) + endCal.add(Calendar.DAY_OF_MONTH, 1) + endCal.set(Calendar.HOUR_OF_DAY, 0) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + + officeID = "SWL" + + # inflowCalc contains 4 callable methods: + # autoAdjust + # balanceAll + # cloneInflows + # zeroNegatives + + # Each method takes the following arguments: + # officeId + # locationId + # startDate + + # autoAdjust also takes booleans: + # useLimits + # freezeRain + + # UseLimits and FreezeRain are also controllable arguments for AutoAdjust. By setting "useLimits_ON" to True, + # the function will use the "useLimits command. By setting it to "False", it will be turned off. This functions the same way for "freezeRain_ON" + # If the Auto Adjust command is not used, these arguments will have no influence on the other commands. + useLimits_ON = True + freezeRain_ON = True + + # Commands can be input in a list format as seen below. The format is as follows "[ACTION] @ [LOCATION]", reading like "Perform [ACITON] at [LOCATION]. + # The action must come first, and they must be separated by a "@" symbol. + # Spaces between the Action/Location and "@" symbol can vary, although 1 space is recommended for readability. Lines can be commented out as needed. + actions = ["computeInflow @ Beaver_Dam", + "cloneInflows @ Beaver_Dam", + "autoAdjust @ Beaver_Dam", + "computeInflow @ Table_Rock_Dam", + "cloneInflows @ Table_Rock_Dam", + "autoAdjust @ Table_Rock_Dam", + "computeInflow @ Bull_Shoals_Dam", + "cloneInflows @ Bull_Shoals_Dam", + "autoAdjust @ Bull_Shoals_Dam", + "computeInflow @ Norfork_Dam", + "cloneInflows @ Norfork_Dam", + "autoAdjust @ Nofork_Dam", + "computeInflow @ GreersFerry_Dam", + "cloneInflows @ GreersFerry_Dam", + "autoAdjust @ GreersFerry_Dam", + ] + + for command in actions: + location = command.split('@')[1].strip() + function = command.split('@')[0].strip() + print("") + print("Now running", function, "at", location) + print("") + inflow_Actions(function, officeID, location, startCal, endCal, useLimits_ON, freezeRain_ON) + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/GateFlowGroup1.py b/district-scripts/SWT/GateFlowGroup1.py index b457d09..9018dc7 100644 --- a/district-scripts/SWT/GateFlowGroup1.py +++ b/district-scripts/SWT/GateFlowGroup1.py @@ -1,146 +1,156 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -5) -#startCal.add(Calendar.HOUR, -7) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -#endCal.add(Calendar.MONTH, -3) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") - -# -# GROUP 1 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN THE FIRST 2 MINUTES OF THE TOP OF THE HOUR) -# - -#FOSS -gateCalc.computeFlowGroup("SWT", "FOSS", startCal.getTime(), endCal.getTime(), "Flow.FOSS.Project_Total") -gateCalc.computeFlowGroup("SWT", "FOSS", startCal.getTime(), endCal.getTime(), "Flow.FOSS.Gated_Total") - -#FCOB -gateCalc.computeFlowGroup("SWT", "FCOB", startCal.getTime(), endCal.getTime(), "Flow.FCOB.Project_Total") -gateCalc.computeFlowGroup("SWT", "FCOB", startCal.getTime(), endCal.getTime(), "Flow.FCOB.Gated_Total") - -#SKIA -gateCalc.computeFlowGroup("SWT", "SKIA", startCal.getTime(), endCal.getTime(), "Flow.SKIA.Project_Total") -gateCalc.computeFlowGroup("SWT", "SKIA", startCal.getTime(), endCal.getTime(), "Flow.SKIA.Gated_Total") - -#HEYB -gateCalc.computeFlowGroup("SWT", "HEYB", startCal.getTime(), endCal.getTime(), "Flow.HEYB.Project_Total") -gateCalc.computeFlowGroup("SWT", "HEYB", startCal.getTime(), endCal.getTime(), "Flow.HEYB.Gated_Total") - -#KAWL -gateCalc.computeFlowGroup("SWT", "KAWL", startCal.getTime(), endCal.getTime(), "Flow.KAWL.Project_Total") -gateCalc.computeFlowGroup("SWT", "KAWL", startCal.getTime(), endCal.getTime(), "Flow.KAWL.Gated_Total") -gateCalc.computeFlowGroup("SWT", "KAWL", startCal.getTime(), endCal.getTime(), "Flow.KAWL.Turbine_Total") - -#OOLO -gateCalc.computeFlowGroup("SWT", "OOLO", startCal.getTime(), endCal.getTime(), "Flow.OOLO.Project_Total") -gateCalc.computeFlowGroup("SWT", "OOLO", startCal.getTime(), endCal.getTime(), "Flow.OOLO.Gated_Total") - -#COPA -gateCalc.computeFlowGroup("SWT", "COPA", startCal.getTime(), endCal.getTime(), "Flow.COPA.Project_Total") -gateCalc.computeFlowGroup("SWT", "COPA", startCal.getTime(), endCal.getTime(), "Flow.COPA.Gated_Total") - -#HULA -gateCalc.computeFlowGroup("SWT", "HULA", startCal.getTime(), endCal.getTime(), "Flow.HULA.Project_Total") -gateCalc.computeFlowGroup("SWT", "HULA", startCal.getTime(), endCal.getTime(), "Flow.HULA.Gated_Total") +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + + # Defaults to start of the day 5 days ago, and ends at the top of the current hour today + # configure the start calendar + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -5) + #startCal.add(Calendar.HOUR, -7) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + + # configure the end calendar + endCal = Calendar.getInstance(timeZone) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + #endCal.add(Calendar.MONTH, -3) + + # Calendar can be adjusted using the following functions: + # startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. + # startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) + # startCal.set(Calendar.YEAR, 2020) # Sets the year + # startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) + + officeID = "SWT" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + + # + # GROUP 1 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN THE FIRST 2 MINUTES OF THE TOP OF THE HOUR) + # + + #FOSS + gateCalc.computeFlowGroup("SWT", "FOSS", startCal.getTime(), endCal.getTime(), "Flow.FOSS.Project_Total") + gateCalc.computeFlowGroup("SWT", "FOSS", startCal.getTime(), endCal.getTime(), "Flow.FOSS.Gated_Total") + + #FCOB + gateCalc.computeFlowGroup("SWT", "FCOB", startCal.getTime(), endCal.getTime(), "Flow.FCOB.Project_Total") + gateCalc.computeFlowGroup("SWT", "FCOB", startCal.getTime(), endCal.getTime(), "Flow.FCOB.Gated_Total") + + #SKIA + gateCalc.computeFlowGroup("SWT", "SKIA", startCal.getTime(), endCal.getTime(), "Flow.SKIA.Project_Total") + gateCalc.computeFlowGroup("SWT", "SKIA", startCal.getTime(), endCal.getTime(), "Flow.SKIA.Gated_Total") + + #HEYB + gateCalc.computeFlowGroup("SWT", "HEYB", startCal.getTime(), endCal.getTime(), "Flow.HEYB.Project_Total") + gateCalc.computeFlowGroup("SWT", "HEYB", startCal.getTime(), endCal.getTime(), "Flow.HEYB.Gated_Total") + + #KAWL + gateCalc.computeFlowGroup("SWT", "KAWL", startCal.getTime(), endCal.getTime(), "Flow.KAWL.Project_Total") + gateCalc.computeFlowGroup("SWT", "KAWL", startCal.getTime(), endCal.getTime(), "Flow.KAWL.Gated_Total") + gateCalc.computeFlowGroup("SWT", "KAWL", startCal.getTime(), endCal.getTime(), "Flow.KAWL.Turbine_Total") + + #OOLO + gateCalc.computeFlowGroup("SWT", "OOLO", startCal.getTime(), endCal.getTime(), "Flow.OOLO.Project_Total") + gateCalc.computeFlowGroup("SWT", "OOLO", startCal.getTime(), endCal.getTime(), "Flow.OOLO.Gated_Total") + + #COPA + gateCalc.computeFlowGroup("SWT", "COPA", startCal.getTime(), endCal.getTime(), "Flow.COPA.Project_Total") + gateCalc.computeFlowGroup("SWT", "COPA", startCal.getTime(), endCal.getTime(), "Flow.COPA.Gated_Total") -#ELKC -gateCalc.computeFlowGroup("SWT", "ELKC", startCal.getTime(), endCal.getTime(), "Flow.ELKC.Project_Total") -gateCalc.computeFlowGroup("SWT", "ELKC", startCal.getTime(), endCal.getTime(), "Flow.ELKC.Gated_Total") + #HULA + gateCalc.computeFlowGroup("SWT", "HULA", startCal.getTime(), endCal.getTime(), "Flow.HULA.Project_Total") + gateCalc.computeFlowGroup("SWT", "HULA", startCal.getTime(), endCal.getTime(), "Flow.HULA.Gated_Total") -#FALL -gateCalc.computeFlowGroup("SWT", "FALL", startCal.getTime(), endCal.getTime(), "Flow.FALL.Project_Total") -gateCalc.computeFlowGroup("SWT", "FALL", startCal.getTime(), endCal.getTime(), "Flow.FALL.Gated_Total") + #ELKC + gateCalc.computeFlowGroup("SWT", "ELKC", startCal.getTime(), endCal.getTime(), "Flow.ELKC.Project_Total") + gateCalc.computeFlowGroup("SWT", "ELKC", startCal.getTime(), endCal.getTime(), "Flow.ELKC.Gated_Total") + #FALL + gateCalc.computeFlowGroup("SWT", "FALL", startCal.getTime(), endCal.getTime(), "Flow.FALL.Project_Total") + gateCalc.computeFlowGroup("SWT", "FALL", startCal.getTime(), endCal.getTime(), "Flow.FALL.Gated_Total") + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/GateFlowGroup2.py b/district-scripts/SWT/GateFlowGroup2.py index acb3122..8beac17 100644 --- a/district-scripts/SWT/GateFlowGroup2.py +++ b/district-scripts/SWT/GateFlowGroup2.py @@ -1,123 +1,133 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -5) -#startCal.add(Calendar.HOUR, -7) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -#endCal.add(Calendar.MONTH, -3) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") - -# -# GROUP 2 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN THE FIRST 2 - 4 MINUTES OF THE TOP OF THE HOUR) -# - -#ARCA -gateCalc.computeFlowGroup("SWT", "ARCA", startCal.getTime(), endCal.getTime(), "Flow.ARCA.Project_Total") -gateCalc.computeFlowGroup("SWT", "ARCA", startCal.getTime(), endCal.getTime(), "Flow.ARCA.Gated_Total") - -#ARBU -gateCalc.computeFlowGroup("SWT", "ARBU", startCal.getTime(), endCal.getTime(), "Flow.ARBU.Project_Total") -gateCalc.computeFlowGroup("SWT", "ARBU", startCal.getTime(), endCal.getTime(), "Flow.ARBU.Gated_Total") - -#BIRC -gateCalc.computeFlowGroup("SWT", "BIRC", startCal.getTime(), endCal.getTime(), "Flow.BIRC.Project_Total") -gateCalc.computeFlowGroup("SWT", "BIRC", startCal.getTime(), endCal.getTime(), "Flow.BIRC.Gated_Total") - -#ROBE -gateCalc.computeFlowGroup("SWT", "ROBE", startCal.getTime(), endCal.getTime(), "Flow.ROBE.Project_Total") -gateCalc.computeFlowGroup("SWT", "ROBE", startCal.getTime(), endCal.getTime(), "Flow.ROBE.Gated_Total") -gateCalc.computeFlowGroup("SWT", "ROBE", startCal.getTime(), endCal.getTime(), "Flow.ROBE.Turbine_Total") - -#WAUR -gateCalc.computeFlowGroup("SWT", "WAUR", startCal.getTime(), endCal.getTime(), "Flow.WAUR.Project_Total") -gateCalc.computeFlowGroup("SWT", "WAUR", startCal.getTime(), endCal.getTime(), "Flow.WAUR.Gated_Total") - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + + # Defaults to start of the day 5 days ago, and ends at the top of the current hour today + # configure the start calendar + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -5) + #startCal.add(Calendar.HOUR, -7) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + + # configure the end calendar + endCal = Calendar.getInstance(timeZone) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + #endCal.add(Calendar.MONTH, -3) + + # Calendar can be adjusted using the following functions: + # startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. + # startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) + # startCal.set(Calendar.YEAR, 2020) # Sets the year + # startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) + + officeID = "SWT" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + + # + # GROUP 2 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN THE FIRST 2 - 4 MINUTES OF THE TOP OF THE HOUR) + # + + #ARCA + gateCalc.computeFlowGroup("SWT", "ARCA", startCal.getTime(), endCal.getTime(), "Flow.ARCA.Project_Total") + gateCalc.computeFlowGroup("SWT", "ARCA", startCal.getTime(), endCal.getTime(), "Flow.ARCA.Gated_Total") + + #ARBU + gateCalc.computeFlowGroup("SWT", "ARBU", startCal.getTime(), endCal.getTime(), "Flow.ARBU.Project_Total") + gateCalc.computeFlowGroup("SWT", "ARBU", startCal.getTime(), endCal.getTime(), "Flow.ARBU.Gated_Total") + + #BIRC + gateCalc.computeFlowGroup("SWT", "BIRC", startCal.getTime(), endCal.getTime(), "Flow.BIRC.Project_Total") + gateCalc.computeFlowGroup("SWT", "BIRC", startCal.getTime(), endCal.getTime(), "Flow.BIRC.Gated_Total") + + #ROBE + gateCalc.computeFlowGroup("SWT", "ROBE", startCal.getTime(), endCal.getTime(), "Flow.ROBE.Project_Total") + gateCalc.computeFlowGroup("SWT", "ROBE", startCal.getTime(), endCal.getTime(), "Flow.ROBE.Gated_Total") + gateCalc.computeFlowGroup("SWT", "ROBE", startCal.getTime(), endCal.getTime(), "Flow.ROBE.Turbine_Total") + + #WAUR + gateCalc.computeFlowGroup("SWT", "WAUR", startCal.getTime(), endCal.getTime(), "Flow.WAUR.Project_Total") + gateCalc.computeFlowGroup("SWT", "WAUR", startCal.getTime(), endCal.getTime(), "Flow.WAUR.Gated_Total") + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/GateFlowGroup3.py b/district-scripts/SWT/GateFlowGroup3.py index 7b962f6..cf5a667 100644 --- a/district-scripts/SWT/GateFlowGroup3.py +++ b/district-scripts/SWT/GateFlowGroup3.py @@ -1,134 +1,144 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -5) -#startCal.add(Calendar.HOUR, -7) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -#endCal.add(Calendar.DAY_OF_MONTH, -12) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") - -# -# GROUP 3 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN 5 TO 8 MINUTES OF THE TOP OF THE HOUR) -# - -#COUN -gateCalc.computeFlowGroup("SWT", "COUN", startCal.getTime(), endCal.getTime(), "Flow.COUN.Project_Total") -gateCalc.computeFlowGroup("SWT", "COUN", startCal.getTime(), endCal.getTime(), "Flow.COUN.Gated_Total") - -#HUGO -gateCalc.computeFlowGroup("SWT", "HUGO", startCal.getTime(), endCal.getTime(), "Flow.HUGO.Project_Total") -gateCalc.computeFlowGroup("SWT", "HUGO", startCal.getTime(), endCal.getTime(), "Flow.HUGO.Gated_Total") - -#MARI -gateCalc.computeFlowGroup("SWT", "MARI", startCal.getTime(), endCal.getTime(), "Flow.MARI.Project_Total") -gateCalc.computeFlowGroup("SWT", "MARI", startCal.getTime(), endCal.getTime(), "Flow.MARI.Gated_Total") - -#PATM -gateCalc.computeFlowGroup("SWT", "PATM", startCal.getTime(), endCal.getTime(), "Flow.PATM.Project_Total") -gateCalc.computeFlowGroup("SWT", "PATM", startCal.getTime(), endCal.getTime(), "Flow.PATM.Gated_Total") - -#FSUP -gateCalc.computeFlowGroup("SWT", "FSUP", startCal.getTime(), endCal.getTime(), "Flow.FSUP.Project_Total") -gateCalc.computeFlowGroup("SWT", "FSUP", startCal.getTime(), endCal.getTime(), "Flow.FSUP.Gated_Total") - -#CANT -gateCalc.computeFlowGroup("SWT", "CANT", startCal.getTime(), endCal.getTime(), "Flow.CANT.Project_Total") -gateCalc.computeFlowGroup("SWT", "CANT", startCal.getTime(), endCal.getTime(), "Flow.CANT.Gated_Total") - -#HUDS -gateCalc.computeFlowGroup("SWT", "HUDS", startCal.getTime(), endCal.getTime(), "Flow.HUDS.Project_Total") -gateCalc.computeFlowGroup("SWT", "HUDS", startCal.getTime(), endCal.getTime(), "Flow.HUDS.Turbine_Total") -gateCalc.computeFlowGroup("SWT", "HUDS", startCal.getTime(), endCal.getTime(), "Flow.HUDS.Gated_Total") +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + + # Defaults to start of the day 5 days ago, and ends at the top of the current hour today + # configure the start calendar + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -5) + #startCal.add(Calendar.HOUR, -7) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + + # configure the end calendar + endCal = Calendar.getInstance(timeZone) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + #endCal.add(Calendar.DAY_OF_MONTH, -12) + + # Calendar can be adjusted using the following functions: + # startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. + # startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) + # startCal.set(Calendar.YEAR, 2020) # Sets the year + # startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) + + officeID = "SWT" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + + # + # GROUP 3 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN 5 TO 8 MINUTES OF THE TOP OF THE HOUR) + # + + #COUN + gateCalc.computeFlowGroup("SWT", "COUN", startCal.getTime(), endCal.getTime(), "Flow.COUN.Project_Total") + gateCalc.computeFlowGroup("SWT", "COUN", startCal.getTime(), endCal.getTime(), "Flow.COUN.Gated_Total") + + #HUGO + gateCalc.computeFlowGroup("SWT", "HUGO", startCal.getTime(), endCal.getTime(), "Flow.HUGO.Project_Total") + gateCalc.computeFlowGroup("SWT", "HUGO", startCal.getTime(), endCal.getTime(), "Flow.HUGO.Gated_Total") + + #MARI + gateCalc.computeFlowGroup("SWT", "MARI", startCal.getTime(), endCal.getTime(), "Flow.MARI.Project_Total") + gateCalc.computeFlowGroup("SWT", "MARI", startCal.getTime(), endCal.getTime(), "Flow.MARI.Gated_Total") + + #PATM + gateCalc.computeFlowGroup("SWT", "PATM", startCal.getTime(), endCal.getTime(), "Flow.PATM.Project_Total") + gateCalc.computeFlowGroup("SWT", "PATM", startCal.getTime(), endCal.getTime(), "Flow.PATM.Gated_Total") + + #FSUP + gateCalc.computeFlowGroup("SWT", "FSUP", startCal.getTime(), endCal.getTime(), "Flow.FSUP.Project_Total") + gateCalc.computeFlowGroup("SWT", "FSUP", startCal.getTime(), endCal.getTime(), "Flow.FSUP.Gated_Total") + + #CANT + gateCalc.computeFlowGroup("SWT", "CANT", startCal.getTime(), endCal.getTime(), "Flow.CANT.Project_Total") + gateCalc.computeFlowGroup("SWT", "CANT", startCal.getTime(), endCal.getTime(), "Flow.CANT.Gated_Total") + + #HUDS + gateCalc.computeFlowGroup("SWT", "HUDS", startCal.getTime(), endCal.getTime(), "Flow.HUDS.Project_Total") + gateCalc.computeFlowGroup("SWT", "HUDS", startCal.getTime(), endCal.getTime(), "Flow.HUDS.Turbine_Total") + gateCalc.computeFlowGroup("SWT", "HUDS", startCal.getTime(), endCal.getTime(), "Flow.HUDS.Gated_Total") + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/GateFlowGroup4.py b/district-scripts/SWT/GateFlowGroup4.py index 0a52c7e..c42c619 100644 --- a/district-scripts/SWT/GateFlowGroup4.py +++ b/district-scripts/SWT/GateFlowGroup4.py @@ -1,128 +1,138 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -5) -#startCal.add(Calendar.HOUR, -7) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -#endCal.add(Calendar.MONTH, -3) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") - - -# -# GROUP 4 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN 8 TO 9 MINUTES PAST THE TOP OF THE HOUR) -# - -#DENI -gateCalc.computeFlowGroup("SWT", "DENI", startCal.getTime(), endCal.getTime(), "Flow.DENI.Project_Total") -gateCalc.computeFlowGroup("SWT", "DENI", startCal.getTime(), endCal.getTime(), "Flow.DENI.Turbine_Total") -gateCalc.computeFlowGroup("SWT", "DENI", startCal.getTime(), endCal.getTime(), "Flow.DENI.Gated_Total") - -#PINE -gateCalc.computeFlowGroup("SWT", "PINE", startCal.getTime(), endCal.getTime(), "Flow.PINE.Project_Total") -gateCalc.computeFlowGroup("SWT", "PINE", startCal.getTime(), endCal.getTime(), "Flow.PINE.Gated_Total") - -#BROK -gateCalc.computeFlowGroup("SWT", "BROK", startCal.getTime(), endCal.getTime(), "Flow.BROK.Project_Total") -gateCalc.computeFlowGroup("SWT", "BROK", startCal.getTime(), endCal.getTime(), "Flow.BROK.Turbine_Total") -gateCalc.computeFlowGroup("SWT", "BROK", startCal.getTime(), endCal.getTime(), "Flow.BROK.Gated_Total") - -#SARD -gateCalc.computeFlowGroup("SWT", "SARD", startCal.getTime(), endCal.getTime(), "Flow.SARD.Project_Total") -gateCalc.computeFlowGroup("SWT", "SARD", startCal.getTime(), endCal.getTime(), "Flow.SARD.Gated_Total") - -#EUFA -gateCalc.computeFlowGroup("SWT", "EUFA", startCal.getTime(), endCal.getTime(), "Flow.EUFA.Project_Total") -gateCalc.computeFlowGroup("SWT", "EUFA", startCal.getTime(), endCal.getTime(), "Flow.EUFA.Turbine_Total") -gateCalc.computeFlowGroup("SWT", "EUFA", startCal.getTime(), endCal.getTime(), "Flow.EUFA.Gated_Total") - - - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + + # Defaults to start of the day 5 days ago, and ends at the top of the current hour today + # configure the start calendar + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -5) + #startCal.add(Calendar.HOUR, -7) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + + # configure the end calendar + endCal = Calendar.getInstance(timeZone) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + #endCal.add(Calendar.MONTH, -3) + + # Calendar can be adjusted using the following functions: + # startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. + # startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) + # startCal.set(Calendar.YEAR, 2020) # Sets the year + # startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) + + officeID = "SWT" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + + + # + # GROUP 4 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN 8 TO 9 MINUTES PAST THE TOP OF THE HOUR) + # + + #DENI + gateCalc.computeFlowGroup("SWT", "DENI", startCal.getTime(), endCal.getTime(), "Flow.DENI.Project_Total") + gateCalc.computeFlowGroup("SWT", "DENI", startCal.getTime(), endCal.getTime(), "Flow.DENI.Turbine_Total") + gateCalc.computeFlowGroup("SWT", "DENI", startCal.getTime(), endCal.getTime(), "Flow.DENI.Gated_Total") + + #PINE + gateCalc.computeFlowGroup("SWT", "PINE", startCal.getTime(), endCal.getTime(), "Flow.PINE.Project_Total") + gateCalc.computeFlowGroup("SWT", "PINE", startCal.getTime(), endCal.getTime(), "Flow.PINE.Gated_Total") + + #BROK + gateCalc.computeFlowGroup("SWT", "BROK", startCal.getTime(), endCal.getTime(), "Flow.BROK.Project_Total") + gateCalc.computeFlowGroup("SWT", "BROK", startCal.getTime(), endCal.getTime(), "Flow.BROK.Turbine_Total") + gateCalc.computeFlowGroup("SWT", "BROK", startCal.getTime(), endCal.getTime(), "Flow.BROK.Gated_Total") + + #SARD + gateCalc.computeFlowGroup("SWT", "SARD", startCal.getTime(), endCal.getTime(), "Flow.SARD.Project_Total") + gateCalc.computeFlowGroup("SWT", "SARD", startCal.getTime(), endCal.getTime(), "Flow.SARD.Gated_Total") + + #EUFA + gateCalc.computeFlowGroup("SWT", "EUFA", startCal.getTime(), endCal.getTime(), "Flow.EUFA.Project_Total") + gateCalc.computeFlowGroup("SWT", "EUFA", startCal.getTime(), endCal.getTime(), "Flow.EUFA.Turbine_Total") + gateCalc.computeFlowGroup("SWT", "EUFA", startCal.getTime(), endCal.getTime(), "Flow.EUFA.Gated_Total") + + + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/GateFlowGroup5.py b/district-scripts/SWT/GateFlowGroup5.py index 88d9996..f0133ba 100644 --- a/district-scripts/SWT/GateFlowGroup5.py +++ b/district-scripts/SWT/GateFlowGroup5.py @@ -1,113 +1,123 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -5) -#startCal.add(Calendar.HOUR, -7) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -#endCal.add(Calendar.MONTH, -3) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") - -# -# GROUP 5 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN 19 TO 21 MINUTES PAST THE TOP OF THE HOUR) -# - -#MCGE -gateCalc.computeFlowGroup("SWT", "MCGE", startCal.getTime(), endCal.getTime(), "Flow.MCGE.Project_Total") -gateCalc.computeFlowGroup("SWT", "MCGE", startCal.getTime(), endCal.getTime(), "Flow.MCGE.Gated_Total") - -#BIGH -gateCalc.computeFlowGroup("SWT", "BIGH", startCal.getTime(), endCal.getTime(), "Flow.BIGH.Project_Total") -gateCalc.computeFlowGroup("SWT", "BIGH", startCal.getTime(), endCal.getTime(), "Flow.BIGH.Gated_Total") - -#KEMP -gateCalc.computeFlowGroup("SWT", "KEMP", startCal.getTime(), endCal.getTime(), "Flow.KEMP.Project_Total") -gateCalc.computeFlowGroup("SWT", "KEMP", startCal.getTime(), endCal.getTime(), "Flow.KEMP.Gated_Total") +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + + # Defaults to start of the day 5 days ago, and ends at the top of the current hour today + # configure the start calendar + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -5) + #startCal.add(Calendar.HOUR, -7) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + + # configure the end calendar + endCal = Calendar.getInstance(timeZone) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + #endCal.add(Calendar.MONTH, -3) + + # Calendar can be adjusted using the following functions: + # startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. + # startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) + # startCal.set(Calendar.YEAR, 2020) # Sets the year + # startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) + + officeID = "SWT" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + + # + # GROUP 5 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN 19 TO 21 MINUTES PAST THE TOP OF THE HOUR) + # + + #MCGE + gateCalc.computeFlowGroup("SWT", "MCGE", startCal.getTime(), endCal.getTime(), "Flow.MCGE.Project_Total") + gateCalc.computeFlowGroup("SWT", "MCGE", startCal.getTime(), endCal.getTime(), "Flow.MCGE.Gated_Total") + + #BIGH + gateCalc.computeFlowGroup("SWT", "BIGH", startCal.getTime(), endCal.getTime(), "Flow.BIGH.Project_Total") + gateCalc.computeFlowGroup("SWT", "BIGH", startCal.getTime(), endCal.getTime(), "Flow.BIGH.Gated_Total") + + #KEMP + gateCalc.computeFlowGroup("SWT", "KEMP", startCal.getTime(), endCal.getTime(), "Flow.KEMP.Project_Total") + gateCalc.computeFlowGroup("SWT", "KEMP", startCal.getTime(), endCal.getTime(), "Flow.KEMP.Gated_Total") + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/GateFlowGroup6.py b/district-scripts/SWT/GateFlowGroup6.py index b3e4b90..933592d 100644 --- a/district-scripts/SWT/GateFlowGroup6.py +++ b/district-scripts/SWT/GateFlowGroup6.py @@ -1,146 +1,156 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -5) -#startCal.add(Calendar.HOUR, -7) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - - -#startCal.set(Calendar.YEAR, 2025) -#startCal.set(Calendar.MONTH, 0) #e.g. 6 ==July -#startCal.set(Calendar.DAY_OF_MONTH, 14) - - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -#endCal.add(Calendar.MONTH, -3) - - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") - - -# -# GROUP 6 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN 30 TO 33 MINUTES PAST THE TOP OF THE HOUR) -# - -#WDMA -gateCalc.computeFlowGroup("SWT", "WDMA", startCal.getTime(), endCal.getTime(), "Flow.WDMA.Project_Total") -gateCalc.computeFlowGroup("SWT", "WDMA", startCal.getTime(), endCal.getTime(), "Flow.WDMA.Gated_Total") - -#WEBB -gateCalc.computeFlowGroup("SWT", "WEBB", startCal.getTime(), endCal.getTime(), "Flow.WEBB.Project_Total") -gateCalc.computeFlowGroup("SWT", "WEBB", startCal.getTime(), endCal.getTime(), "Flow.WEBB.Turbine_Total") -gateCalc.computeFlowGroup("SWT", "WEBB", startCal.getTime(), endCal.getTime(), "Flow.WEBB.Gated_Total") - -#WIST -gateCalc.computeFlowGroup("SWT", "WIST", startCal.getTime(), endCal.getTime(), "Flow.WIST.Project_Total") -gateCalc.computeFlowGroup("SWT", "WIST", startCal.getTime(), endCal.getTime(), "Flow.WIST.Gated_Total") - -#TENK -gateCalc.computeFlowGroup("SWT", "TENK", startCal.getTime(), endCal.getTime(), "Flow.TENK.Project_Total") -gateCalc.computeFlowGroup("SWT", "TENK", startCal.getTime(), endCal.getTime(), "Flow.TENK.Turbine_Total") -gateCalc.computeFlowGroup("SWT", "TENK", startCal.getTime(), endCal.getTime(), "Flow.TENK.Gated_Total") - -#FGIB -gateCalc.computeFlowGroup("SWT", "FGIB", startCal.getTime(), endCal.getTime(), "Flow.FGIB.Project_Total") -gateCalc.computeFlowGroup("SWT", "FGIB", startCal.getTime(), endCal.getTime(), "Flow.FGIB.Turbine_Total") -gateCalc.computeFlowGroup("SWT", "FGIB", startCal.getTime(), endCal.getTime(), "Flow.FGIB.Gated_Total") +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + + # Defaults to start of the day 5 days ago, and ends at the top of the current hour today + # configure the start calendar + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -5) + #startCal.add(Calendar.HOUR, -7) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + + #startCal.set(Calendar.YEAR, 2025) + #startCal.set(Calendar.MONTH, 0) #e.g. 6 ==July + #startCal.set(Calendar.DAY_OF_MONTH, 14) + + + # configure the end calendar + endCal = Calendar.getInstance(timeZone) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + #endCal.add(Calendar.MONTH, -3) + + + # Calendar can be adjusted using the following functions: + # startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. + # startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) + # startCal.set(Calendar.YEAR, 2020) # Sets the year + # startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) + + officeID = "SWT" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + + + # + # GROUP 6 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN 30 TO 33 MINUTES PAST THE TOP OF THE HOUR) + # + + #WDMA + gateCalc.computeFlowGroup("SWT", "WDMA", startCal.getTime(), endCal.getTime(), "Flow.WDMA.Project_Total") + gateCalc.computeFlowGroup("SWT", "WDMA", startCal.getTime(), endCal.getTime(), "Flow.WDMA.Gated_Total") + + #WEBB + gateCalc.computeFlowGroup("SWT", "WEBB", startCal.getTime(), endCal.getTime(), "Flow.WEBB.Project_Total") + gateCalc.computeFlowGroup("SWT", "WEBB", startCal.getTime(), endCal.getTime(), "Flow.WEBB.Turbine_Total") + gateCalc.computeFlowGroup("SWT", "WEBB", startCal.getTime(), endCal.getTime(), "Flow.WEBB.Gated_Total") + + #WIST + gateCalc.computeFlowGroup("SWT", "WIST", startCal.getTime(), endCal.getTime(), "Flow.WIST.Project_Total") + gateCalc.computeFlowGroup("SWT", "WIST", startCal.getTime(), endCal.getTime(), "Flow.WIST.Gated_Total") + + #TENK + gateCalc.computeFlowGroup("SWT", "TENK", startCal.getTime(), endCal.getTime(), "Flow.TENK.Project_Total") + gateCalc.computeFlowGroup("SWT", "TENK", startCal.getTime(), endCal.getTime(), "Flow.TENK.Turbine_Total") + gateCalc.computeFlowGroup("SWT", "TENK", startCal.getTime(), endCal.getTime(), "Flow.TENK.Gated_Total") + + #FGIB + gateCalc.computeFlowGroup("SWT", "FGIB", startCal.getTime(), endCal.getTime(), "Flow.FGIB.Project_Total") + gateCalc.computeFlowGroup("SWT", "FGIB", startCal.getTime(), endCal.getTime(), "Flow.FGIB.Turbine_Total") + gateCalc.computeFlowGroup("SWT", "FGIB", startCal.getTime(), endCal.getTime(), "Flow.FGIB.Gated_Total") -#THUN -gateCalc.computeFlowGroup("SWT", "THUN", startCal.getTime(), endCal.getTime(), "Flow.THUN.Project_Total") -gateCalc.computeFlowGroup("SWT", "THUN", startCal.getTime(), endCal.getTime(), "Flow.THUN.Gated_Total") + #THUN + gateCalc.computeFlowGroup("SWT", "THUN", startCal.getTime(), endCal.getTime(), "Flow.THUN.Project_Total") + gateCalc.computeFlowGroup("SWT", "THUN", startCal.getTime(), endCal.getTime(), "Flow.THUN.Gated_Total") -#GSAL -gateCalc.computeFlowGroup("SWT", "GSAL", startCal.getTime(), endCal.getTime(), "Flow.GSAL.Project_Total") -gateCalc.computeFlowGroup("SWT", "GSAL", startCal.getTime(), endCal.getTime(), "Flow.GSAL.Gated_Total") + #GSAL + gateCalc.computeFlowGroup("SWT", "GSAL", startCal.getTime(), endCal.getTime(), "Flow.GSAL.Project_Total") + gateCalc.computeFlowGroup("SWT", "GSAL", startCal.getTime(), endCal.getTime(), "Flow.GSAL.Gated_Total") -#PENS -gateCalc.computeFlowGroup("SWT", "PENS", startCal.getTime(), endCal.getTime(), "Flow.PENS.Project_Total") -gateCalc.computeFlowGroup("SWT", "PENS", startCal.getTime(), endCal.getTime(), "Flow.PENS.Turbine_Total") -gateCalc.computeFlowGroup("SWT", "PENS", startCal.getTime(), endCal.getTime(), "Flow.PENS.Gated_Total") + #PENS + gateCalc.computeFlowGroup("SWT", "PENS", startCal.getTime(), endCal.getTime(), "Flow.PENS.Project_Total") + gateCalc.computeFlowGroup("SWT", "PENS", startCal.getTime(), endCal.getTime(), "Flow.PENS.Turbine_Total") + gateCalc.computeFlowGroup("SWT", "PENS", startCal.getTime(), endCal.getTime(), "Flow.PENS.Gated_Total") + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/GateFlowGroup7.py b/district-scripts/SWT/GateFlowGroup7.py index dcd3f19..21a0f89 100644 --- a/district-scripts/SWT/GateFlowGroup7.py +++ b/district-scripts/SWT/GateFlowGroup7.py @@ -1,139 +1,149 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -5) -#startCal.add(Calendar.HOUR, -7) -#remove or comment out the next line when done!! it was for a big backload ajm -#startCal.add(Calendar.MONTH, -10) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") - - -# -# GROUP 7 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN 33 TO 36 MINUTES PAST THE TOP OF THE HOUR) -# - -#CHOU -gateCalc.computeFlowGroup("SWT", "CHOU", startCal.getTime(), endCal.getTime(), "Flow.CHOU.Project_Total") -gateCalc.computeFlowGroup("SWT", "CHOU", startCal.getTime(), endCal.getTime(), "Flow.CHOU.Gated_Total") - -#NEWT -gateCalc.computeFlowGroup("SWT", "NEWT", startCal.getTime(), endCal.getTime(), "Flow.NEWT.Project_Total") -gateCalc.computeFlowGroup("SWT", "NEWT", startCal.getTime(), endCal.getTime(), "Flow.NEWT.Gated_Total") - -#TOMS -gateCalc.computeFlowGroup("SWT", "TOMS", startCal.getTime(), endCal.getTime(), "Flow.TOMS.Project_Total") -gateCalc.computeFlowGroup("SWT", "TOMS", startCal.getTime(), endCal.getTime(), "Flow.TOMS.Gated_Total") - -#TORO -gateCalc.computeFlowGroup("SWT", "TORO", startCal.getTime(), endCal.getTime(), "Flow.TORO.Project_Total") -gateCalc.computeFlowGroup("SWT", "TORO", startCal.getTime(), endCal.getTime(), "Flow.TORO.Gated_Total") - -#ALTU -gateCalc.computeFlowGroup("SWT", "ALTU", startCal.getTime(), endCal.getTime(), "Flow.ALTU.Project_Total") -gateCalc.computeFlowGroup("SWT", "ALTU", startCal.getTime(), endCal.getTime(), "Flow.ALTU.Gated_Total") - -#ELDR -gateCalc.computeFlowGroup("SWT", "ELDR", startCal.getTime(), endCal.getTime(), "Flow.ELDR.Project_Total") -gateCalc.computeFlowGroup("SWT", "ELDR", startCal.getTime(), endCal.getTime(), "Flow.ELDR.Gated_Total") - -#CHEN -gateCalc.computeFlowGroup("SWT", "CHEN", startCal.getTime(), endCal.getTime(), "Flow.CHEN.Project_Total") -gateCalc.computeFlowGroup("SWT", "CHEN", startCal.getTime(), endCal.getTime(), "Flow.CHEN.Gated_Total") +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + + # Defaults to start of the day 5 days ago, and ends at the top of the current hour today + # configure the start calendar + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -5) + #startCal.add(Calendar.HOUR, -7) + #remove or comment out the next line when done!! it was for a big backload ajm + #startCal.add(Calendar.MONTH, -10) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + + # configure the end calendar + endCal = Calendar.getInstance(timeZone) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + + # Calendar can be adjusted using the following functions: + # startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. + # startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) + # startCal.set(Calendar.YEAR, 2020) # Sets the year + # startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) + + officeID = "SWT" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + + + # + # GROUP 7 PROJECTS (SELF-TIMED TRANSMISSIONS WITHIN 33 TO 36 MINUTES PAST THE TOP OF THE HOUR) + # + + #CHOU + gateCalc.computeFlowGroup("SWT", "CHOU", startCal.getTime(), endCal.getTime(), "Flow.CHOU.Project_Total") + gateCalc.computeFlowGroup("SWT", "CHOU", startCal.getTime(), endCal.getTime(), "Flow.CHOU.Gated_Total") + + #NEWT + gateCalc.computeFlowGroup("SWT", "NEWT", startCal.getTime(), endCal.getTime(), "Flow.NEWT.Project_Total") + gateCalc.computeFlowGroup("SWT", "NEWT", startCal.getTime(), endCal.getTime(), "Flow.NEWT.Gated_Total") + + #TOMS + gateCalc.computeFlowGroup("SWT", "TOMS", startCal.getTime(), endCal.getTime(), "Flow.TOMS.Project_Total") + gateCalc.computeFlowGroup("SWT", "TOMS", startCal.getTime(), endCal.getTime(), "Flow.TOMS.Gated_Total") + + #TORO + gateCalc.computeFlowGroup("SWT", "TORO", startCal.getTime(), endCal.getTime(), "Flow.TORO.Project_Total") + gateCalc.computeFlowGroup("SWT", "TORO", startCal.getTime(), endCal.getTime(), "Flow.TORO.Gated_Total") + + #ALTU + gateCalc.computeFlowGroup("SWT", "ALTU", startCal.getTime(), endCal.getTime(), "Flow.ALTU.Project_Total") + gateCalc.computeFlowGroup("SWT", "ALTU", startCal.getTime(), endCal.getTime(), "Flow.ALTU.Gated_Total") + + #ELDR + gateCalc.computeFlowGroup("SWT", "ELDR", startCal.getTime(), endCal.getTime(), "Flow.ELDR.Project_Total") + gateCalc.computeFlowGroup("SWT", "ELDR", startCal.getTime(), endCal.getTime(), "Flow.ELDR.Gated_Total") -#JOHN -gateCalc.computeFlowGroup("SWT", "JOHN", startCal.getTime(), endCal.getTime(), "Flow.JOHN.Project_Total") -gateCalc.computeFlowGroup("SWT", "JOHN", startCal.getTime(), endCal.getTime(), "Flow.JOHN.Gated_Total") + #CHEN + gateCalc.computeFlowGroup("SWT", "CHEN", startCal.getTime(), endCal.getTime(), "Flow.CHEN.Project_Total") + gateCalc.computeFlowGroup("SWT", "CHEN", startCal.getTime(), endCal.getTime(), "Flow.CHEN.Gated_Total") + #JOHN + gateCalc.computeFlowGroup("SWT", "JOHN", startCal.getTime(), endCal.getTime(), "Flow.JOHN.Project_Total") + gateCalc.computeFlowGroup("SWT", "JOHN", startCal.getTime(), endCal.getTime(), "Flow.JOHN.Gated_Total") + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/GateFlowGroup8.py b/district-scripts/SWT/GateFlowGroup8.py index 965ff26..83c0b4b 100644 --- a/district-scripts/SWT/GateFlowGroup8.py +++ b/district-scripts/SWT/GateFlowGroup8.py @@ -1,107 +1,117 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -5) -#startCal.add(Calendar.HOUR, -7) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -#endCal.add(Calendar.MONTH, -3) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") - - -# -# GROUP 8 PROJECTS (SELF-TIMED TRANSMISSIONS FROM 42 MINUTES PAST THE TOP OF THE HOUR TO THE END OF THE HOUR) -# - -#MERE -gateCalc.computeFlowGroup("SWT", "MERE", startCal.getTime(), endCal.getTime(), "Flow.MERE.Project_Total") -gateCalc.computeFlowGroup("SWT", "MERE", startCal.getTime(), endCal.getTime(), "Flow.MERE.Gated_Total") - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + + # Defaults to start of the day 5 days ago, and ends at the top of the current hour today + # configure the start calendar + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -5) + #startCal.add(Calendar.HOUR, -7) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + + # configure the end calendar + endCal = Calendar.getInstance(timeZone) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + #endCal.add(Calendar.MONTH, -3) + + # Calendar can be adjusted using the following functions: + # startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. + # startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) + # startCal.set(Calendar.YEAR, 2020) # Sets the year + # startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) + + officeID = "SWT" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + + + # + # GROUP 8 PROJECTS (SELF-TIMED TRANSMISSIONS FROM 42 MINUTES PAST THE TOP OF THE HOUR TO THE END OF THE HOUR) + # + + #MERE + gateCalc.computeFlowGroup("SWT", "MERE", startCal.getTime(), endCal.getTime(), "Flow.MERE.Project_Total") + gateCalc.computeFlowGroup("SWT", "MERE", startCal.getTime(), endCal.getTime(), "Flow.MERE.Gated_Total") + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/GateFlowGroup9.py b/district-scripts/SWT/GateFlowGroup9.py index 057e5d3..44550e5 100644 --- a/district-scripts/SWT/GateFlowGroup9.py +++ b/district-scripts/SWT/GateFlowGroup9.py @@ -1,108 +1,118 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -5) -#startCal.add(Calendar.HOUR, -7) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -#endCal.add(Calendar.MONTH, -3) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") - - -# -# GROUP 9 PROJECTS (SELF-TIMED TRANSMISSIONS FROM 42 MINUTES PAST THE TOP OF THE HOUR TO THE END OF THE HOUR) -# - -#KEYS -gateCalc.computeFlowGroup("SWT", "KEYS", startCal.getTime(), endCal.getTime(), "Flow.KEYS.Project_Total") -gateCalc.computeFlowGroup("SWT", "KEYS", startCal.getTime(), endCal.getTime(), "Flow.KEYS.Turbine_Total") -gateCalc.computeFlowGroup("SWT", "KEYS", startCal.getTime(), endCal.getTime(), "Flow.KEYS.Gated_Total") - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + + # Defaults to start of the day 5 days ago, and ends at the top of the current hour today + # configure the start calendar + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -5) + #startCal.add(Calendar.HOUR, -7) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + + # configure the end calendar + endCal = Calendar.getInstance(timeZone) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + #endCal.add(Calendar.MONTH, -3) + + # Calendar can be adjusted using the following functions: + # startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. + # startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) + # startCal.set(Calendar.YEAR, 2020) # Sets the year + # startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) + + officeID = "SWT" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + + + # + # GROUP 9 PROJECTS (SELF-TIMED TRANSMISSIONS FROM 42 MINUTES PAST THE TOP OF THE HOUR TO THE END OF THE HOUR) + # + + #KEYS + gateCalc.computeFlowGroup("SWT", "KEYS", startCal.getTime(), endCal.getTime(), "Flow.KEYS.Project_Total") + gateCalc.computeFlowGroup("SWT", "KEYS", startCal.getTime(), endCal.getTime(), "Flow.KEYS.Turbine_Total") + gateCalc.computeFlowGroup("SWT", "KEYS", startCal.getTime(), endCal.getTime(), "Flow.KEYS.Gated_Total") + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/GateFlowHUDS-WS.py b/district-scripts/SWT/GateFlowHUDS-WS.py index bf31415..4332238 100644 --- a/district-scripts/SWT/GateFlowHUDS-WS.py +++ b/district-scripts/SWT/GateFlowHUDS-WS.py @@ -1,105 +1,115 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.add(Calendar.DAY_OF_MONTH, -5) -startCal.add(Calendar.HOUR, -7) -#remove or comment out the next line when done!! it was for a big backload ajm -#startCal.add(Calendar.MONTH, -5) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) -#endCal.add(Calendar.MONTH, -3) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") - -#HUDS -gateCalc.computeFlowGroup("SWT", "HUDS", startCal.getTime(), endCal.getTime(), "Flow.HUDS.Pump_Out_Total") -gateCalc.computeFlowGroup("SWT", "HUDS", startCal.getTime(), endCal.getTime(), "Flow.HUDS.Pump_In_Total") - - +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from java.util import TimeZone + from usace.rowcps.headless import LoggingOptions + + def compute_All_Flowgroups(officeID, location, startCal, endCal): + # Takes in locations defined by user in group and computes all flow groups + try: + gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) + except Exception as e: + print("Error Computing all Flow Groups at {0} {1}".format(officeID, location)) + print(e) + print('') + + + def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): + try: + gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) + except Exception as e: + print("Error Computing Flow Group {0} at {1}".format(officeID, location)) + print(e) + print('') + + # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + # LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # Time zone must be set because the Solaris time zone is UTC + timeZone = TimeZone.getTimeZone("US/Central") + + # Defaults to start of the day 5 days ago, and ends at the top of the current hour today + # configure the start calendar + startCal = Calendar.getInstance(timeZone) + startCal.add(Calendar.DAY_OF_MONTH, -5) + startCal.add(Calendar.HOUR, -7) + #remove or comment out the next line when done!! it was for a big backload ajm + #startCal.add(Calendar.MONTH, -5) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + + # configure the end calendar + endCal = Calendar.getInstance(timeZone) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + #endCal.add(Calendar.MONTH, -3) + + # Calendar can be adjusted using the following functions: + # startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. + # startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) + # startCal.set(Calendar.YEAR, 2020) # Sets the year + # startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) + + officeID = "SWT" + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + # gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") + + #HUDS + gateCalc.computeFlowGroup("SWT", "HUDS", startCal.getTime(), endCal.getTime(), "Flow.HUDS.Pump_Out_Total") + gateCalc.computeFlowGroup("SWT", "HUDS", startCal.getTime(), endCal.getTime(), "Flow.HUDS.Pump_In_Total") + + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/SWT/WaterSupplyFlowGroup.py b/district-scripts/SWT/WaterSupplyFlowGroup.py index 79cc59e..8a7bb02 100644 --- a/district-scripts/SWT/WaterSupplyFlowGroup.py +++ b/district-scripts/SWT/WaterSupplyFlowGroup.py @@ -1,130 +1,140 @@ -from java.util import Calendar -from usace.rowcps.headless import LoggingOptions - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -#LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# the gate flow calculations requires a start and end time. -# here we create a java Calendar object that will be used to create the start Date -# -# use the current date minus 5 days. -# -startCal = Calendar.getInstance() -#startCal.clear() -#startCal.set(Calendar.YEAR, 2016) -#startCal.set(Calendar.MONTH, 8) -startCal.add(Calendar.DAY_OF_MONTH, -5) -#startCal.set(Calendar.HOUR, 0) -#startCal.add(Calendar.HOUR, -4) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - -print "this is the place to write the startCal!" -print startCal.getTime().toString() - -# create a java Calendar object that will be used to create the end Date -# use the current date. -# -endCal = Calendar.getInstance() -#remove the next line when the headless time options are fixed -#endCal.add(Calendar.DAY_OF_MONTH, 1) -#endCal.set(Calendar.HOUR, 16) -#endCal.set(Calendar.YEAR, 2018) -#endCal.set(Calendar.MONTH, 6) -#endCal.set(Calendar.DAY_OF_MONTH, 6) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) - -print "this is the place to write the endCal!" -print endCal.getTime().toString() - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate - - -# -# PROJECTS WITH WATER SUPPLY WITHDRAWS/RELEASES -# - - -#ARBU -gateCalc.computeFlowGroup("SWT", "ARBU", startCal.getTime(), endCal.getTime(), "Flow.ARBU.Pump_Out_Total") - -#ARCA -gateCalc.computeFlowGroup("SWT", "ARCA", startCal.getTime(), endCal.getTime(), "Flow.ARCA.Pump_Out_Total") - -#CHEN -gateCalc.computeFlowGroup("SWT", "CHEN", startCal.getTime(), endCal.getTime(), "Flow.CHEN.Pump_Out_Total") - -#ELDR -gateCalc.computeFlowGroup("SWT", "ELDR", startCal.getTime(), endCal.getTime(), "Flow.ELDR.Pump_Out_Total") - -#FCOB -gateCalc.computeFlowGroup("SWT", "FCOB", startCal.getTime(), endCal.getTime(), "Flow.FCOB.Pump_Out_Total") - -#FOSS -gateCalc.computeFlowGroup("SWT", "FOSS", startCal.getTime(), endCal.getTime(), "Flow.FOSS.Pump_Out_Total") - -#MCGE -gateCalc.computeFlowGroup("SWT", "MCGE", startCal.getTime(), endCal.getTime(), "Flow.MCGE.Pump_Out_Total") - -#MERE -gateCalc.computeFlowGroup("SWT", "MERE", startCal.getTime(), endCal.getTime(), "Flow.MERE.Pump_Out_Total") - -#OOLO -gateCalc.computeFlowGroup("SWT", "OOLO", startCal.getTime(), endCal.getTime(), "Flow.OOLO.Pump_Out_Total") +from regi_python import regi_session, run_headless + + +def run_calculations(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar + from usace.rowcps.headless import LoggingOptions + + # Description of: LoggingOptions.setDbMessageLevel(int level) + # + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended + # level is 2, as this provides basic information about the time series + # retrieval/storage. + # + # Message Level | Description + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + # <=0 | Default value, does not do anything. Lower values do not change behavior. | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | + # 2 | Adds message with name of time series, and the units to retrieve/store. | + # 3 | Adds message with the current time. | + # 4 | Adds message with first 10 dates and values from each time series. | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| + + LoggingOptions.setDbMessageLevel(2) + + + # Description of: LoggingOptions.setMetricsEnabled(boolean value) + # + # Enables or disables the storage of REGI's Metric data pertaining to the + # performance of the application. This is incredibly helpful for identifying + # issues where the application takes an excessive amount of time to operate. + # + # Metrics also log the location of the files as an INFO message if they are + # enabled. + # + # By default, Metrics are disabled. + + #LoggingOptions.setMetricsEnabled(True) + + # not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of + # the implemented scriptable calculations + names = registry.getNames(1.0) + + # this retrieves a Gate Flow calculation object + gateCalc = registry.getCalculation(1.0, "Gate Flow") + + # the gate flow calculations requires a start and end time. + # here we create a java Calendar object that will be used to create the start Date + # + # use the current date minus 5 days. + # + startCal = Calendar.getInstance() + #startCal.clear() + #startCal.set(Calendar.YEAR, 2016) + #startCal.set(Calendar.MONTH, 8) + startCal.add(Calendar.DAY_OF_MONTH, -5) + #startCal.set(Calendar.HOUR, 0) + #startCal.add(Calendar.HOUR, -4) + startCal.set(Calendar.MINUTE, 0) + startCal.set(Calendar.SECOND, 0) + startCal.set(Calendar.MILLISECOND, 0) + + print("this is the place to write the startCal!") + print(startCal.getTime().toString()) + + # create a java Calendar object that will be used to create the end Date + # use the current date. + # + endCal = Calendar.getInstance() + #remove the next line when the headless time options are fixed + #endCal.add(Calendar.DAY_OF_MONTH, 1) + #endCal.set(Calendar.HOUR, 16) + #endCal.set(Calendar.YEAR, 2018) + #endCal.set(Calendar.MONTH, 6) + #endCal.set(Calendar.DAY_OF_MONTH, 6) + endCal.set(Calendar.MINUTE, 0) + endCal.set(Calendar.SECOND, 0) + endCal.set(Calendar.MILLISECOND, 0) + + print("this is the place to write the endCal!") + print(endCal.getTime().toString()) + + # the gateCalc object can perform its calculation for a single flow group + # the computeFlowGroup method takes: + # officeId + # projectId + # startDate + # endDate + + + # + # PROJECTS WITH WATER SUPPLY WITHDRAWS/RELEASES + # + + + #ARBU + gateCalc.computeFlowGroup("SWT", "ARBU", startCal.getTime(), endCal.getTime(), "Flow.ARBU.Pump_Out_Total") + + #ARCA + gateCalc.computeFlowGroup("SWT", "ARCA", startCal.getTime(), endCal.getTime(), "Flow.ARCA.Pump_Out_Total") + + #CHEN + gateCalc.computeFlowGroup("SWT", "CHEN", startCal.getTime(), endCal.getTime(), "Flow.CHEN.Pump_Out_Total") + + #ELDR + gateCalc.computeFlowGroup("SWT", "ELDR", startCal.getTime(), endCal.getTime(), "Flow.ELDR.Pump_Out_Total") + + #FCOB + gateCalc.computeFlowGroup("SWT", "FCOB", startCal.getTime(), endCal.getTime(), "Flow.FCOB.Pump_Out_Total") + + #FOSS + gateCalc.computeFlowGroup("SWT", "FOSS", startCal.getTime(), endCal.getTime(), "Flow.FOSS.Pump_Out_Total") + + #MCGE + gateCalc.computeFlowGroup("SWT", "MCGE", startCal.getTime(), endCal.getTime(), "Flow.MCGE.Pump_Out_Total") + + #MERE + gateCalc.computeFlowGroup("SWT", "MERE", startCal.getTime(), endCal.getTime(), "Flow.MERE.Pump_Out_Total") -#PATM -gateCalc.computeFlowGroup("SWT", "PATM", startCal.getTime(), endCal.getTime(), "Flow.PATM.Pump_Out_Total") + #OOLO + gateCalc.computeFlowGroup("SWT", "OOLO", startCal.getTime(), endCal.getTime(), "Flow.OOLO.Pump_Out_Total") -#THUN -gateCalc.computeFlowGroup("SWT", "THUN", startCal.getTime(), endCal.getTime(), "Flow.THUN.Pump_Out_Total") - -#TOMS -gateCalc.computeFlowGroup("SWT", "TOMS", startCal.getTime(), endCal.getTime(), "Flow.TOMS.Pump_Out_Total") - -#WAUR -gateCalc.computeFlowGroup("SWT", "WAUR", startCal.getTime(), endCal.getTime(), "Flow.WAUR.Pump_Out_Total") + #PATM + gateCalc.computeFlowGroup("SWT", "PATM", startCal.getTime(), endCal.getTime(), "Flow.PATM.Pump_Out_Total") + #THUN + gateCalc.computeFlowGroup("SWT", "THUN", startCal.getTime(), endCal.getTime(), "Flow.THUN.Pump_Out_Total") + + #TOMS + gateCalc.computeFlowGroup("SWT", "TOMS", startCal.getTime(), endCal.getTime(), "Flow.TOMS.Pump_Out_Total") + + #WAUR + gateCalc.computeFlowGroup("SWT", "WAUR", startCal.getTime(), endCal.getTime(), "Flow.WAUR.Pump_Out_Total") + + + +if __name__ == "__main__": + with regi_session(): + run_headless(run_calculations) diff --git a/district-scripts/legacy-examples/solaris/GateFlow.py b/district-scripts/legacy-examples/solaris/GateFlow.py deleted file mode 100644 index ef36bec..0000000 --- a/district-scripts/legacy-examples/solaris/GateFlow.py +++ /dev/null @@ -1,195 +0,0 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -# the gate flow calculations requires a start and end time. -# here we create a java Calendar object that will be used to create the start Date -startCal = Calendar.getInstance(timeZone) -# startCal.clear() -startCal.add(Calendar.DAY_OF_MONTH, -6) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -# startCal.set(Calendar.YEAR, 2015) -# startCal.set(Calendar.MONTH, 9) - -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance(timeZone) -# endCal.clear() -endCal.add(Calendar.DAY_OF_MONTH, 5) -endCal.set(Calendar.HOUR_OF_DAY, 0) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -# endCal.set(Calendar.YEAR, 2015) -# endCal.set(Calendar.MONTH, 11) - -officeID = "SWF" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") -# By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out -# or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate -# by changing the "flowGroup" variable. -calculateSingleFlowGroups = True -flowGroup = "ConduitGate_Total" -locationList = ["ACTT2", - "ALAT2", - "BDWT2", - "BLNT2", - "BNBT2", - "CLDL1", - "DAWT2", -# "GGLT2", -# "GNGT2", -# "GPVT2", -# "HORT2", -# "JFNT2", -# "JPLT2", -# "JSPT2", -# "LEWT2", -# "LVNT2", -# "PCTT2", -# "RRLT2", -# "FRHT2", -# "SCLT2", -# "SMCT2", -# "SOMT2", -# "STIT2", -# "TXKT2", -# "WTYT2", -# "TRNT2", -# "FFLT2", -# "BPRT2", -# "EAMT2", -# "FLWT2", -# "LLST2", -# "GBYT2", -# "PSMT2", -# "TBLT2", -# "TBRT2", -# "GPET2", -# "BSLT2", -# "SAGT2", -# "MSDT2", - ] - -# the calculation can also be performed for all the associated groups -# the computeAll method takes: -# officeId -# projectId -# startDate -# endDate -# By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. -# Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. - -calculateAllFlowGroups = True -FlowGroupList = ["ACTT2", - "ALAT2", - "BDWT2", - "BLNT2", - "BNBT2", - "DAWT2", - "GGLT2", -# "GNGT2", -# "GPVT2", -# "HORT2", -# "JPLT2", -# "LEWT2", -# "LVNT2", -# "PCTT2", -# "RRLT2", -# "FRHT2", -# "SCLT2", -# "SMCT2", -# "SOMT2", -# "STIT2", -# "TXKT2", -# "WTYT2", -# "TRNT2", -# "FFLT2", -# "EAMT2", -# "FLWT2", -# "LLST2", -# "GBYT2", -# "PSMT2", -# "SAGT2", - ] - - -if calculateSingleFlowGroups: - for location in locationList: - print "Now Running", location, "SINGLE" - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup) - -if calculateAllFlowGroups: - for location in FlowGroupList: - print "Now Running", location, "GROUP" - compute_All_Flowgroups(officeID, location, startCal, endCal) - - - diff --git a/district-scripts/legacy-examples/solaris/GateSettings.py b/district-scripts/legacy-examples/solaris/GateSettings.py deleted file mode 100644 index e061cbd..0000000 --- a/district-scripts/legacy-examples/solaris/GateSettings.py +++ /dev/null @@ -1,75 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Gate Settings object -gateSettings = registry.getCalculation(1.0, "Gate Settings") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.clear() -endCal.set(Calendar.YEAR, 2015) -endCal.set(Calendar.MONTH, 6) - - -# gateSettings contains four callable methods -# void createGateSettings(String officeId, String locationStr, Date startDate, Date end) throws Exception; -# void createGateSettingsGroup(String officeId, String locationStr, Date startDate, Date end, String groupId) throws Exception; -# void createGateSettingsOutlet(String officeId, String locationStr, Date startDate, Date end, String outletId) throws Exception; -# void createGateSettingsOutletFromTs(String officeId, String locationStr, Date startDate, Date end, String outletId, String tsId) throws Exception; - -# This is an example of a call that would create gate settings at TainterGate 1 at WTYT2 from the specified input time series. -gateSettings.createGateSettingsOutletFromTs("SWF", "WTYT2", startCal.getTime(), endCal.getTime(), "TG1", "WTYT2-TG1.Opening-Spillway_Gate.Const.0.0.MANUAL" ) - -# This is an example of a call that would create gate settings at TainterGate 1 at WTYT2 from the regi association configured input time series. -gateSettings.createGateSettingsOutlet("SWF", "WTYT2", startCal.getTime(), endCal.getTime(), "TG1") - -# This is an example of a call that would create gate settings at all outlets at WTYT2 which are in the TainterGateWTY group from the association configured time series. -gateSettings.createGateSettingsGroup("SWF", "WTYT2", startCal.getTime(), endCal.getTime(), "WTYT2-TainterGateWTY" ) - -# This is an example of a call that would create gate settings for every outlet in a rating group at WTYT2. -gateSettings.createGateSettings("SWF", "WTYT2", startCal.getTime(), endCal.getTime() ) - - - diff --git a/district-scripts/legacy-examples/solaris/GateSettings.sh b/district-scripts/legacy-examples/solaris/GateSettings.sh deleted file mode 100644 index e33d758..0000000 --- a/district-scripts/legacy-examples/solaris/GateSettings.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./RunHeadlessJython.sh -f ..//examples//GateSettings.py diff --git a/district-scripts/legacy-examples/solaris/InflowAutoAdjust.sh b/district-scripts/legacy-examples/solaris/InflowAutoAdjust.sh deleted file mode 100644 index 482bf5a..0000000 --- a/district-scripts/legacy-examples/solaris/InflowAutoAdjust.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./RunHeadlessJython.sh -f ..//examples//InflowCalcAutoAdjust.py diff --git a/district-scripts/legacy-examples/solaris/InflowBalanceAll.sh b/district-scripts/legacy-examples/solaris/InflowBalanceAll.sh deleted file mode 100644 index 971daf8..0000000 --- a/district-scripts/legacy-examples/solaris/InflowBalanceAll.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./RunHeadlessJython.sh -f ..//examples//InflowCalcBalanceAll.py diff --git a/district-scripts/legacy-examples/solaris/InflowCalcAutoAdjust.py b/district-scripts/legacy-examples/solaris/InflowCalcAutoAdjust.py deleted file mode 100644 index f35ac31..0000000 --- a/district-scripts/legacy-examples/solaris/InflowCalcAutoAdjust.py +++ /dev/null @@ -1,98 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - - -def auto_Adjust(officeID, location, startCal, useLimits, freezeRain): - # Takes in locations defined by user in group and adjusts the selected inflow. If a location fails or has an error, the script will continue. check the console log - # for any further information. - try: - inflowCalc.autoAdjust(officeID, location, startCal.getTime(), useLimits, freezeRain) - except Exception as e: - print "Error Adjusting Values at {0} {1}".format(officeID, location) - print e - print "" - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar - -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoAdjusts for ACTT2 and ALAT2. Several locations are commented out and can be commented back in any order. Additional stations can be added -# to the end provided they follow the same format. UseLimits and FreezeRain are also controllable arguments for AutoAdjust. By setting "useLimits_ON" to True, -# the function will use the "useLimits command. By setting it to "False", it will be turned off. This functions the same way for "freezeRain_ON" - -officeID = "SWF" -useLimits_ON = False -freezeRain_ON = False -locationList = ["ACTT2", - "ALAT2", -# "BLNT2", -# "BNBT2", -# "CLDL1", -# "DAWT2", - "ACTT2", - "TXKT2", - ] -for location in locationList: - print "Now Running", location - auto_Adjust(officeID, location, startCal, useLimits_ON, freezeRain_ON) - - - diff --git a/district-scripts/legacy-examples/solaris/InflowCalcBalanceAll.py b/district-scripts/legacy-examples/solaris/InflowCalcBalanceAll.py deleted file mode 100644 index 895c5ff..0000000 --- a/district-scripts/legacy-examples/solaris/InflowCalcBalanceAll.py +++ /dev/null @@ -1,91 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def balance_all(officeID, location, startCal): - # Takes in locations defined by user in group and balances the selected inflow - try: - inflowCalc.balanceAll(officeID, location, startCal.getTime()) - except Exception as e: - print "Error Computing Balance all at {0} {1}".format(officeID, location) - print e - print "" - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar - -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 1) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the followind arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoBalances for ACTT2 and ALAT2. Several locations are commented out and can be commented back in any order. Additonial stations can be added -# to the end provided they follow the same format. -officeID = "SWF" -locationList = ["ACTT2", - "ALAT2", -# "BLNT2", -# "BNBT2", -# "CLDL1", -# "DAWT2", - "ACTT2", - "TXKT2", - ] -for location in locationList: - print "Now Running", location - balance_all(officeID, location, startCal) - - diff --git a/district-scripts/legacy-examples/solaris/InflowCalcClone.py b/district-scripts/legacy-examples/solaris/InflowCalcClone.py deleted file mode 100644 index 2207b7c..0000000 --- a/district-scripts/legacy-examples/solaris/InflowCalcClone.py +++ /dev/null @@ -1,90 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def clone_Inflows(officeID, location, startCal): - # Takes in locations defined by user in group and clones the selected inflow - try: - inflowCalc.cloneInflows(officeID, location, startCal.getTime()) - except Exception as e: - print "Error Cloning Inflows at {0} {1}".format(officeID, location) - print e - print "" - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar - -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 3) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This clones inflow for ACTT2 and ALAT2. Several locations are commented out and can be commented back in any order. Additional stations can be added -# to the end provided they follow the same format. -officeID = "SWF" -locationList = ["ACTT2", - "ALAT2", -# "BLNT2", -# "BNBT2", -# "CLDL1", -# "DAWT2", - "ACTT2", - ] -for location in locationList: - print "Now Running", location - clone_Inflows(officeID, location, startCal) - - diff --git a/district-scripts/legacy-examples/solaris/InflowCalcComputeEvapAsFlow.py b/district-scripts/legacy-examples/solaris/InflowCalcComputeEvapAsFlow.py deleted file mode 100644 index 3ab7b56..0000000 --- a/district-scripts/legacy-examples/solaris/InflowCalcComputeEvapAsFlow.py +++ /dev/null @@ -1,23 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 4) - -endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -endCal.clear() -endCal.set(Calendar.YEAR, 2018) -endCal.set(Calendar.MONTH, 4) -endCal.set(Calendar.DAY_OF_MONTH, 4) - -# This computes and saves evap as flow for EUFA in May 2018 -inflowCalc.computeEvapAsFlow("SWT", "EUFA", startCal.getTime(), endCal.getTime()) \ No newline at end of file diff --git a/district-scripts/legacy-examples/solaris/InflowCalcComputedInflow.py b/district-scripts/legacy-examples/solaris/InflowCalcComputedInflow.py deleted file mode 100644 index faf1ce4..0000000 --- a/district-scripts/legacy-examples/solaris/InflowCalcComputedInflow.py +++ /dev/null @@ -1,25 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.calculator.inflow import InflowComputationStorageOption - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 4) - -endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -endCal.clear() -endCal.set(Calendar.YEAR, 2018) -endCal.set(Calendar.MONTH, 4) -endCal.set(Calendar.DAY_OF_MONTH, 4) - -# This computes and saves inflow for EUFA in May 2018 -# computeInflow saves the Computed Inflow, Evaporation as Flow, and Project Total Flow Group time series data -inflowCalc.computeInflow("SWT", "EUFA", startCal.getTime(), endCal.getTime()) diff --git a/district-scripts/legacy-examples/solaris/InflowCalcMultipleActions.py b/district-scripts/legacy-examples/solaris/InflowCalcMultipleActions.py deleted file mode 100644 index e73296b..0000000 --- a/district-scripts/legacy-examples/solaris/InflowCalcMultipleActions.py +++ /dev/null @@ -1,106 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def inflow_Actions(function, officeID, location, startCal, uselimits, freezerain): - # Takes in locations defined by user in group and computes the given command at the given station. - try: - if function.lower() == "cloneinflows": - inflowCalc.cloneInflows(officeID, location, startCal.getTime()) - elif function.lower() == "zeronegatives": - inflowCalc.zeroNegatives(officeID, location, startCal.getTime()) - elif function.lower() == "balanceall": - inflowCalc.balanceAll(officeID, location, startCal.getTime()) - elif function.lower() == "autoadjust": - inflowCalc.autoAdjust(officeID, location, startCal.getTime(), uselimits, freezerain) - else: - print "Input command", function, "is not recognized. Please edit your input and try again." - except Exception as e: - print "Error Completing action {0} at {1} {2}".format(function, officeID, location) - print e - print "" -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar' -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) - -officeID = "SWF" - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# UseLimits and FreezeRain are also controllable arguments for AutoAdjust. By setting "useLimits_ON" to True, -# the function will use the "useLimits command. By setting it to "False", it will be turned off. This functions the same way for "freezeRain_ON" -# If the Auto Adjust command is not used, these arguments will have no influence on the other commands. -useLimits_ON = False -freezeRain_ON = False - -# Commands can be input in a list format as seen below. The format is as follows "[ACTION] @ [LOCATION]", reading like "Perform [ACITON] at [LOCATION]. -# The action must come first, and they must be separated by a "@" symbol. -# Spaces between the Action/Location and "@" symbol can vary, although 1 space is recommended for readability. Lines can be commented out as needed. -actions = ["cloneInflows @ ALAT2", - "zeroNegatives @ ALAT2", - "cloneInflows @ ALAT2", - "balanceAll @ ALAT2", - "cloneInflows @ ALAT2", - "autoAdjust @ ALAT2", - ] - -for command in actions: - location = command.split('@')[1].strip() - function = command.split('@')[0].strip() - print "" - print "Now running", function, "at", location - print "" - inflow_Actions(function, officeID, location, startCal, useLimits_ON, freezeRain_ON) diff --git a/district-scripts/legacy-examples/solaris/InflowCalcZeroNegative.py b/district-scripts/legacy-examples/solaris/InflowCalcZeroNegative.py deleted file mode 100644 index 59f5e30..0000000 --- a/district-scripts/legacy-examples/solaris/InflowCalcZeroNegative.py +++ /dev/null @@ -1,93 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def zero_Negatives(officeID, location, startCal): - # Takes in locations defined by user in group and turns all negative values to 0 for the selected inflow. If a location fails or has an error, the script will continue. check the console log - # for any further information. - try: - inflowCalc.zeroNegatives(officeID, location, startCal.getTime()) - except Exception as e: - print "Error Computing Zero Negatives at {0} {1}".format(officeID, location) - print e - print "" -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar - -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 1) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This zeroes any negatives for ACTT2 and ALAT2. Several locations are commented out and can be commented back in any order. Additional stations can be added -# to the end provided they follow the same format. - -officeID = "SWF" -locationList = ["ACTT2", - "ALAT2", -# "BLNT2", -# "BNBT2", -# "CLDL1", -# "DAWT2", - "ACTT2", - "TXKT2", - ] -for location in locationList: - print "Now Running", location - zero_Negatives(officeID, location, startCal) - - - diff --git a/district-scripts/legacy-examples/solaris/InflowClone.sh b/district-scripts/legacy-examples/solaris/InflowClone.sh deleted file mode 100644 index 0d790af..0000000 --- a/district-scripts/legacy-examples/solaris/InflowClone.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./RunHeadlessJython.sh -f ..//examples//InflowCalcClone.py diff --git a/district-scripts/legacy-examples/solaris/InflowComputed.sh b/district-scripts/legacy-examples/solaris/InflowComputed.sh deleted file mode 100644 index 4132189..0000000 --- a/district-scripts/legacy-examples/solaris/InflowComputed.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./RunHeadlessJython.sh -f ..//examples//InflowCalcComputedInflow.py diff --git a/district-scripts/legacy-examples/solaris/InflowEvapAsFlow.sh b/district-scripts/legacy-examples/solaris/InflowEvapAsFlow.sh deleted file mode 100644 index 5aa3868..0000000 --- a/district-scripts/legacy-examples/solaris/InflowEvapAsFlow.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./RunHeadlessJython.sh -f ..//examples//InflowCalcComputeEvapAsFlow.py diff --git a/district-scripts/legacy-examples/solaris/InflowMultiAction.sh b/district-scripts/legacy-examples/solaris/InflowMultiAction.sh deleted file mode 100644 index 9a1790a..0000000 --- a/district-scripts/legacy-examples/solaris/InflowMultiAction.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./RunHeadlessJython.sh -f ..//examples//InflowCalcMultipleActions.py diff --git a/district-scripts/legacy-examples/solaris/InflowZeroNegative.sh b/district-scripts/legacy-examples/solaris/InflowZeroNegative.sh deleted file mode 100644 index 001e661..0000000 --- a/district-scripts/legacy-examples/solaris/InflowZeroNegative.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./RunHeadlessJython.sh -f ..//examples//InflowCalcZeroNegative.py diff --git a/district-scripts/legacy-examples/solaris/RunHeadlessJython.sh b/district-scripts/legacy-examples/solaris/RunHeadlessJython.sh deleted file mode 100644 index cf1da70..0000000 --- a/district-scripts/legacy-examples/solaris/RunHeadlessJython.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -NOT_FOUND="notFound" - -PROGRAM_ROOT=$(realpath ..) -JAR_DIR=$PROGRAM_ROOT/lib -SYS=$JAR_DIR/sys -CWMS=$JAR_DIR/cwms -REGI=$JAR_DIR/regi -LIBRARY_PATH=$PROGRAM_ROOT/lib64 -JAVA_EXE=$PROGRAM_ROOT/jre64/bin/java -ARGS=("$@") - -export LD_LIBRARY_PATH=$LIBRARY_PATH:$LD_LIBRARY_PATH -echo "LD_LIBRARY_PATH updated to $LD_LIBRARY_PATH" - -ORACLE_URL=$(getProp cwms.dbi.ConnectUsingUrl @${NOT_FOUND} dbi.properties|cut -d@ -f2) -if [ $ORACLE_URL = $NOT_FOUND ] -then - echo "Unable to locate Oracle URL from Cwms configuration. Will be taken from credentials.properties" -fi - -echo "Found Oracle URL: $ORACLE_URL" - -# Get the office id from cwms.properties using the CWMS getProp script -OFFICE_ID=$(getProp cwms.OfficeID ${NOT_FOUND} cwms.properties $CWMS_HOME/config/properties) -if [ $OFFICE_ID = $NOT_FOUND ] -then - echo "Unable to locate OfficeID from Cwms configuration. Will be taken from credentials.properties" -fi - -echo "Found Office ID: $OFFICE_ID" - -# The password file is expected to be at the following (full) path. -PASSWORD_FILE=$CWMS_HOME/config/properties/dbi.conf -if [ ! -f $PASSWORD_FILE ] -then - echo "Unable to locate password file in Cwms configuration. Will be taken from credentials.properties" -fi - -SCRIPT="" -NAME_FOUND=false - -for ((i=0; i < ${#ARGS[@]}; i++)) -do - PARAM_NAME=$(echo "${ARGS[$i]}" | tr '[:lower:]' '[:upper:]') - - if [ "$NAME_FOUND" = true ] ; then - # Use the script name as the base file name for the log file - BASENAME="$(basename "${ARGS[$i]}")" # Get only the base file name. - SCRIPT="${BASENAME%%.*}" # Remove the extension - break - elif [ "$PARAM_NAME" = "-F" ] ; then - NAME_FOUND=true - fi -done - - - -JAVA_COMMAND="-cp $JAR_DIR/*:$REGI/*:$CWMS/*:$SYS/*:"\ -" -Doracle.url=jdbc:oracle:thin:@${ORACLE_URL}"\ -" -Doracle.officeId=$OFFICE_ID"\ -" -Dhec.passwd=$PASSWORD_FILE"\ -" -Djava.library.path=$LIBRARY_PATH"\ -" -DPLUGINS=$EXT"\ -" -Doracle.metrics.clientid=\"CWMS REGI-Headless-v5.0\""\ -" -Djava.util.logging.config.file=../config/properties/logging.properties"\ -" -Drowcps.timezone=America/Chicago"\ -" usace.rowcps.headless.RegiCLI"\ -" -p ..//examples//credentials.properties"\ -" ${ARGS[*]}" - -LOG_FILE=$CWMS_HOME/cronjobs/headless/logs/$(getStartFN regi-headless-"$SCRIPT") - -echo "Running jython $SCRIPT" -echo "Output going to: $LOG_FILE" -echo "Java Command:" -echo "$JAVA_EXE $JAVA_COMMAND" -eval "$JAVA_EXE" $JAVA_COMMAND &> "$LOG_FILE" -STATUS=$? - -echo "$SCRIPT process exited with code $STATUS" \ No newline at end of file diff --git a/district-scripts/legacy-examples/solaris/__init__.py b/district-scripts/legacy-examples/solaris/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/district-scripts/legacy-examples/solaris/flow.sh b/district-scripts/legacy-examples/solaris/flow.sh deleted file mode 100644 index cc017e5..0000000 --- a/district-scripts/legacy-examples/solaris/flow.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./RunHeadlessJython.sh -f ..//examples//GateFlow.py diff --git a/district-scripts/legacy-examples/windows/GateFlow.py b/district-scripts/legacy-examples/windows/GateFlow.py deleted file mode 100644 index ba56125..0000000 --- a/district-scripts/legacy-examples/windows/GateFlow.py +++ /dev/null @@ -1,196 +0,0 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) -startCal.add(Calendar.DATE, -5) - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWF" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") -# By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out -# or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate -# by changing the "flowGroup" variable. -calculateSingleFlowGroups = True -flowGroup = "ConduitGate_Total" -locationList = ["ACTT2", - "ALAT2", - "BDWT2", - "BLNT2", - "BNBT2", - "CLDL1", - "DAWT2", -# "GGLT2", -# "GNGT2", -# "GPVT2", -# "HORT2", -# "JFNT2", -# "JPLT2", -# "JSPT2", -# "LEWT2", -# "LVNT2", -# "PCTT2", -# "RRLT2", -# "FRHT2", -# "SCLT2", -# "SMCT2", -# "SOMT2", -# "STIT2", -# "TXKT2", -# "WTYT2", -# "TRNT2", -# "FFLT2", -# "BPRT2", -# "EAMT2", -# "FLWT2", -# "LLST2", -# "GBYT2", -# "PSMT2", -# "TBLT2", -# "TBRT2", -# "GPET2", -# "BSLT2", -# "SAGT2", -# "MSDT2", - ] - -# the calculation can also be performed for all the associated groups -# the computeAll method takes: -# officeId -# projectId -# startDate -# endDate -# By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. -# Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. - -calculateAllFlowGroups = True -FlowGroupList = ["ACTT2", - "ALAT2", - "BDWT2", - "BLNT2", - "BNBT2", - "DAWT2", - "GGLT2", -# "GNGT2", -# "GPVT2", -# "HORT2", -# "JPLT2", -# "LEWT2", -# "LVNT2", -# "PCTT2", -# "RRLT2", -# "FRHT2", -# "SCLT2", -# "SMCT2", -# "SOMT2", -# "STIT2", -# "TXKT2", -# "WTYT2", -# "TRNT2", -# "FFLT2", -# "EAMT2", -# "FLWT2", -# "LLST2", -# "GBYT2", -# "PSMT2", -# "SAGT2", - ] - - -if calculateSingleFlowGroups: - for location in locationList: - print "Now Running", location, "SINGLE" - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup) - -if calculateAllFlowGroups: - for location in FlowGroupList: - print "Now Running", location, "GROUP" - compute_All_Flowgroups(officeID, location, startCal, endCal) - - - diff --git a/district-scripts/legacy-examples/windows/GateSettings.bat b/district-scripts/legacy-examples/windows/GateSettings.bat deleted file mode 100644 index 529540a..0000000 --- a/district-scripts/legacy-examples/windows/GateSettings.bat +++ /dev/null @@ -1,2 +0,0 @@ -:: The headless scripts can also be executed from a bat file as demonstrated below -RunHeadlessJython.bat -f ..\\examples\\GateSettings.py diff --git a/district-scripts/legacy-examples/windows/GateSettings.py b/district-scripts/legacy-examples/windows/GateSettings.py deleted file mode 100644 index ff4cfcc..0000000 --- a/district-scripts/legacy-examples/windows/GateSettings.py +++ /dev/null @@ -1,86 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Gate Settings object -gateSettings = registry.getCalculation(1.0, "Gate Settings") - - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) -startCal.add(Calendar.DATE, -5) - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - - -# gateSettings contains four callable methods -# void createGateSettings(String officeId, String locationStr, Date startDate, Date end) throws Exception; -# void createGateSettingsGroup(String officeId, String locationStr, Date startDate, Date end, String groupId) throws Exception; -# void createGateSettingsOutlet(String officeId, String locationStr, Date startDate, Date end, String outletId) throws Exception; -# void createGateSettingsOutletFromTs(String officeId, String locationStr, Date startDate, Date end, String outletId, String tsId) throws Exception; - -# This is an example of a call that would create gate settings at TainterGate 1 at WTYT2 from the specified input time series. -gateSettings.createGateSettingsOutletFromTs("SWF", "WTYT2", startCal.getTime(), endCal.getTime(), "TG1", "WTYT2-TG1.Opening-Spillway_Gate.Const.0.0.MANUAL" ) - -# This is an example of a call that would create gate settings at TainterGate 1 at WTYT2 from the regi association configured input time series. -gateSettings.createGateSettingsOutlet("SWF", "WTYT2", startCal.getTime(), endCal.getTime(), "TG1") - -# This is an example of a call that would create gate settings at all outlets at WTYT2 which are in the TainterGateWTY group from the association configured time series. -gateSettings.createGateSettingsGroup("SWF", "WTYT2", startCal.getTime(), endCal.getTime(), "WTYT2-TainterGateWTY" ) - -# This is an example of a call that would create gate settings for every outlet in a rating group at WTYT2. -gateSettings.createGateSettings("SWF", "WTYT2", startCal.getTime(), endCal.getTime() ) - - - diff --git a/district-scripts/legacy-examples/windows/InflowAutoAdjust.bat b/district-scripts/legacy-examples/windows/InflowAutoAdjust.bat deleted file mode 100644 index 49cb2d4..0000000 --- a/district-scripts/legacy-examples/windows/InflowAutoAdjust.bat +++ /dev/null @@ -1,2 +0,0 @@ -:: The headless scripts can also be executed from a bat file as demonstrated below -RunHeadlessJython.bat -f ..\\examples\\InflowCalcAutoAdjust.py diff --git a/district-scripts/legacy-examples/windows/InflowBalanceAll.bat b/district-scripts/legacy-examples/windows/InflowBalanceAll.bat deleted file mode 100644 index 56d0265..0000000 --- a/district-scripts/legacy-examples/windows/InflowBalanceAll.bat +++ /dev/null @@ -1,2 +0,0 @@ -:: The headless scripts can also be executed from a bat file as demonstrated below -RunHeadlessJython.bat -f ..\\examples\\InflowCalcBalanceAll.py diff --git a/district-scripts/legacy-examples/windows/InflowCalcAutoAdjust.py b/district-scripts/legacy-examples/windows/InflowCalcAutoAdjust.py deleted file mode 100644 index 508c05b..0000000 --- a/district-scripts/legacy-examples/windows/InflowCalcAutoAdjust.py +++ /dev/null @@ -1,104 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - - -def auto_Adjust(officeID, location, startCal, useLimits, freezeRain): - # Takes in locations defined by user in group and adjusts the selected inflow. If a location fails or has an error, the script will continue. check the console log - # for any further information. - try: - inflowCalc.autoAdjust(officeID, location, startCal.getTime(), useLimits, freezeRain) - except Exception as e: - print "Error Adjusting Values at {0} {1}".format(officeID, location) - print e - print "" - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# Defaults to day one of the current month at 0000 -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -startCal.set(Calendar.DATE, 1) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoAdjusts for ACTT2 and ALAT2. Several locations are commented out and can be commented back in any order. Additional stations can be added -# to the end provided they follow the same format. UseLimits and FreezeRain are also controllable arguments for AutoAdjust. By setting "useLimits_ON" to True, -# the function will use the "useLimits command. By setting it to "False", it will be turned off. This functions the same way for "freezeRain_ON" - -officeID = "SWF" -useLimits_ON = False -freezeRain_ON = False -locationList = ["ACTT2", - "ALAT2", -# "BLNT2", -# "BNBT2", -# "CLDL1", -# "DAWT2", - "ACTT2", - "TXKT2", - ] -for location in locationList: - print "Now Running", location - auto_Adjust(officeID, location, startCal, useLimits_ON, freezeRain_ON) - - - diff --git a/district-scripts/legacy-examples/windows/InflowCalcBalanceAll.py b/district-scripts/legacy-examples/windows/InflowCalcBalanceAll.py deleted file mode 100644 index 70eb4b2..0000000 --- a/district-scripts/legacy-examples/windows/InflowCalcBalanceAll.py +++ /dev/null @@ -1,97 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def balance_all(officeID, location, startCal): - # Takes in locations defined by user in group and balances the selected inflow - try: - inflowCalc.balanceAll(officeID, location, startCal.getTime()) - except Exception as e: - print "Error Computing Balance all at {0} {1}".format(officeID, location) - print e - print "" - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# Defaults to day one of the current month at 0000 -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -startCal.set(Calendar.DATE, 1) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the followind arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoBalances for ACTT2 and ALAT2. Several locations are commented out and can be commented back in any order. Additonial stations can be added -# to the end provided they follow the same format. -officeID = "SWF" -locationList = ["ACTT2", - "ALAT2", -# "BLNT2", -# "BNBT2", -# "CLDL1", -# "DAWT2", - "ACTT2", - "TXKT2", - ] -for location in locationList: - print "Now Running", location - balance_all(officeID, location, startCal) - - diff --git a/district-scripts/legacy-examples/windows/InflowCalcClone.py b/district-scripts/legacy-examples/windows/InflowCalcClone.py deleted file mode 100644 index fa068be..0000000 --- a/district-scripts/legacy-examples/windows/InflowCalcClone.py +++ /dev/null @@ -1,96 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def clone_Inflows(officeID, location, startCal): - # Takes in locations defined by user in group and clones the selected inflow - try: - inflowCalc.cloneInflows(officeID, location, startCal.getTime()) - except Exception as e: - print "Error Cloning Inflows at {0} {1}".format(officeID, location) - print e - print "" - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# Defaults to day one of the current month at 0000 -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -startCal.set(Calendar.DATE, 1) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This clones inflow for ACTT2 and ALAT2. Several locations are commented out and can be commented back in any order. Additional stations can be added -# to the end provided they follow the same format. -officeID = "SWF" -locationList = ["ACTT2", - "ALAT2", -# "BLNT2", -# "BNBT2", -# "CLDL1", -# "DAWT2", - "ACTT2", - ] -for location in locationList: - print "Now Running", location - clone_Inflows(officeID, location, startCal) - - diff --git a/district-scripts/legacy-examples/windows/InflowCalcComputeEvapAsFlow.py b/district-scripts/legacy-examples/windows/InflowCalcComputeEvapAsFlow.py deleted file mode 100644 index 356037b..0000000 --- a/district-scripts/legacy-examples/windows/InflowCalcComputeEvapAsFlow.py +++ /dev/null @@ -1,33 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) -startCal.add(Calendar.DATE, -5) - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -# This computes and saves evap as flow for EUFA in May 2018 -inflowCalc.computeEvapAsFlow("SWT", "EUFA", startCal.getTime(), endCal.getTime()) diff --git a/district-scripts/legacy-examples/windows/InflowCalcComputedInflow.py b/district-scripts/legacy-examples/windows/InflowCalcComputedInflow.py deleted file mode 100644 index dbdec6e..0000000 --- a/district-scripts/legacy-examples/windows/InflowCalcComputedInflow.py +++ /dev/null @@ -1,35 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.calculator.inflow import InflowComputationStorageOption - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") - -# Defaults to start of the day 5 days ago, and ends at the top of the current hour today -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) -startCal.add(Calendar.DATE, -5) - -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.set(Calendar.MINUTE, 0) -endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.MILLISECOND, 0) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -# This computes and saves inflow for EUFA in May 2018 -# computeInflow saves the Computed Inflow, Evaporation as Flow, and Project Total Flow Group time series data -inflowCalc.computeInflow("SWT", "EUFA", startCal.getTime(), endCal.getTime()) diff --git a/district-scripts/legacy-examples/windows/InflowCalcMultipleActions.py b/district-scripts/legacy-examples/windows/InflowCalcMultipleActions.py deleted file mode 100644 index 8722aa8..0000000 --- a/district-scripts/legacy-examples/windows/InflowCalcMultipleActions.py +++ /dev/null @@ -1,115 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions -import traceback - -def inflow_Actions(function, officeID, location, startCal, uselimits, freezerain): - # Takes in locations defined by user in group and computes the given command at the given station. - try: - if function.lower() == "cloneinflows": - inflowCalc.cloneInflows(officeID, location, startCal.getTime()) - elif function.lower() == "zeronegatives": - inflowCalc.zeroNegatives(officeID, location, startCal.getTime()) - elif function.lower() == "balanceall": - inflowCalc.balanceAll(officeID, location, startCal.getTime()) - elif function.lower() == "autoadjust": - inflowCalc.autoAdjust(officeID, location, startCal.getTime(), uselimits, freezerain) - else: - print "Input command", function, "is not recognized. Please edit your input and try again." - except: - print "Error Completing action {0} at {1} {2}".format(function, officeID, location) - traceback.print_exc() - print "" -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# Defaults to day one of the current month at 0000 -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -startCal.set(Calendar.DATE, 1) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -officeID = "SWF" - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# UseLimits and FreezeRain are also controllable arguments for AutoAdjust. By setting "useLimits_ON" to True, -# the function will use the "useLimits command. By setting it to "False", it will be turned off. This functions the same way for "freezeRain_ON" -# If the Auto Adjust command is not used, these arguments will have no influence on the other commands. -useLimits_ON = False -freezeRain_ON = False - -# Commands can be input in a list format as seen below. The format is as follows "[ACTION] @ [LOCATION]", reading like "Perform [ACITON] at [LOCATION]. -# The action must come first, and they must be separated by a "@" symbol. -# Spaces between the Action/Location and "@" symbol can vary, although 1 space is recommended for readability. Lines can be commented out as needed. -actions = ["cloneInflows @ ALAT2", - "zeroNegatives @ ALAT2", - "cloneInflows @ ALAT2", - "balanceAll @ ALAT2", - "cloneInflows @ ALAT2", - "autoAdjust @ ALAT2", - ] - -for command in actions: - location = command.split('@')[1].strip() - function = command.split('@')[0].strip() - print "" - print "Now running", function, "at", location - print "" - inflow_Actions(function, officeID, location, startCal, useLimits_ON, freezeRain_ON) diff --git a/district-scripts/legacy-examples/windows/InflowCalcZeroNegative.py b/district-scripts/legacy-examples/windows/InflowCalcZeroNegative.py deleted file mode 100644 index 8b93c2c..0000000 --- a/district-scripts/legacy-examples/windows/InflowCalcZeroNegative.py +++ /dev/null @@ -1,97 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions -import traceback - - -def zero_Negatives(officeID, location, startCal): - # Takes in locations defined by user in group and turns all negative values to 0 for the selected inflow. If a location fails or has an error, the script will continue. check the console log - # for any further information. - try: - inflowCalc.zeroNegatives(officeID, location, startCal.getTime()) - except: - print "Error Computing Zero Negatives at {0} {1}".format(officeID, location) - traceback.print_exc() - print "" - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - - -LoggingOptions.setDbMessageLevel(2) - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# Defaults to day one of the current month at 0000 -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -startCal.set(Calendar.DATE, 1) -startCal.set(Calendar.HOUR_OF_DAY, 0) -startCal.set(Calendar.MINUTE, 0) -startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.MILLISECOND, 0) - -# Calendar can be adjusted using the following functions: -# startCal.set(Calendar.DATE, 1) # Sets the date of the calendar. -# startCal.set(Calendar.HOUR_OF_DAY, 1) # Sets the hour of the day to 0100 (1-24) -# startCal.set(Calendar.YEAR, 2020) # Sets the year -# startCal.set(Calendar.MONTH, 4) # Sets the month (month 4 means May to Java) - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This zeroes any negatives for ACTT2 and ALAT2. Several locations are commented out and can be commented back in any -# order. Additional stations can be added to the end provided they follow the same format. - -officeID = "SWF" -locationList = ["ACTT2", - "ALAT2", - "TXKT2", - ] -for location in locationList: - print "Now Running", location - # Performs MonUtl function for the entire month - zero_Negatives(officeID, location, startCal) - - - diff --git a/district-scripts/legacy-examples/windows/InflowClone.bat b/district-scripts/legacy-examples/windows/InflowClone.bat deleted file mode 100644 index 33d5a7f..0000000 --- a/district-scripts/legacy-examples/windows/InflowClone.bat +++ /dev/null @@ -1,2 +0,0 @@ -:: The headless scripts can also be executed from a bat file as demonstrated below -RunHeadlessJython.bat -f ..\\examples\\InflowCalcClone.py diff --git a/district-scripts/legacy-examples/windows/InflowComputed.bat b/district-scripts/legacy-examples/windows/InflowComputed.bat deleted file mode 100644 index 4e063c0..0000000 --- a/district-scripts/legacy-examples/windows/InflowComputed.bat +++ /dev/null @@ -1,2 +0,0 @@ -:: The headless scripts can also be executed from a bat file as demonstrated below -RunHeadlessJython.bat -f ..\\examples\\InflowCalcComputedInflow.py diff --git a/district-scripts/legacy-examples/windows/InflowEvapAsFlow.bat b/district-scripts/legacy-examples/windows/InflowEvapAsFlow.bat deleted file mode 100644 index 3a55d38..0000000 --- a/district-scripts/legacy-examples/windows/InflowEvapAsFlow.bat +++ /dev/null @@ -1,2 +0,0 @@ -:: The headless scripts can also be executed from a bat file as demonstrated below -RunHeadlessJython.bat -f ..\\examples\\InflowCalcComputeEvapAsFlow.py diff --git a/district-scripts/legacy-examples/windows/InflowMultiAction.bat b/district-scripts/legacy-examples/windows/InflowMultiAction.bat deleted file mode 100644 index 89b033f..0000000 --- a/district-scripts/legacy-examples/windows/InflowMultiAction.bat +++ /dev/null @@ -1,2 +0,0 @@ -:: The headless scripts can also be executed from a bat file as demonstrated below -RunHeadlessJython.bat -f ..\\examples\\InflowCalcMultipleActions.py diff --git a/district-scripts/legacy-examples/windows/InflowZeroNegative.bat b/district-scripts/legacy-examples/windows/InflowZeroNegative.bat deleted file mode 100644 index bbfb3a6..0000000 --- a/district-scripts/legacy-examples/windows/InflowZeroNegative.bat +++ /dev/null @@ -1,2 +0,0 @@ -:: The headless scripts can also be executed from a bat file as demonstrated below -RunHeadlessJython.bat -f ..\\examples\\InflowCalcZeroNegative.py diff --git a/district-scripts/legacy-examples/windows/RunHeadlessJython.bat b/district-scripts/legacy-examples/windows/RunHeadlessJython.bat deleted file mode 100644 index 1b5af80..0000000 --- a/district-scripts/legacy-examples/windows/RunHeadlessJython.bat +++ /dev/null @@ -1,47 +0,0 @@ -:: The headless scripts can also be executed from a bat file as demonstrated below -@echo off -setlocal enabledelayedexpansion - -set next_is_target=0 -for %%a in (%*) do ( - if !next_is_target! == 1 ( - set f_value=%%a - for %%b in ("!f_value!") do set "SCRIPT=%%~nb" - set next_is_target=0 - ) else ( - if "%%a"=="-f" ( - set next_is_target=1 - ) - ) -) - -set PROGRAM_ROOT=.. -set JAR_DIR=%PROGRAM_ROOT%\lib -set SYS=%JAR_DIR%\sys -set CWMS=%JAR_DIR%\cwms -set REGI=%JAR_DIR%\regi -set LIBRARY_PATH=%PROGRAM_ROOT%\lib64 -set JAVA_EXE=%PROGRAM_ROOT%\jre64\bin\java.exe -set ARGS=%* -for /F "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set DATE_TIME=%%I -set DATE_TIME=%DATE_TIME:~0,4%.%DATE_TIME:~4,2%.%DATE_TIME:~6,2%.%DATE_TIME:~8,2%.%DATE_TIME:~10,2% -set LOG_FILE=%CWMS_HOME%\cronjobs\headless\logs\regi-headless-%SCRIPT%.start.%DATE_TIME%.utc - -set JAVA_COMMAND=-cp %JAR_DIR%\*;%REGI%\*;%CWMS%\*;%SYS%\*; ^ --Dhec.passwd=%CWMS_HOME%\config\properties\dbi.conf ^ --Djava.library.path=%LIBRARY_PATH% ^ --DPLUGINS=%JAR_DIR%\ext ^ --Doracle.metrics.clientid="CWMS REGI-Headless-v5.0" ^ --Djava.util.logging.config.file=%PROGRAM_ROOT%\config\properties\logging.properties ^ --Drowcps.timezone=America\Chicago ^ -usace.rowcps.headless.RegiCLI ^ --p %PROGRAM_ROOT%\examples\credentials.properties ^ -%ARGS% - -echo Running CWMS-REGI Headless script %SCRIPT% -echo Output going to: %LOG_FILE% -echo Java command: -echo %JAVA_EXE% %JAVA_COMMAND% -%JAVA_EXE% %JAVA_COMMAND% > %LOG_FILE% 2>&1 -echo Status: %ERRORLEVEL% >> %LOG_FILE% -endlocal \ No newline at end of file diff --git a/district-scripts/legacy-examples/windows/__init__.py b/district-scripts/legacy-examples/windows/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/district-scripts/legacy-examples/windows/flow.bat b/district-scripts/legacy-examples/windows/flow.bat deleted file mode 100644 index b49557d..0000000 --- a/district-scripts/legacy-examples/windows/flow.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -:: The headless scripts can also be executed from a bat file as demonstrated below -RunHeadlessJython.bat -f ..\\examples\\GateFlow.py diff --git a/regi-headless/build.gradle b/regi-headless/build.gradle index edc66ab..fe64972 100644 --- a/regi-headless/build.gradle +++ b/regi-headless/build.gradle @@ -163,6 +163,28 @@ tasks.register('testPythonWheel', VenvTask) { outputs.upToDateWhen { false } } +tasks.register('smokeTestDistrictScripts', VenvTask) { + group = 'verification' + description = 'Validates migrated district and example scripts against the Python entrypoint shape and Java scriptable APIs.' + + dependsOn installPythonBuildTools + + venvExec = 'python' + args = [ + '-m', 'pytest', + '-o', 'log_cli=true', + '--log-cli-level=INFO', + 'src/test/python/test_district_scripts.py' + ] + + inputs.files(fileTree(dir: '../district-scripts', include: '**/*.py')) + inputs.files(fileTree(dir: 'src/test/resources/usace/rowcps/headless/examples', include: '**/*.py')) + inputs.files(fileTree(dir: 'src/main/java/usace/rowcps/headless', include: '**/*.java')) + inputs.file('src/test/python/test_district_scripts.py') + outputs.upToDateWhen { false } +} + check { dependsOn testPythonWheel + dependsOn smokeTestDistrictScripts } diff --git a/regi-headless/src/test/python/test_district_scripts.py b/regi-headless/src/test/python/test_district_scripts.py new file mode 100644 index 0000000..44704d4 --- /dev/null +++ b/regi-headless/src/test/python/test_district_scripts.py @@ -0,0 +1,244 @@ +import importlib.util +import io +import logging +import re +import sys +import types +from contextlib import redirect_stdout +from pathlib import Path + + +MODULE_ROOT = Path(__file__).resolve().parents[3] +REPOSITORY_ROOT = MODULE_ROOT.parent +DISTRICT_SCRIPTS_ROOT = REPOSITORY_ROOT / "district-scripts" +EXAMPLE_SCRIPTS_ROOT = MODULE_ROOT / "src" / "test" / "resources" / "usace" / "rowcps" / "headless" / "examples" +JAVA_SOURCE_ROOT = MODULE_ROOT / "src" / "main" / "java" + + +JAVA_METHOD_PATTERN = re.compile( + r"\bpublic\s+(?:static\s+)?(?:[\w<>\[\], ?]+\s+)+(?P[A-Za-z_]\w*)\s*\(" +) +LOGGER = logging.getLogger(__name__) + + +def test_migrated_scripts_only_call_known_scriptable_api(monkeypatch): + java_api = _load_java_api() + _install_fake_modules(monkeypatch, java_api) + + _validate_scripts("district", DISTRICT_SCRIPTS_ROOT, _district_scripts(), java_api) + _validate_scripts("example", EXAMPLE_SCRIPTS_ROOT, _example_scripts(), java_api) + + +def _validate_scripts(label, root, scripts, java_api): + assert scripts, f"No {label} scripts found under {root}" + LOGGER.info("Validating %s %s script(s)", len(scripts), label) + + failures = [] + for script in scripts: + relative_script = script.relative_to(REPOSITORY_ROOT) + LOGGER.info("Validating %s script: %s", label, relative_script) + try: + module = _load_script(script) + with redirect_stdout(io.StringIO()): + _script_callback(module)(FakeRegistry(java_api)) + except Exception as exc: + failures.append(f"{relative_script}: {type(exc).__name__}: {exc}") + else: + LOGGER.info("Validated %s script: %s", label, relative_script) + + assert not failures, f"{label.title()} script API validation failed:\n" + "\n".join(failures) + + +def _district_scripts(): + return sorted( + path + for path in DISTRICT_SCRIPTS_ROOT.rglob("*.py") + if path.name != "__init__.py" + ) + + +def _example_scripts(): + return sorted( + path + for path in EXAMPLE_SCRIPTS_ROOT.rglob("*.py") + if path.name != "__init__.py" + ) + + +def _script_callback(module): + for name in ( + "run_calculations", + "calculate_inflow", + "calculate_gate_flow", + "calculate_gate_settings", + "configure_logging_options", + ): + callback = getattr(module, name, None) + if callback is not None: + return callback + raise AssertionError(f"No migrated script callback found in {module.__file__}") + + +def _load_java_api(): + return { + "Inflow": _java_methods( + "usace/rowcps/headless/calculator/inflow/ScriptableInflowImpl.java" + ), + "Gate Flow": _java_methods( + "usace/rowcps/headless/calculator/flowgroup/ScriptableGateFlowImpl.java" + ), + "Gate Settings": _java_methods( + "usace/rowcps/headless/calculator/gatesettings/ScriptableGateSettingsImpl.java" + ), + "LoggingOptions": _java_methods("usace/rowcps/headless/LoggingOptions.java"), + } + + +def _java_methods(relative_path): + source = (JAVA_SOURCE_ROOT / relative_path).read_text(encoding="utf-8") + return { + match.group("name") + for match in JAVA_METHOD_PATTERN.finditer(_strip_java_comments(source)) + } + + +def _strip_java_comments(source): + source = re.sub(r"/\*.*?\*/", "", source, flags=re.DOTALL) + return re.sub(r"//.*", "", source) + + +def _load_script(path): + module_name = "district_script_" + re.sub(r"\W+", "_", str(path.relative_to(REPOSITORY_ROOT))) + spec = importlib.util.spec_from_file_location(module_name, path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def _install_fake_modules(monkeypatch, java_api): + modules = {} + + def module(name): + value = modules.get(name) + if value is None: + value = types.ModuleType(name) + modules[name] = value + monkeypatch.setitem(sys.modules, name, value) + if "." in name: + parent_name, child_name = name.rsplit(".", 1) + setattr(module(parent_name), child_name, value) + return value + + regi_python = module("regi_python") + regi_python.regi_session = _fake_regi_session + regi_python.run_headless = lambda callback: callback(FakeRegistry(java_api)) + + java_util = module("java.util") + java_util.Calendar = FakeCalendar + java_util.TimeZone = FakeTimeZone + + java_lang = module("java.lang") + java_lang.System = FakeSystem + + headless = module("usace.rowcps.headless") + headless.LoggingOptions = type( + "LoggingOptions", + (), + {name: staticmethod(_noop) for name in java_api["LoggingOptions"]}, + ) + + inflow = module("usace.rowcps.headless.calculator.inflow") + inflow.InflowComputationStorageOption = types.SimpleNamespace( + EVAP_AS_FLOW="EVAP_AS_FLOW", + PROJECT_RELEASES="PROJECT_RELEASES", + ) + + +class _fake_regi_session: + def __enter__(self): + return None + + def __exit__(self, exc_type, exc, traceback): + return False + + +class FakeRegistry: + def __init__(self, java_api): + self._java_api = java_api + + def getNames(self, version): + return ["Inflow", "Gate Flow", "Gate Settings"] + + def getCalculation(self, version, name): + if name not in self._java_api: + raise AssertionError(f"Unknown calculation requested: {name!r}") + return FakeJavaObject(name, self._java_api[name]) + + +class FakeJavaObject: + def __init__(self, display_name, method_names): + self._display_name = display_name + self._method_names = method_names + + def __getattr__(self, name): + if name not in self._method_names: + raise AttributeError(f"{self._display_name} has no Java method {name!r}") + return _noop + + +class FakeTimeZone: + @staticmethod + def getTimeZone(name): + return FakeTimeZone() + + +class FakeSystem: + @staticmethod + def getProperty(name): + return "" + + +class FakeCalendar: + DATE = 1 + DAY_OF_MONTH = 2 + HOUR = 3 + HOUR_OF_DAY = 4 + MILLISECOND = 5 + MINUTE = 6 + MONTH = 7 + SECOND = 8 + YEAR = 9 + + @staticmethod + def getInstance(time_zone=None): + return FakeCalendar() + + def add(self, field, amount): + return None + + def clear(self): + return None + + def getTime(self): + return FakeDate() + + def getTimeInMillis(self): + return 0 + + def get(self, field): + return 0 + + def set(self, field, value): + return None + + +class FakeDate: + def getTime(self): + return 0 + + def toString(self): + return "FakeDate" + + +def _noop(*args, **kwargs): + return None diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/credentials.properties b/regi-headless/src/test/resources/usace/rowcps/headless/credentials.properties deleted file mode 100644 index ee2dba3..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/credentials.properties +++ /dev/null @@ -1,9 +0,0 @@ -rowcps.projectDir=C:\\Users\\ryanm\\Documents\\Regi Base\\ -rowcps.projectName=bang - -oracle.url=jdbc:oracle:thin:@10.0.0.36:1539:V122SWT1811REGI -oracle.user=m5hectest -oracle.password=swt1811db -oracle.officeId=SWT - -hec.passwd=src\\test\\java\\usace\\rowcps\\headless\\hec.passwd \ No newline at end of file diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateFlowCalc.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateFlowCalc.py index 7fcc9f4..8bcbab8 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateFlowCalc.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateFlowCalc.py @@ -1,103 +1,49 @@ -from hec.data import Duration -from hec.data import Interval -from hec.data import ParameterType -from hec.data import Version -from hec.data.location import LocationTemplate -from java.lang import System -from java.util import Calendar -from java.util import Collections -from java.util import List -from java.util import TimeZone import os.path import sys -from usace.rowcps.computation.flowgroup import FlowGroupCalc -from usace.rowcps.regi.model import AtFlowGroupManager -from usace.rowcps.regi.model import AtManagerType -from usace.rowcps.regi.model import AtOutletManager -from usace.rowcps.regi.model import AtProjectManager -from usace.rowcps.regi.model import CacheUsage +from regi_python import regi_session, run_headless -print "Now executing GateFlowCalc.py" -print "os.arch:", System.getProperty("os.arch") -print "sys.path", sys.path -#curDir = open(".") -print "Working dir:", os.path.abspath(".") +def calculate_gate_flow(registry): + # Java imports must happen after regi_session starts the JVM. + from java.lang import System + from java.util import Calendar, TimeZone -property = System.getProperty("java.library.path") -print "Library path: ", property + print("Now executing GateFlowCalc.py") + print("os.arch:", System.getProperty("os.arch")) + print("sys.path", sys.path) + print("Working dir:", os.path.abspath(".")) + print("Library path:", System.getProperty("java.library.path")) -sys.stdout.flush() + sys.stdout.flush() -print "regiDomain.getName()", regiDomain.getName() + gate_calc = registry.getCalculation(1.0, "Gate Flow") -#print AtManagerType -#print AtManagerType.DATABASE -#RegiDomain regiDomain = getRegiDomain() + office_id = "SWF" + project_id = "LEWT2" + flow_group_id = "Flow.LEWT2.ConduitGate_Total" -#lets get a lot of managers. remember that the managers can be pulled from regidomain thru the following: -# -#regiDomain.getAtProjectManager() -# -#but its coded below to make sure that we have the Oracle manager. -projManager = regiDomain.getAtManager(managerId, AtManagerType.DATABASE, AtProjectManager.AT_PROJECT_MANAGER_NAME, AtProjectManager) -# -outletManager = regiDomain.getAtManager(managerId, AtManagerType.DATABASE, AtOutletManager.AT_OUTLET_MANAGER_NAME, AtOutletManager) -## -flowGroupManager = regiDomain.getAtManager(managerId, AtManagerType.DATABASE, AtFlowGroupManager.AT_FLOW_GROUP_MANAGER_NAME, AtFlowGroupManager) + # Time zone must be set because the Solaris time zone is UTC + time_zone = TimeZone.getTimeZone("US/Central") + start_cal = Calendar.getInstance(time_zone) + start_cal.clear() + start_cal.set(Calendar.YEAR, 2015) + start_cal.set(Calendar.MONTH, 1) -#our office -officeId = "SWF" -#this stuff would be grabbed from the project descriptor. -projectId = "LEWT2" -projectLocRef = LocationTemplate(officeId, projectId, None) -cg1LocRef = LocationTemplate(officeId, projectId + "-CG1", None) + end_cal = Calendar.getInstance(time_zone) + end_cal.clear() + end_cal.set(Calendar.YEAR, 2013) + end_cal.set(Calendar.MONTH, 1) -conduitGateFlowGroupMap = flowGroupManager.retrieveFlowGroups(projectLocRef, None, CacheUsage.NORMAL) -entrySet = conduitGateFlowGroupMap.entrySet() + gate_calc.computeFlowGroup( + office_id, + project_id, + start_cal.getTimeInMillis(), + end_cal.getTimeInMillis(), + flow_group_id, + ) -conduitGateFlowGroup = None -for entry in entrySet: - key = entry.getKey() - value = entry.getValue() - if "ConduitGate_Total" in key.getId(): - conduitGateFlowGroup = key - break - -if conduitGateFlowGroup is None: -# Assert.fail("Couldnt find conduit gate flow group") - print "Couldnt find conduit gate flow group" -else: - # Time zone must be set because the Solaris time zone is UTC - timeZone = TimeZone.getTimeZone("US/Central") - startCal = Calendar.getInstance(timeZone) - startCal.clear() - startCal.set(Calendar.YEAR, 2015) - startCal.set(Calendar.MONTH, 1) - startTime = startCal.getTimeInMillis() - - #this could be INST too. - parameterType = ParameterType(ParameterType.AVE) - interval = Interval("5Minutes") - duration = Duration("5Minutes") - version = Version("CALC") - intervalOffsetSeconds = 0 - newFlowGroupTimeSeries = conduitGateFlowGroup.newFlowGroupTimeSeries(parameterType, interval, duration, version, intervalOffsetSeconds, startCal.getTime(), None) - - flowGroupCalc = FlowGroupCalc() - outputTimeSeriesList = Collections.singletonList(newFlowGroupTimeSeries) - - endCal = Calendar.getInstance(timeZone) - endCal.clear() - endCal.set(Calendar.YEAR, 2013) - endCal.set(Calendar.MONTH, 1) - endTime = endCal.getTimeInMillis() - - calcTimeSeries = flowGroupCalc.calcTimeSeries(managerId, conduitGateFlowGroup, startTime, endTime, outputTimeSeriesList) - computationResult = calcTimeSeries.get(newFlowGroupTimeSeries) - #it could also be an error - computationData = computationResult - timeSeriesData = computationData.getTimeSeriesData() - timeSeriesData.tabulateValues() \ No newline at end of file +if __name__ == "__main__": + with regi_session(): + run_headless(calculate_gate_flow) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateFlowCalc2.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateFlowCalc2.py index e5d6542..1eca4b1 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateFlowCalc2.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateFlowCalc2.py @@ -1,25 +1,30 @@ -from java.util import Calendar -from java.util import TimeZone +from regi_python import regi_session, run_headless -names = registry.getNames(1.0) -print "names", names -gateCalc = registry.getCalculation(1.0, "Gate Flow") +def calculate_gate_flow(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar, TimeZone -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -startCal = Calendar.getInstance(timeZone) -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) + names = registry.getNames(1.0) + print("names", names) -endCal = Calendar.getInstance(timeZone) -endCal.clear() -endCal.set(Calendar.YEAR, 2015) -endCal.set(Calendar.MONTH, 6) + gate_calc = registry.getCalculation(1.0, "Gate Flow") -#gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTimeInMillis(), endCal.getTimeInMillis(), "Flow.LEWT2.ConduitGate_Total") + # Time zone must be set because the Solaris time zone is UTC + time_zone = TimeZone.getTimeZone("US/Central") + start_cal = Calendar.getInstance(time_zone) + start_cal.clear() + start_cal.set(Calendar.YEAR, 2015) + start_cal.set(Calendar.MONTH, 4) -gateCalc.computeAll("SWF", "LEWT2", startCal.getTimeInMillis(), endCal.getTimeInMillis()) + end_cal = Calendar.getInstance(time_zone) + end_cal.clear() + end_cal.set(Calendar.YEAR, 2015) + end_cal.set(Calendar.MONTH, 6) + gate_calc.computeAll("SWF", "LEWT2", start_cal.getTimeInMillis(), end_cal.getTimeInMillis()) + +if __name__ == "__main__": + with regi_session(): + run_headless(calculate_gate_flow) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateSettings.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateSettings.py index fd0512f..b1d4121 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateSettings.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/GateSettings.py @@ -1,42 +1,46 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone +from regi_python import regi_session, run_headless -# this gets a scriptable Gate Settings object -gateSettings = registry.getCalculation(1.0, "Gate Settings") -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) +def calculate_gate_settings(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar, TimeZone -# configure the end calendar -endCal = Calendar.getInstance(timeZone) -endCal.clear() -endCal.set(Calendar.YEAR, 2015) -endCal.set(Calendar.MONTH, 6) + # this gets a scriptable Gate Settings object + gate_settings = registry.getCalculation(1.0, "Gate Settings") + # Time zone must be set because the Solaris time zone is UTC + time_zone = TimeZone.getTimeZone("US/Central") + # configure the start calendar + start_cal = Calendar.getInstance(time_zone) + start_cal.clear() + start_cal.set(Calendar.YEAR, 2015) + start_cal.set(Calendar.MONTH, 4) -# gateSettings contains four callable methods -# void createGateSettings(String officeId, String locationStr, Date startDate, Date end) throws Exception; -# void createGateSettingsGroup(String officeId, String locationStr, Date startDate, Date end, String groupId) throws Exception; -# void createGateSettingsOutlet(String officeId, String locationStr, Date startDate, Date end, String outletId) throws Exception; -# void createGateSettingsOutletFromTs(String officeId, String locationStr, Date startDate, Date end, String outletId, String tsId) throws Exception; + # configure the end calendar + end_cal = Calendar.getInstance(time_zone) + end_cal.clear() + end_cal.set(Calendar.YEAR, 2015) + end_cal.set(Calendar.MONTH, 6) -# This is an example of a call that would create gate settings at TainterGate 1 at WTYT2 from the specified input time series. -gateSettings.createGateSettingsOutletFromTs("SWF", "WTYT2", startCal.getTime(), endCal.getTime(), "TG1", "WTYT2-TG1.Opening-Spillway_Gate.Const.0.0.MANUAL" ) + # gate_settings contains four callable methods + # void createGateSettings(String officeId, String locationStr, Date startDate, Date end) throws Exception; + # void createGateSettingsGroup(String officeId, String locationStr, Date startDate, Date end, String groupId) throws Exception; + # void createGateSettingsOutlet(String officeId, String locationStr, Date startDate, Date end, String outletId) throws Exception; + # void createGateSettingsOutletFromTs(String officeId, String locationStr, Date startDate, Date end, String outletId, String tsId) throws Exception; -# This is an example of a call that would create gate settings at TainterGate 1 at WTYT2 from the regi association configured input time series. -gateSettings.createGateSettingsOutlet("SWF", "WTYT2", startCal.getTime(), endCal.getTime(), "TG1") + # This is an example of a call that would create gate settings at TainterGate 1 at WTYT2 from the specified input time series. + gate_settings.createGateSettingsOutletFromTs("SWF", "WTYT2", start_cal.getTime(), end_cal.getTime(), "TG1", "WTYT2-TG1.Opening-Spillway_Gate.Const.0.0.MANUAL") -# This is an example of a call that would create gate settings at all outlets at WTYT2 which are in the TainterGateWTY group from the association configured time series. -gateSettings.createGateSettingsGroup("SWF", "WTYT2", startCal.getTime(), endCal.getTime(), "WTYT2-TainterGateWTY" ) + # This is an example of a call that would create gate settings at TainterGate 1 at WTYT2 from the regi association configured input time series. + gate_settings.createGateSettingsOutlet("SWF", "WTYT2", start_cal.getTime(), end_cal.getTime(), "TG1") -# This is an example of a call that would create gate settings for every outlet in a rating group at WTYT2. -gateSettings.createGateSettings("SWF", "WTYT2", startCal.getTime(), endCal.getTime() ) + # This is an example of a call that would create gate settings at all outlets at WTYT2 which are in the TainterGateWTY group from the association configured time series. + gate_settings.createGateSettingsGroup("SWF", "WTYT2", start_cal.getTime(), end_cal.getTime(), "WTYT2-TainterGateWTY") + # This is an example of a call that would create gate settings for every outlet in a rating group at WTYT2. + gate_settings.createGateSettings("SWF", "WTYT2", start_cal.getTime(), end_cal.getTime()) +if __name__ == "__main__": + with regi_session(): + run_headless(calculate_gate_settings) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalc.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalc.py index 2f26e26..8e4df61 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalc.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalc.py @@ -1,34 +1,40 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") +from regi_python import regi_session, run_headless -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) +def calculate_inflow(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar, TimeZone -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives + # this gets a scriptable Pool Percent object + inflow_calc = registry.getCalculation(1.0, "Inflow") -# Each method takes the followind arguments: -# officeId -# locationId -# startDate + # Time zone must be set because the Solaris time zone is UTC + time_zone = TimeZone.getTimeZone("US/Central") + # configure the start calendar + start_cal = Calendar.getInstance(time_zone) + start_cal.clear() + start_cal.set(Calendar.YEAR, 2015) + start_cal.set(Calendar.MONTH, 4) -# autoAdjust also takes booleans: -# useLimits -# freezeRain + # inflow_calc contains 4 callable methods: + # autoAdjust + # balanceAll + # cloneInflows + # zeroNegatives -# This autoBalances ALAT2 -inflowCalc.autoAdjust("SWF", "ALAT2", startCal.getTime(), False, False) + # Each method takes the following arguments: + # officeId + # locationId + # startDate + # autoAdjust also takes booleans: + # useLimits + # freezeRain + # This autoBalances ALAT2 + inflow_calc.autoAdjust("SWF", "ALAT2", start_cal.getTime(), False, False) + + +if __name__ == "__main__": + with regi_session(): + run_headless(calculate_inflow) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcAutoAdjust.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcAutoAdjust.py index c60eb8f..5825fa1 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcAutoAdjust.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcAutoAdjust.py @@ -1,36 +1,38 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone +from regi_python import regi_session, run_headless -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") -# configure the start calendar +def calculate_inflow(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar, TimeZone -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + # this gets a ScriptableInflow instance. + inflow_calc = registry.getCalculation(1.0, "Inflow") + # configure the start calendar + start_cal = Calendar.getInstance(TimeZone.getTimeZone("US/Central")) + start_cal.clear() + start_cal.set(Calendar.YEAR, 2018) + start_cal.set(Calendar.MONTH, 6) -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 7) + # inflow_calc contains 4 callable methods: + # autoAdjust + # balanceAll + # cloneInflows + # zeroNegatives + # Each method takes the following arguments: + # officeId + # locationId + # startDate -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives + # autoAdjust also takes booleans: + # useLimits + # freezeRain -# Each method takes the followind arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoBalances ALAT2 -inflowCalc.autoAdjust("SWF", "ALAT2", startCal.getTime(), False, False) + # This autoBalances ALAT2 + inflow_calc.autoAdjust("SWF", "ALAT2", start_cal.getTime(), False, False) +if __name__ == "__main__": + with regi_session(): + run_headless(calculate_inflow) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcBalanceAll.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcBalanceAll.py index 88b6219..a9cb225 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcBalanceAll.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcBalanceAll.py @@ -1,36 +1,38 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone +from regi_python import regi_session, run_headless -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") -# configure the start calendar +def calculate_inflow(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar, TimeZone -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + # this gets a ScriptableInflow instance. + inflow_calc = registry.getCalculation(1.0, "Inflow") + # configure the start calendar + start_cal = Calendar.getInstance(TimeZone.getTimeZone("US/Central")) + start_cal.clear() + start_cal.set(Calendar.YEAR, 2018) + start_cal.set(Calendar.MONTH, 7) -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) + # inflow_calc contains 4 callable methods: + # autoAdjust + # balanceAll + # cloneInflows + # zeroNegatives + # Each method takes the following arguments: + # officeId + # locationId + # startDate -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives + # autoAdjust also takes booleans: + # useLimits + # freezeRain -# Each method takes the followind arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoBalances ALAT2 -inflowCalc.balanceAll("SWF", "ALAT2", startCal.getTime()) + # This autoBalances ALAT2 + inflow_calc.balanceAll("SWF", "ALAT2", start_cal.getTime()) +if __name__ == "__main__": + with regi_session(): + run_headless(calculate_inflow) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcClone.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcClone.py index 57609b7..d3590d5 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcClone.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcClone.py @@ -1,36 +1,38 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone +from regi_python import regi_session, run_headless -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") -# configure the start calendar +def calculate_inflow(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar, TimeZone -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + # this gets a ScriptableInflow instance. + inflow_calc = registry.getCalculation(1.0, "Inflow") + # configure the start calendar + start_cal = Calendar.getInstance(TimeZone.getTimeZone("US/Central")) + start_cal.clear() + start_cal.set(Calendar.YEAR, 2018) + start_cal.set(Calendar.MONTH, 7) -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) + # inflow_calc contains 4 callable methods: + # autoAdjust + # balanceAll + # cloneInflows + # zeroNegatives + # Each method takes the following arguments: + # officeId + # locationId + # startDate -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives + # autoAdjust also takes booleans: + # useLimits + # freezeRain -# Each method takes the followind arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoBalances ALAT2 -inflowCalc.cloneInflows("SWF", "ALAT2", startCal.getTime()) + # This autoBalances ALAT2 + inflow_calc.cloneInflows("SWF", "ALAT2", start_cal.getTime()) +if __name__ == "__main__": + with regi_session(): + run_headless(calculate_inflow) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcComputeEvapAsFlow.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcComputeEvapAsFlow.py index 3ab7b56..8f5bce3 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcComputeEvapAsFlow.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcComputeEvapAsFlow.py @@ -1,23 +1,29 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone +from regi_python import regi_session, run_headless -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) +def calculate_inflow(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar, TimeZone + # this gets a ScriptableInflow instance. + inflow_calc = registry.getCalculation(1.0, "Inflow") -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 4) + # configure the start calendar + start_cal = Calendar.getInstance(TimeZone.getTimeZone("US/Central")) + start_cal.clear() + start_cal.set(Calendar.YEAR, 2018) + start_cal.set(Calendar.MONTH, 4) -endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -endCal.clear() -endCal.set(Calendar.YEAR, 2018) -endCal.set(Calendar.MONTH, 4) -endCal.set(Calendar.DAY_OF_MONTH, 4) + end_cal = Calendar.getInstance(TimeZone.getTimeZone("US/Central")) + end_cal.clear() + end_cal.set(Calendar.YEAR, 2018) + end_cal.set(Calendar.MONTH, 4) + end_cal.set(Calendar.DAY_OF_MONTH, 4) -# This computes and saves evap as flow for EUFA in May 2018 -inflowCalc.computeEvapAsFlow("SWT", "EUFA", startCal.getTime(), endCal.getTime()) \ No newline at end of file + # This computes and saves evap as flow for EUFA in May 2018 + inflow_calc.computeEvapAsFlow("SWT", "EUFA", start_cal.getTime(), end_cal.getTime()) + + +if __name__ == "__main__": + with regi_session(): + run_headless(calculate_inflow) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcComputedInflow.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcComputedInflow.py index 9def655..591325f 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcComputedInflow.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcComputedInflow.py @@ -1,24 +1,29 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.calculator.inflow import InflowComputationStorageOption +from regi_python import regi_session, run_headless -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) +def calculate_inflow(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar, TimeZone + # this gets a ScriptableInflow instance. + inflow_calc = registry.getCalculation(1.0, "Inflow") -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 4) + # configure the start calendar + start_cal = Calendar.getInstance(TimeZone.getTimeZone("US/Central")) + start_cal.clear() + start_cal.set(Calendar.YEAR, 2018) + start_cal.set(Calendar.MONTH, 4) -endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -endCal.clear() -endCal.set(Calendar.YEAR, 2018) -endCal.set(Calendar.MONTH, 4) -endCal.set(Calendar.DAY_OF_MONTH, 4) + end_cal = Calendar.getInstance(TimeZone.getTimeZone("US/Central")) + end_cal.clear() + end_cal.set(Calendar.YEAR, 2018) + end_cal.set(Calendar.MONTH, 4) + end_cal.set(Calendar.DAY_OF_MONTH, 4) -# This computes and saves inflow for EUFA in May 2018 given the computation options set above -inflowCalc.computeInflow("SWT", "EUFA", startCal.getTime(), endCal.getTime()) + # This computes and saves inflow for EUFA in May 2018 given the computation options set above + inflow_calc.computeInflow("SWT", "EUFA", start_cal.getTime(), end_cal.getTime()) + + +if __name__ == "__main__": + with regi_session(): + run_headless(calculate_inflow) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcZeroNegative.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcZeroNegative.py index ca1e5a0..b0e85ad 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcZeroNegative.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/InflowCalcZeroNegative.py @@ -1,36 +1,38 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone +from regi_python import regi_session, run_headless -# this gets a scriptable Pool Percent object -inflowCalc = registry.getCalculation(1.0, "Inflow") -# configure the start calendar +def calculate_inflow(registry): + # Java imports must happen after regi_session starts the JVM. + from java.util import Calendar, TimeZone -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) + # this gets a ScriptableInflow instance. + inflow_calc = registry.getCalculation(1.0, "Inflow") + # configure the start calendar + start_cal = Calendar.getInstance(TimeZone.getTimeZone("US/Central")) + start_cal.clear() + start_cal.set(Calendar.YEAR, 2018) + start_cal.set(Calendar.MONTH, 7) -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) + # inflow_calc contains 4 callable methods: + # autoAdjust + # balanceAll + # cloneInflows + # zeroNegatives + # Each method takes the following arguments: + # officeId + # locationId + # startDate -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives + # autoAdjust also takes booleans: + # useLimits + # freezeRain -# Each method takes the followind arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoBalances ALAT2 -inflowCalc.zeroNegatives("SWF", "ALAT2", startCal.getTime()) + # This autoBalances ALAT2 + inflow_calc.zeroNegatives("SWF", "ALAT2", start_cal.getTime()) +if __name__ == "__main__": + with regi_session(): + run_headless(calculate_inflow) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/examples/LoggingOptionsExamples.py b/regi-headless/src/test/resources/usace/rowcps/headless/examples/LoggingOptionsExamples.py index 139adba..cd5db36 100644 --- a/regi-headless/src/test/resources/usace/rowcps/headless/examples/LoggingOptionsExamples.py +++ b/regi-headless/src/test/resources/usace/rowcps/headless/examples/LoggingOptionsExamples.py @@ -1,4 +1,4 @@ -from usace.rowcps.headless import LoggingOptions +from regi_python import regi_session, run_headless # Description of: LoggingOptions.setDbMessageLevel(int level) # @@ -16,7 +16,11 @@ # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | # --------------|-------------------------------------------------------------------------------------------------------------------------------| -LoggingOptions.setDbMessageLevel(2) +def configure_logging_options(registry): + # Java imports must happen after regi_session starts the JVM. + from usace.rowcps.headless import LoggingOptions + + LoggingOptions.setDbMessageLevel(2) # Description of: LoggingOptions.setMetricsEnabled(boolean value) @@ -30,4 +34,45 @@ # # By default, Metrics are disabled. -LoggingOptions.setMetricsEnabled(True) \ No newline at end of file + LoggingOptions.setMetricsEnabled(True) + +# Description of: LoggingOptions.enableAbridgedFlowGroupCompLogging() +# +# Enables the abridged flow group computation logging. This only applies to flow group computations, and will log +# information similar to a non-verbose REGI computation log. +# +# Example Output: +# Flow Group: Gated_Total 30Jun2018 2400 CDT 90.00 (cfs) +# Primary Time Series: SKIA.Flow-Controlled.Inst.1Hour.0.Rev-Regi-Flowgroup 90.00 (cfs) External Time Series: none Flow Group Computation: Total: 90.00 (cfs) +# +# By default flow group computation logging is disabled. + + LoggingOptions.enableAbridgedFlowGroupCompLogging() + +# Description of: LoggingOptions.enableAbridgedFlowGroupCompLogging() +# +# Enables the full flow group computation logging. This only applies to flow group computations, and will log +# information similar to a verbose REGI computation log. +# +# Example Output: +# Primary Time Series: +# TXKT2-Gated_Total.Flow-Out.Inst.1Hour.0.Rev-SWF-REGI 87.00 (cfs) * External Time Series: none Flow Group Computation: Total: 87.00 (cfs) | Merge Rule: Replace All Override Protection: false +# +# +# +# By default flow group computation logging is disabled. + + LoggingOptions.enableFullFlowGroupCompLogging() + +# Description of: LoggingOptions.disableFlowGroupCompLogging() +# +# Disables the logging of flow group computations. This is the default state of the LoggingOptions and does not need +# to be called unless LoggingOptions.enableAbridgedFlowGroupCompLogging() or LoggingOptions.enableFullFlowGroupCompLogging() +# have been called. + + LoggingOptions.disableFlowGroupCompLogging() + + +if __name__ == "__main__": + with regi_session(): + run_headless(configure_logging_options) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/hec.passwd b/regi-headless/src/test/resources/usace/rowcps/headless/hec.passwd deleted file mode 100644 index 5b27e06..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/hec.passwd +++ /dev/null @@ -1,2 +0,0 @@ -v2.0 -bang:1521:v11203swf02|QZg5V85RPTaV2ew1XkEVhBd/vHtxTr/rsDmgHyBfSoD= diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/tests/GateFlow.py b/regi-headless/src/test/resources/usace/rowcps/headless/tests/GateFlow.py deleted file mode 100644 index 32926c3..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/tests/GateFlow.py +++ /dev/null @@ -1,187 +0,0 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless import LoggingOptions - -def compute_All_Flowgroups(officeID, location, startCal, endCal): - # Takes in locations defined by user in group and computes all flow groups - try: - gateCalc.computeAll(officeID, location, startCal.getTime(), endCal.getTime()) - except Exception as e: - print "Error Computing all Flow Groups at {0} {1}".format(officeID, location) - print e - print '' - - -def compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup): - try: - gateCalc.computeFlowGroup(officeID, location, startCal.getTime(), endCal.getTime(), "Flow.{0}.{1}".format(location, flowGroup)) - except Exception as e: - print "Error Computing Flow Group {0} at {1}".format(officeID, location) - print e - print '' - - # #gateCalc.computeFlowGroup("SWF", "ACTT2", startCal.getTime(), endCal.getTime(), "Flow.ACTT2.Pump_Out_Total") -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(0) -LoggingOptions.enableAbridgedFlowGroupCompLogging() - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -# LoggingOptions.setMetricsEnabled(True) - -# not all of Regi is scriptable, registry is an object created by the java class RegiCLI that contains a list of -# the implemented scriptable calculations -names = registry.getNames(1.0) - -# this retrieves a Gate Flow calculation object -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -# the gate flow calculations requires a start and end time. -# here we create a java Calendar object that will be used to create the start Date -startCal = Calendar.getInstance(timeZone) -startCal.clear() -#startCal.add(Calendar.DAY_OF_MONTH, -6) -#startCal.set(Calendar.HOUR, 0) -#startCal.set(Calendar.MINUTE, 0) -#startCal.set(Calendar.MILLISECOND, 0) -#startCal.set(Calendar.SECOND, 0) -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 5) - -# create a java Calendar object that will be used to create the end Date -endCal = Calendar.getInstance(timeZone) -endCal.clear() -#endCal.add(Calendar.DAY_OF_MONTH, 5) -#endCal.set(Calendar.HOUR, 0) -#endCal.set(Calendar.MINUTE, 0) -#endCal.set(Calendar.MILLISECOND, 0) -#endCal.set(Calendar.SECOND, 0) -endCal.set(Calendar.YEAR, 2018) -endCal.set(Calendar.MONTH, 6) - -officeID = "SWT" - -# the gateCalc object can perform its calculation for a single flow group -# the computeFlowGroup method takes: -# officeId -# projectId -# startDate -# endDate -# gateCalc.computeFlowGroup("SWF", "LEWT2", startCal.getTime(), endCal.getTime(), "Flow.LEWT2.ConduitGate_Total") -# By setting the following parameter to True, the following flow groups in the list FlowGroupList will all be calculated. Items can be commented out -# or commented back in individually. To turn this option off, set the following parameter to False. User can determine which flow group they want to calculate -# by changing the "flowGroup" variable. -calculateSingleFlowGroups = True -flowGroup = "Gated_Total" -locationList = ["SKIA", - "FGIB" -# "GGLT2", -# "GNGT2", -# "GPVT2", -# "HORT2", -# "JFNT2", -# "JPLT2", -# "JSPT2", -# "LEWT2", -# "LVNT2", -# "PCTT2", -# "RRLT2", -# "FRHT2", -# "SCLT2", -# "SMCT2", -# "SOMT2", -# "STIT2", -# "TXKT2", -# "WTYT2", -# "TRNT2", -# "FFLT2", -# "BPRT2", -# "EAMT2", -# "FLWT2", -# "LLST2", -# "GBYT2", -# "PSMT2", -# "TBLT2", -# "TBRT2", -# "GPET2", -# "BSLT2", -# "SAGT2", -# "MSDT2", - ] - -# the calculation can also be performed for all the associated groups -# the computeAll method takes: -# officeId -# projectId -# startDate -# endDate -# By setting the following parameter to True, all of the following flow groups in each location in the list locationList will all be calculated. -# Items can be commented out or commented back in individually. To turn this option off, set the following parameter to False. - -calculateAllFlowGroups = False -FlowGroupList = ["FGIB", - "SKIA", -# "GPVT2", -# "HORT2", -# "JPLT2", -# "LEWT2", -# "LVNT2", -# "PCTT2", -# "RRLT2", -# "FRHT2", -# "SCLT2", -# "SMCT2", -# "SOMT2", -# "STIT2", -# "TXKT2", -# "WTYT2", -# "TRNT2", -# "FFLT2", -# "EAMT2", -# "FLWT2", -# "LLST2", -# "GBYT2", -# "PSMT2", -# "SAGT2", - ] - - -if calculateSingleFlowGroups: - for location in locationList: - print "Now Running", location, "SINGLE" - compute_Single_Flowgroup(officeID, location, startCal, endCal, flowGroup) - -if calculateAllFlowGroups: - for location in FlowGroupList: - print "Now Running", location, "GROUP" - compute_All_Flowgroups(officeID, location, startCal, endCal) - - - diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/tests/GateFlowCalc.py b/regi-headless/src/test/resources/usace/rowcps/headless/tests/GateFlowCalc.py deleted file mode 100644 index c32a4d1..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/tests/GateFlowCalc.py +++ /dev/null @@ -1,22 +0,0 @@ -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.tests import TestVariables - -names = registry.getNames(1.0) -print "names", names - -gateCalc = registry.getCalculation(1.0, "Gate Flow") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -startCal = Calendar.getInstance(timeZone) -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) - -endCal = Calendar.getInstance(timeZone) -endCal.clear() -endCal.set(Calendar.YEAR, 2015) -endCal.set(Calendar.MONTH, 6) - -gateCalc.computeAll(TestVariables.OFFICE_ID, TestVariables.GATE_LOCATION, startCal.getTimeInMillis(), endCal.getTimeInMillis()) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/tests/GateSettings.py b/regi-headless/src/test/resources/usace/rowcps/headless/tests/GateSettings.py deleted file mode 100644 index c3594dd..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/tests/GateSettings.py +++ /dev/null @@ -1,45 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone - -# this gets a scriptable Gate Settings object -gateSettings = registry.getCalculation(1.0, "Gate Settings") - -# Time zone must be set because the Solaris time zone is UTC -timeZone = TimeZone.getTimeZone("US/Central") -# configure the start calendar -startCal = Calendar.getInstance(timeZone) -startCal.clear() -startCal.set(Calendar.YEAR, 2015) -startCal.set(Calendar.MONTH, 4) - -# configure the end calendar -endCal = Calendar.getInstance() -endCal.clear() -endCal.set(Calendar.YEAR, 2015) -endCal.set(Calendar.MONTH, 6) - - -# gateSettings contains four callable methods -# void createGateSettings(String officeId, String locationStr, Date startDate, Date end) throws Exception; -# void createGateSettingsGroup(String officeId, String locationStr, Date startDate, Date end, String groupId) throws Exception; -# void createGateSettingsOutlet(String officeId, String locationStr, Date startDate, Date end, String outletId) throws Exception; -# void createGateSettingsOutletFromTs(String officeId, String locationStr, Date startDate, Date end, String outletId, String tsId) throws Exception; - -office = TestVariables.OFFICE_ID -loc = TestVariables.GATE_LOCATION - -# This is an example of a call that would create gate settings at TainterGate 1 at WTYT2 from the specified input time series. -gateSettings.createGateSettingsOutletFromTs(office, loc, startCal.getTime(), endCal.getTime(), "TG1", loc + "-TG1.Opening-Spillway_Gate.Const.0.0.MANUAL" ) - -# This is an example of a call that would create gate settings at TainterGate 1 at WTYT2 from the regi association configured input time series. -gateSettings.createGateSettingsOutlet(office, loc, startCal.getTime(), endCal.getTime(), "TG1") - -# This is an example of a call that would create gate settings at all outlets at WTYT2 which are in the TainterGateWTY group from the association configured time series. -gateSettings.createGateSettingsGroup(office, loc, startCal.getTime(), endCal.getTime(), loc + "-TainterGate" ) - -# This is an example of a call that would create gate settings for every outlet in a rating group at WTYT2. -gateSettings.createGateSettings(office, loc, startCal.getTime(), endCal.getTime() ) - - - diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcAutoAdjust.py b/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcAutoAdjust.py deleted file mode 100644 index b505c9b..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcAutoAdjust.py +++ /dev/null @@ -1,36 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.tests import TestVariables - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 6) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the followind arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoBalances ALAT2 -inflowCalc.autoAdjust(TestVariables.OFFICE_ID, TestVariables.INFLOW_LOCATION, startCal.getTime(), False, False) - - diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcBalanceAll.py b/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcBalanceAll.py deleted file mode 100644 index 8d91e5f..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcBalanceAll.py +++ /dev/null @@ -1,36 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.tests import TestVariables - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 7) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the followind arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoBalances ALAT2 -inflowCalc.balanceAll(TestVariables.OFFICE_ID, TestVariables.INFLOW_LOCATION, startCal.getTime()) - - diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcClone.py b/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcClone.py deleted file mode 100644 index f45eee8..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcClone.py +++ /dev/null @@ -1,34 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.tests import TestVariables - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 7) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the followind arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoBalances ALAT2 -inflowCalc.cloneInflows(TestVariables.OFFICE_ID, TestVariables.INFLOW_LOCATION, startCal.getTime()) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcComputeEvapAsFlow.py b/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcComputeEvapAsFlow.py deleted file mode 100644 index 3a79f06..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcComputeEvapAsFlow.py +++ /dev/null @@ -1,23 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.tests import TestVariables - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 4) - -endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -endCal.clear() -endCal.set(Calendar.YEAR, 2018) -endCal.set(Calendar.MONTH, 4) -endCal.set(Calendar.DAY_OF_MONTH, 4) - -# This computes and saves evap as flow for EUFA in May 2018 -inflowCalc.computeEvapAsFlow(TestVariables.OFFICE_ID, TestVariables.INFLOW_LOCATION, startCal.getTime(), endCal.getTime()) \ No newline at end of file diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcComputedInflow.py b/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcComputedInflow.py deleted file mode 100644 index 4cd6e5a..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcComputedInflow.py +++ /dev/null @@ -1,37 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.calculator.inflow import InflowComputationStorageOption -from usace.rowcps.headless.tests import TestVariables - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - - -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 4) - -endCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) -endCal.clear() -endCal.set(Calendar.YEAR, 2018) -endCal.set(Calendar.MONTH, 4) -endCal.set(Calendar.DAY_OF_MONTH, 4) - - -# This code has been deprecated, but the API must exist. -storageOptionsSet = False -try: - inflowCalc.setComputationStorageOptions(InflowComputationStorageOption.EVAP_AS_FLOW, InflowComputationStorageOption.PROJECT_RELEASES) - storageOptionsSet = True -except: - print "Exception occurred during setComputationStorageOptions, this is expected" - -if storageOptionsSet: - throw Exception("ScriptableInflow::setComputationStorageOptions should not be working") - -# This computes and saves inflow for EUFA in May 2018 given the computation options set above -inflowCalc.computeInflow(TestVariables.OFFICE_ID, TestVariables.INFLOW_LOCATION, startCal.getTime(), endCal.getTime()) diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcZeroNegative.py b/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcZeroNegative.py deleted file mode 100644 index 5e33586..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/tests/InflowCalcZeroNegative.py +++ /dev/null @@ -1,34 +0,0 @@ -# the java Calendar class is used to create java Date objects -from java.util import Calendar -from java.util import TimeZone -from usace.rowcps.headless.tests import TestVariables - -# this gets a ScriptableInflow instance. -inflowCalc = registry.getCalculation(1.0, "Inflow") - -# configure the start calendar -startCal = Calendar.getInstance(TimeZone.getTimeZone('US/Central')) - -startCal.clear() -startCal.set(Calendar.YEAR, 2018) -startCal.set(Calendar.MONTH, 7) - - -# inflowCalc contains 4 callable methods: -# autoAdjust -# balanceAll -# cloneInflows -# zeroNegatives - -# Each method takes the following arguments: -# officeId -# locationId -# startDate - -# autoAdjust also takes booleans: -# useLimits -# freezeRain - -# This autoBalances ALAT2 -inflowCalc.zeroNegatives(TestVariables.OFFICE_ID, TestVariables.INFLOW_LOCATION, startCal.getTime()) - diff --git a/regi-headless/src/test/resources/usace/rowcps/headless/tests/LoggingOptionsExamples.py b/regi-headless/src/test/resources/usace/rowcps/headless/tests/LoggingOptionsExamples.py deleted file mode 100644 index 61835bf..0000000 --- a/regi-headless/src/test/resources/usace/rowcps/headless/tests/LoggingOptionsExamples.py +++ /dev/null @@ -1,69 +0,0 @@ -from usace.rowcps.headless import LoggingOptions - -# Description of: LoggingOptions.setDbMessageLevel(int level) -# -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended -# level is 2, as this provides basic information about the time series -# retrieval/storage. -# -# Message Level | Description -# --------------|-------------------------------------------------------------------------------------------------------------------------------| -# <=0 | Default value, does not do anything. Lower values do not change behavior. | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | -# 2 | Adds message with name of time series, and the units to retrieve/store. | -# 3 | Adds message with the current time. | -# 4 | Adds message with first 10 dates and values from each time series. | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| - -LoggingOptions.setDbMessageLevel(2) - - -# Description of: LoggingOptions.setMetricsEnabled(boolean value) -# -# Enables or disables the storage of REGI's Metric data pertaining to the -# performance of the application. This is incredibly helpful for identifying -# issues where the application takes an excessive amount of time to operate. -# -# Metrics also log the location of the files as an INFO message if they are -# enabled. -# -# By default, Metrics are disabled. - -LoggingOptions.setMetricsEnabled(True) - -# Description of: LoggingOptions.enableAbridgedFlowGroupCompLogging() -# -# Enables the abridged flow group computation logging. This only applies to flow group computations, and will log -# information similar to a non-verbose REGI computation log. -# -# Example Output: -# Flow Group: Gated_Total 30Jun2018 2400 CDT 90.00 (cfs) -# Primary Time Series: SKIA.Flow-Controlled.Inst.1Hour.0.Rev-Regi-Flowgroup 90.00 (cfs) External Time Series: none Flow Group Computation: Total: 90.00 (cfs) -# -# By default flow group computation logging is disabled. - -LoggingOptions.enableAbridgedFlowGroupCompLogging() - -# Description of: LoggingOptions.enableAbridgedFlowGroupCompLogging() -# -# Enables the full flow group computation logging. This only applies to flow group computations, and will log -# information similar to a verbose REGI computation log. -# -# Example Output: -# Primary Time Series: -# TXKT2-Gated_Total.Flow-Out.Inst.1Hour.0.Rev-SWF-REGI 87.00 (cfs) * External Time Series: none Flow Group Computation: Total: 87.00 (cfs) | Merge Rule: Replace All Override Protection: false -# -# -# -# By default flow group computation logging is disabled. - -LoggingOptions.enableFullFlowGroupCompLogging() - -# Description of: LoggingOptions.disableFlowGroupCompLogging() -# -# Disables the logging of flow group computations. This is the default state of the LoggingOptions and does not need -# to be called unless LoggingOptions.enableAbridgedFlowGroupCompLogging() or LoggingOptions.enableFullFlowGroupCompLogging() -# have been called. - -LoggingOptions.disableFlowGroupCompLogging() \ No newline at end of file