(ATCScript "HSPF Watershed Summary Report" (Arg "CurScenario" "CurScenario") (Arg "PerConstituent" "PERO") (Arg "ImpConstituent" "SURO") (Arg "PerImpConv" "8687.6") (Arg "PerImpUnits" "inches") (Arg "RchConstituent" "ROVOL") (Arg "RchConv" "723.97") (Arg "RchUnits" "ac-ft") (Arg "PtConstituent" "FLOW") (Arg "PtConv" "1.0") (Arg "PtUnits" "cfs") (Arg "PtScenario" "PT-OBS") (Arg "AreaUnits" "acres") (Arg "TotalUnits" "cfs") (Arg "HspfAggregation" "Mean" (Array "Max" "Min" "Mean" "Geometric Mean" "Sum" "StdDeviation" "Variance")) (Arg "HspfTimeUnits" "Year" (Array "Second" "Minute" "Hour" "Month" "Year")) (Arg "HspfTimeStep" 1) (Arg "HspfnVals" 1) (LoadLibrary "ATCScriptData" "ATCScriptGrid" "ATCScriptHspf") (HspfUciOpen (+ CurScenario ".uci")) (Set ReportFileName (+ OutputDir CurScenario ".WatershedSummaryReport.txt")) (Set CRLF (+ (Chr 13) (Chr 10))) (Set FF "") (Set Space20 " ") (SaveFile ReportFilename "") (Set HspfStartInterval (HspfSJDate)) (While (< HspfStartInterval (HspfEJDate)) (Set HspfEndInterval (JDateAdd HspfStartInterval HspfTimeUnits HspfTimeStep HspfnVals)) (Grid "WatershedSummary" 8 10) (' Start with 8 columns and 10 rows - rows will expand as necessary, columns won't) (Set CurRow 0) (Grid 1 (++ CurRow) (+ "Watershed Summary Report for Scenario [" CurScenario "]" )) (Grid 1 (++ CurRow) (+ " Run Made " (Format (FileAttribute (+ InputDir CurScenario ".hbn") "date") "yyyy-mm-dd hh:mm"))) (Grid 1 (++ CurRow) (+ " " HspfAggregation " Rates and Totals")) (Grid 1 (++ CurRow) (+ " " (HspfRunInfo))) (Grid 1 (++ CurRow) (+ " Time Span: " HspfnVals " " HspfTimeUnits " from " (Format HspfStartInterval "mm/dd/yy") " to " (Format HspfEndInterval "mm/dd/yy"))) (+= CurRow 2) (Grid 1 CurRow (+ " " PerConstituent "/" ImpConstituent "/" PtConstituent "/" RchConstituent)) (+= CurRow 2) (Set NextRow (+ CurRow 1)) (Set NextRow2 (+ CurRow 2)) (Grid 1 CurRow (Format "Land Use" Space20)) (Grid 1 NextRow (Format " " Space20)) (Grid 1 NextRow2 (Format " " Space20)) (Grid 2 CurRow "Perv.") (Grid 2 NextRow PerImpUnits) (Grid 2 NextRow2 PerConstituent) (Grid 3 CurRow "Imperv." ) (Grid 3 NextRow PerImpUnits) (Grid 3 NextRow2 ImpConstituent) (Grid 4 CurRow "Eff.Imp.") (Grid 5 CurRow "Combined") (Grid 5 NextRow PerImpUnits) (Grid 6 CurRow "Area") (Grid 6 NextRow AreaUnits) (Grid 7 CurRow "Total") (Grid 7 NextRow TotalUnits) (Grid 8 CurRow "% GrTot.") (+= CurRow 2) (Set GrandTotal 0) (Set TopTotalRow CurRow) (Set MetSegs (HspfMetSegs)) (For HspfMetSeg In MetSegs (Grid 1 (++ CurRow) (Format HspfMetSeg Space20)) (Set LandUses (HspfLandUses)) (For LandUse in LandUses (Set PerArea (HspfArea LandUse 1)) (Set ImpArea (HspfArea LandUse 0)) (Set TotalArea (+ PerArea ImpArea)) (Set PerVal 0) (If (> PerArea 0) (Set PerData (HspfBinData LandUse "PERLND" PerConstituent)) (Set DataSubset (DataTser PerData SubSetByDate HspfStartInterval HspfEndInterval)) (Set PerVal (DataTser DataSubset "Attrib" HspfAggregation)) ) (If (Not (IsNumeric PerVal)) (Set PerVal 0) ) (Set ImpVal 0) (If (> ImpArea 0) (Set ImpData (HspfBinData LandUse "IMPLND" ImpConstituent)) (Set DataSubset (DataTser ImpData SubSetByDate HspfStartInterval HspfEndInterval)) (Set ImpVal (DataTser DataSubset "Attrib" HspfAggregation)) ) (If (Not (IsNumeric ImpVal)) (Set ImpVal 0) ) (Set Total (+ (* PerArea PerVal) (* ImpArea ImpVal))) (++ CurRow) (Grid 1 CurRow (Format LandUse Space20)) (Grid 2 CurRow (Format PerVal "##,##0.0")) (Grid 3 CurRow (Format ImpVal "##,##0.0")) (If (= TotalArea 0) (Grid 4 CurRow "#0%") (Grid 5 CurRow "0.0") (Else (Grid 4 CurRow (Format (/ ImpArea TotalArea) "######0%")) (Grid 5 CurRow (Format (/ Total TotalArea) "##,##0.0")) ) ) (Grid 6 CurRow (Format TotalArea "###,##0.0")) (Set Total (/ Total PerImpConv)) (Grid 7 CurRow (Format Total "###,##0.0")) (+= GrandTotal Total) (Set Total 0) ) (++ CurRow) ) (Set PtSources (HspfPtSources)) (If (> (Len PtSources) 0) (Grid 1 (++ CurRow) (+ "Point Sources " PtConstituent)) (For PtSource in PtSources (++ CurRow) (Grid 1 CurRow (Format PtSource Space20)) (Set PtData (HspfPointData PtScenario PtSource PtConstituent)) (Set DataSubset (DataTser PtData SubSetByDate HspfStartInterval HspfEndInterval)) (Set Total (DataTser DataSubset "Attrib" HspfAggregation)) (Set Total (/ Total PtConv)) (Grid 7 CurRow (Format Total "###,##0.0")) (+= GrandTotal Total) ) (Else (Grid 1 (++ CurRow) "No Point Sources")) ) (++ CurRow) (Set Reaches (HspfReaches)) (If (> (Len Reaches) 0) (Grid 1 (++ CurRow) (+ "Reaches " RchConstituent)) (For Reach in Reaches (Grid 1 (++ CurRow) (Format Reach Space20)) (Set RchData (HspfBinData Reach "RCHRES" RchConstituent)) (Set DataSubset (DataTser RchData SubSetByDate HspfStartInterval HspfEndInterval)) (Set Total (DataTser DataSubset "Attrib" HspfAggregation)) (Set Total (/ Total RchConv)) (Grid 7 CurRow (Format Total "###,##0.0")) ) (Else (Grid 1 (++ CurRow) "No Reaches")) ) (++ CurRow) (Grid 1 (++ CurRow) (Format "Grand Total" Space20)) (Grid 7 CurRow (Format GrandTotal "###,##0.0")) (Set GrandTotalRow CurRow) (If (> GrandTotal 0) (For CurRow TopTotalRow (- GrandTotalRow 1) (Set Total (Grid 7 CurRow)) (If (IsNumeric Total) (Grid 8 CurRow (Format (/ Total GrandTotal) "####0.00%")) ) ) ) (AppendFile ReportFilename (+ FF (Grid "AsString" "" CRLF " "))) (Set FF (Chr 12)) (Set HspfStartInterval HspfEndInterval) ) ) )