Package hms.model
Class JythonHms
- java.lang.Object
-
- hms.model.JythonHms
-
public class JythonHms extends java.lang.Object
Title: JythonHms Description: JythonHms contains code that implements the interface between Jython and Java for HMS. It provides a PythonInterpreter for executing a Python script, and includes methods for doing common tasks in HMS. Copyright: Copyright (c) 2003 Company: U.S. Army Corps of Engineers
-
-
Constructor Summary
Constructors Constructor Description JythonHms()
Creates a JythonHms object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
ComputeForecast(java.lang.String forecastName)
static void
ComputeRun(java.lang.String runName)
static void
ComputeTrial(java.lang.String trialName)
static void
CopyForecastResults(java.lang.String forecastName, java.lang.String dssFileName, java.lang.String fPart)
Jython method: Copy results from a specified forecast alternative to the given DSS file with the given pathname f-part.static void
CopyRunResults(java.lang.String runName, java.lang.String dssFileName, java.lang.String fPart)
Jython method: Copy results from a specified simulation run to the given DSS file with the given pathname f-part.static void
CopyTrialResults(java.lang.String trialName, java.lang.String dssFileName, java.lang.String fPart)
Jython method: Copy results from a specified optimization trial to the given DSS file with the given pathname f-part.static void
Exit(int exitCode)
Jython method: Exits the script.static void
HMSExit(int exitCode)
Jython method: Exits the script.static void
OpenBasinModel(java.lang.String basinName)
Jython method: Opens a basin model for the current project.static void
OpenProject(java.lang.String projectName, java.lang.String directory)
Jython method: Opens a project.static void
RenameStateGridBPart(java.lang.String bPart)
Jython method: Renames B-part for state grid DSS records.static int
runScript(java.lang.String scriptFileName)
Runs the specified script.static void
SaveAllProjectComponents()
Jython method: Saves all open components, and data managers.static void
SaveBasinModel()
Jython method: Saves current basin model.static void
SaveBasinModelAs(java.lang.String newName)
Jython method: Saves current basin model with a new name.static void
SelectOptimizationTrial(java.lang.String trialName)
Jython method: Select optimization trial for the current project.static void
SetBaseflowValue(java.lang.String elementName, java.lang.String parameterName, double value)
Jython method: Sets value for a baseflow parameter in a subbasin.static void
SetBaseflowValue(java.lang.String elementName, java.lang.String parameterName, java.lang.String value)
Jython method: Sets value for a baseflow parameter in a subbasin.static void
SetBasinUnitSystem(java.lang.String unitSystem)
Jython method: Sets unit system for current basin model.static void
SetBlendMethod(java.lang.String elementName, java.lang.String blendMethod)
Jython method: Sets blend method for a basin element.static void
SetBlendMethod(java.lang.String elementName, java.lang.String blendMethod, double taperDuration)
Jython method: Sets blend method for a basin element.static void
SetBlendMethod(java.lang.String elementName, java.lang.String blendMethod, java.lang.String taperDuration)
Jython method: Sets blend method for a basin element.static void
SetLossRateValue(java.lang.String elementName, java.lang.String parameterName, double value)
Jython method: Sets value for a loss rate parameter in a subbasin.static void
SetLossRateValue(java.lang.String elementName, java.lang.String parameterName, java.lang.String value)
Jython method: Sets value for a loss rate parameter in a subbasin.static void
SetObjectiveFunctionTime(java.lang.String type, java.lang.String date, java.lang.String time)
Jython method: Sets time for evaluating objective function for the current optimizer.static void
SetParameterLock(java.lang.String elementName, java.lang.String parameterName, java.lang.String lock)
Jython method: Set lock for an optimization parameterstatic void
SetPercentMissingAllowed(double percent)
Jython method: Set percent missing observed flow allowed for optimization.static void
setProjectManager(ProjectManager manager)
void
setScriptFileName(java.lang.String filename)
static void
SetTimeWindow(java.lang.String startDate, java.lang.String startTime, java.lang.String endDate, java.lang.String endTime)
Sets the time window in the current Control Specification.static void
UseOptimizerTrialResults(java.lang.String runName, java.lang.String location, int trialNumber)
Jython method: Use optimizer results from the selected trial.
-
-
-
Method Detail
-
setProjectManager
public static void setProjectManager(ProjectManager manager)
-
setScriptFileName
public void setScriptFileName(java.lang.String filename)
-
runScript
public static int runScript(java.lang.String scriptFileName)
Runs the specified script. If the project manager has not been set runScript instantiates a ProjectManager before running the script.- Parameters:
scriptFileName
-- Returns:
-
OpenBasinModel
public static void OpenBasinModel(java.lang.String basinName)
Jython method: Opens a basin model for the current project.- Parameters:
basinName
-- Throws:
org.python.core.PyException
-
OpenProject
public static void OpenProject(java.lang.String projectName, java.lang.String directory)
Jython method: Opens a project. Usage: OpenProject("ProjectName", "Directory")- Parameters:
projectName
-directory
-- Throws:
org.python.core.PyException
-
SetTimeWindow
public static void SetTimeWindow(java.lang.String startDate, java.lang.String startTime, java.lang.String endDate, java.lang.String endTime)
Sets the time window in the current Control Specification.- Parameters:
startDate
-startTime
-endDate
-endTime
-- Throws:
org.python.core.PyException
- if the control spec is not defined
-
ComputeRun
public static void ComputeRun(java.lang.String runName)
-
ComputeTrial
public static void ComputeTrial(java.lang.String trialName)
-
ComputeForecast
public static void ComputeForecast(java.lang.String forecastName)
-
CopyRunResults
public static void CopyRunResults(java.lang.String runName, java.lang.String dssFileName, java.lang.String fPart)
Jython method: Copy results from a specified simulation run to the given DSS file with the given pathname f-part.- Parameters:
dssFileName
- new DSS file namefPart
- version identification (pathname f-part)- Throws:
org.python.core.PyException
-
CopyForecastResults
public static void CopyForecastResults(java.lang.String forecastName, java.lang.String dssFileName, java.lang.String fPart)
Jython method: Copy results from a specified forecast alternative to the given DSS file with the given pathname f-part.- Parameters:
dssFileName
- new DSS file namefPart
- version identification (pathname f-part)- Throws:
org.python.core.PyException
-
CopyTrialResults
public static void CopyTrialResults(java.lang.String trialName, java.lang.String dssFileName, java.lang.String fPart)
Jython method: Copy results from a specified optimization trial to the given DSS file with the given pathname f-part.- Parameters:
dssFileName
- new DSS file namefPart
- version identification (pathname f-part)- Throws:
org.python.core.PyException
-
RenameStateGridBPart
public static void RenameStateGridBPart(java.lang.String bPart)
Jython method: Renames B-part for state grid DSS records.- Throws:
org.python.core.PyException
-
SaveAllProjectComponents
public static void SaveAllProjectComponents()
Jython method: Saves all open components, and data managers.- Throws:
org.python.core.PyException
-
SaveBasinModel
public static void SaveBasinModel()
Jython method: Saves current basin model.- Throws:
org.python.core.PyException
-
SaveBasinModelAs
public static void SaveBasinModelAs(java.lang.String newName)
Jython method: Saves current basin model with a new name.- Parameters:
newName
- String
-
SelectOptimizationTrial
public static void SelectOptimizationTrial(java.lang.String trialName)
Jython method: Select optimization trial for the current project. Usage: SelectOptimizationTrial(Run, Location, Trial)- Parameters:
runName
- is the run name,location
- is the optimization location name,trialNumber
- is the trial number.- Throws:
org.python.core.PyException
-
SetParameterLock
public static void SetParameterLock(java.lang.String elementName, java.lang.String parameterName, java.lang.String lock)
Jython method: Set lock for an optimization parameter- Parameters:
elementName
- is the basin element name,parameterName
- is the parameter name,lock
- is "Yes" or "No".- Throws:
org.python.core.PyException
-
SetPercentMissingAllowed
public static void SetPercentMissingAllowed(double percent)
Jython method: Set percent missing observed flow allowed for optimization.- Parameters:
percent
- is percent of missing flow allowed.- Throws:
org.python.core.PyException
-
SetObjectiveFunctionTime
public static void SetObjectiveFunctionTime(java.lang.String type, java.lang.String date, java.lang.String time)
Jython method: Sets time for evaluating objective function for the current optimizer.- Parameters:
type
- is "Start" or "End"date
- is the datetime
- is time of day- Throws:
org.python.core.PyException
-
UseOptimizerTrialResults
public static void UseOptimizerTrialResults(java.lang.String runName, java.lang.String location, int trialNumber)
Jython method: Use optimizer results from the selected trial. Optimizer results are transferred to the basin model.- Parameters:
runName
- is optimization run name,location
- is name of optimization location,trialNumber
- is trial number.- Throws:
org.python.core.PyException
-
SetBasinUnitSystem
public static void SetBasinUnitSystem(java.lang.String unitSystem)
Jython method: Sets unit system for current basin model.- Parameters:
unitSystem
- is "English", "SI", or "Metric"- Throws:
org.python.core.PyException
-
SetBlendMethod
public static void SetBlendMethod(java.lang.String elementName, java.lang.String blendMethod)
Jython method: Sets blend method for a basin element.- Parameters:
elementName
- the element nameblendMethod
- "Linear Taper", "Step", or "None"- Throws:
org.python.core.PyException
-
SetBlendMethod
public static void SetBlendMethod(java.lang.String elementName, java.lang.String blendMethod, java.lang.String taperDuration)
Jython method: Sets blend method for a basin element. This methiod is included for compatibility with HMS 2.x Python scripts.- Parameters:
elementName
- is the element nameblendMethod
- is "Linear Taper", "Step", or "None"taperDuration
- is taper duration in mintues for linear taper method- Throws:
org.python.core.PyException
-
SetBlendMethod
public static void SetBlendMethod(java.lang.String elementName, java.lang.String blendMethod, double taperDuration)
Jython method: Sets blend method for a basin element.- Parameters:
elementName
- is the element nameblendMethod
- is "Linear Taper", "Step", or "None"taperDuration
- is taper duration in mintues for linear taper method- Throws:
org.python.core.PyException
-
SetBaseflowValue
public static void SetBaseflowValue(java.lang.String elementName, java.lang.String parameterName, java.lang.String value)
Jython method: Sets value for a baseflow parameter in a subbasin. This methiod is included for compatibility with HMS 2.x Python scripts. Call OpenBasinModel(String basinName) in order to set the target for the baseflow parameter change.- Parameters:
subbasinName
- is the subbasin name,parameterName
- is the parameter name.value
- is the parameter value- Throws:
org.python.core.PyException
-
SetBaseflowValue
public static void SetBaseflowValue(java.lang.String elementName, java.lang.String parameterName, double value)
Jython method: Sets value for a baseflow parameter in a subbasin. Call OpenBasinModel(String basinName) in order to set the target for the baseflow parameter change.- Parameters:
subbasinName
- is the subbasin name,parameterName
- is for BoundedRecession method: "InitialBaseflow", "Flow/AreaRatio", "RecessionFactor"; for Recession method: "InitialBaseflow", "Flow/AreaRatio", "RecessionFactor", "ThresholdFlow", or "FlowToPeakRatio"value
- is the parameter value- Throws:
org.python.core.PyException
-
SetLossRateValue
public static void SetLossRateValue(java.lang.String elementName, java.lang.String parameterName, java.lang.String value)
Jython method: Sets value for a loss rate parameter in a subbasin. This methiod is included for compatibility with HMS 2.x Python scripts. Call OpenBasinModel(String basinName) in order to set the target for the lossrate parameter change.- Parameters:
subbasinName
- is the subbasin name,parameterName
- is the parameter name.value
- is the parameter value- Throws:
org.python.core.PyException
-
SetLossRateValue
public static void SetLossRateValue(java.lang.String elementName, java.lang.String parameterName, double value)
Jython method: Sets value for a loss rate parameter in a subbasin. Call OpenBasinModel(String basinName) in order to set the target for the lossrate parameter change.- Parameters:
subbasinName
- is the subbasin name,parameterName
- is for DeficitConstant method: "InitialDeficit", "MaximumDeficit", "ConstantLossRate", or "RecoveryFactor"; for GreenAmpt method: "InitialLoss", "MoistureDeficit", "WettingFrontSuction", or "HydraulicConductivity" for InitialConstant method: "InitialLoss" or "ConstantLossRate"; for SCSLoss method: "SCSCurveNumber" or "SCSInitialAbstraction" for all loss methods: "PercentImperviousArea"value
- is the parameter value- Throws:
org.python.core.PyException
-
Exit
public static void Exit(int exitCode)
Jython method: Exits the script.- Parameters:
exitCode
- exit code number- Throws:
org.python.core.PyException
- exception type is Py.SystemExit; exception value is exit code
-
HMSExit
public static void HMSExit(int exitCode)
Jython method: Exits the script. This methiod is included for compatibility with HMS 2.x Python scripts.- Parameters:
exitCode
- exit code number- Throws:
org.python.core.PyException
- exception type is Py.SystemExit; exception value is exit code
-
-