| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Surfer SRF Files

Page history last edited by Dr. Ron Eaglin 15 years, 10 months ago

 Surfer (SRF) Files

 

The contouring of the rainfall isohyetes was done with Surfer using a standard kriging algorithm. The surfer files contain all information necessary to add more contours if you have the Surfer software. Surfer version 8 was used and it is available from Golden Software. The final results are reported as word files and as shape files on the pages Kriging Analysis Results and Shape Files . The attached shape files have 81 separate files representing return period (2Y through 500Y) and durations (1HR to 5D). These files are generated from the grid files included at Grid Files

 

Surfer Files.zip

 

 

The script used to generate these is shown below.

 

 

Sub Main

' Here we simply Grid COlumns 8 (1 hr ) To columns

Dim colDurations(11) As String
colDurations(1) = "1HR"
colDurations(2) = "2HR"
colDurations(3) = "6HR"
colDurations(4) = "12HR"
colDurations(5) = "24HR"
colDurations(6) = "48HR"
colDurations(7) = "72HR"
colDurations(8) = "4D"
colDurations(9) = "5D"

Dim returnPeriods(10) As String
returnPeriods(1) = "2YR"
returnPeriods(2) = "3YR"
returnPeriods(3) = "5YR"
returnPeriods(4) = "10YR"
returnPeriods(5) = "25YR"
returnPeriods(6) = "50YR"
returnPeriods(7) = "100YR"
returnPeriods(8) = "200YR"

Dim i	As Integer
Dim j	As Integer

'For i=1 To 8
'	For j=1 To 9
'		PlotContourMap returnPeriods(i)+colDurations(j)
'	Next j
'Next i

For i=1 To 8
	For j=1 To 9
		AddDetailPlot returnPeriods(i)+colDurations(j)
	Next j
Next i
'AddDetailPlot "2YR1HR"

End Sub
Sub AddDetailPlot(fileName As String)
Dim inputPath As String
Dim outputPath As String

inputPath = "C:UsersreaglinDocumentsWhitewaterresearchFEMA ProjectsRainfall ReportsGrid FilesKrigingModified\"
outputPath = "C:UsersreaglinDocumentsWhitewaterresearchFEMA ProjectsRainfall ReportsSurfer PlotsKrigingModified\"

Dim surferApp As  Object
Set surferApp = CreateObject("Surfer.Application")
surferApp.Visible = False

Dim srfPlot As Object
Set plot = surferApp.Documents.Open(outputPath+fileName+".srf")

Dim mapFrame As Object
Set mapFrame = plot.Shapes.Item(Index:="Map")


' Do South Florida Detail Plot
mapFrame.SetLimits(xMin:=-84.0, xMax:=-80.0, yMin:=24.5, yMax:=28.0)
mapFrame.xLength = 8.0
mapFrame.yLength = 7.0

plot.Selection.DeselectAll
mapFrame.Selected = True
plot.Selection.Copy


PasteAndSave fileName+"S",CreatePlotLabel(fileName) + " South Florida"


' Do Northeast Florida Detail Plot
mapFrame.SetLimits(xMin:=-84.0, xMax:=-80.0, yMin:=27.5, yMax:=31.0)
mapFrame.xLength = 8.0
mapFrame.yLength = 7.0

plot.Selection.DeselectAll
mapFrame.Selected = True
plot.Selection.Copy

PasteAndSave fileName+"NE",CreatePlotLabel(fileName) + " Northeast Florida"

' Do Northwest Florida Detail Plot
mapFrame.SetLimits(xMin:=-88.0, xMax:=-83.0, yMin:=28.0, yMax:=31.5)
mapFrame.xLength = 8.0
mapFrame.yLength = 7.0

plot.Selection.DeselectAll
mapFrame.Selected = True
plot.Selection.Copy


PasteAndSave fileName+"NW",CreatePlotLabel(fileName) + " Northwest Florida"

surferApp.Quit

End Sub
Sub PasteAndSave(fileName As String, PlotLabel As String)

Dim outputPath As String
outputPath = "C:UsersreaglinDocumentsWhitewaterresearchFEMA ProjectsRainfall ReportsSurfer PlotsKrigingModified\"


Dim wordApp As Object
Set wordApp = CreateObject("Word.Application")

Dim wordDoc As Object
Set wordDoc = wordApp.Documents.Add

wordApp.Visible = True
wordDoc.content.Paste
wordDoc.PageSetup.Orientation = 1


' Inserts the text
Dim wordRng As Object
Set wordRng = wordDoc.Range

   With wordRng
       .Font.Size = 12
	   .InsertAfter Chr(10)+Chr(13)
       .InsertAfter PlotLabel

		.Select
       .ParagraphFormat.Alignment = 1 'wdAlignParagraphCenter

   End With

wordDoc.SaveAs(outputPath+fileName + ".doc")
wordApp.Quit
End Sub

Sub PlotContourMap(fileName As String)
Dim inputPath As String
Dim outputPath As String
Dim PlotLabel As String

PlotLabel = CreatePlotLabel(fileName)

inputPath = "C:UsersreaglinDocumentsWhitewaterresearchFEMA ProjectsRainfall ReportsGrid FilesKrigingModified\"
outputPath = "C:UsersreaglinDocumentsWhitewaterresearchFEMA ProjectsRainfall ReportsSurfer PlotsKrigingModified\"

Dim surferApp As  Object
Set surferApp = CreateObject("Surfer.Application")
surferApp.Visible = False

Dim wordApp As Object
Set wordApp = CreateObject("Word.Application")


Dim wordDoc As Object
Set wordDoc = wordApp.Documents.Add

Set plot = surferApp.Documents.Add(srfDocPlot)

Dim shapes As Object
Set shapes = plot.Shapes

Dim mapFrame1 As Object
Set mapFrame1 = shapes.AddBaseMap(ImportFileName:="C:UsersreaglinDocumentsWhitewaterresearchFEMA ProjectsRainfall ReportsFL Counties Shape Filecs12_d00.shp")

Dim baseMap As Object
Set baseMap = mapFrame1.Overlays(1)

Dim mapFrame2 As Object
Set mapFrame2 = plot.Shapes.AddContourMap(inputPath+fileName+".GRD")

Dim contourMap As Object
Set contourMap =mapFrame2.Overlays(1)

Dim contourLevels As Object
Set contourLevels = contourMap.Levels

' Use this to set the intervals
Dim ivalue As Single
Select Case fileName
	Case "2YR1HR"
		ivalue = 0.1
	Case "2YR2HR"
		ivalue = 0.1
	Case "2YR6HR"
		ivalue = 0.1
	Case "2YR12HR"
		ivalue = 0.1
	Case "2YR24HR"
		ivalue = 0.2
	Case "2YR48HR"
		ivalue = 0.2
	Case "2YR72HR"
		ivalue = 0.2
	Case "2YR4D"
		ivalue = 0.5
	Case "2YR5D"
		ivalue = 0.5

	Case "3YR1HR"
		ivalue = 0.1
	Case "3YR2HR"
		ivalue = 0.1
	Case "3YR6HR"
		ivalue = 0.1
	Case "3YR12HR"
		ivalue = 0.2
	Case "3YR24HR"
		ivalue = 0.2
	Case "3YR48HR"
		ivalue = 0.2
	Case "3YR72HR"
		ivalue = 0.5
	Case "3YR4D"
		ivalue = 0.5
	Case "3YR5D"
		ivalue = 0.5

	Case "5YR1HR"
		ivalue = 0.1
	Case "5YR2HR"
		ivalue = 0.1
	Case "5YR6HR"
		ivalue = 0.2
	Case "5YR12HR"
		ivalue = 0.2
	Case "5YR24HR"
		ivalue = 0.2
	Case "5YR48HR"
		ivalue = 0.5
	Case "5YR72HR"
		ivalue = 0.5
	Case "5YR4D"
		ivalue = 1.0
	Case "5YR5D"
		ivalue = 1.0

	Case "10YR1HR"
		ivalue = 0.2
	Case "10YR2HR"
		ivalue = 0.2
	Case "10YR6HR"
		ivalue = 0.2
	Case "10YR12HR"
		ivalue = 0.2
	Case "10YR24HR"
		ivalue = 0.5
	Case "10YR48HR"
		ivalue = 0.5
	Case "10YR72HR"
		ivalue = 0.5
	Case "10YR4D"
		ivalue = 1.0
	Case "10YR5D"
		ivalue = 1.0

	Case "25YR1HR"
		ivalue = 0.2
	Case "25YR2HR"
		ivalue = 0.2
	Case "25YR6HR"
		ivalue = 0.5
	Case "25YR12HR"
		ivalue = 0.5
	Case "25YR24HR"
		ivalue = 0.5
	Case "25YR48HR"
		ivalue = 1.0
	Case "25YR72HR"
		ivalue = 1.0
	Case "25YR4D"
		ivalue = 1.0
	Case "25YR5D"
		ivalue = 1.0

	Case "50YR1HR"
		ivalue = 0.2
	Case "50YR2HR"
		ivalue = 0.5
	Case "50YR6HR"
		ivalue = 0.5
	Case "50YR12HR"
		ivalue = 0.5
	Case "50YR24HR"
		ivalue = 1.0
	Case "50YR48HR"
		ivalue = 1.0
	Case "50YR72HR"
		ivalue = 1.0
	Case "50YR4D"
		ivalue = 2.0
	Case "50YR5D"
		ivalue = 2.0

	Case "100YR1HR"
		ivalue = 0.5
	Case "100YR2HR"
		ivalue = 0.5
	Case "100YR6HR"
		ivalue = 0.5
	Case "100YR12HR"
		ivalue = 1.0
	Case "100YR24HR"
		ivalue = 1.0
	Case "100YR48HR"
		ivalue = 1.0
	Case "100YR72HR"
		ivalue = 2.0
	Case "100YR4D"
		ivalue = 2.0
	Case "100YR5D"
		ivalue = 2.0

	Case "200YR1HR"
		ivalue = 0.5
	Case "200YR2HR"
		ivalue = 0.5
	Case "200YR6HR"
		ivalue = 1.0
	Case "200YR12HR"
		ivalue = 1.0
	Case "200YR24HR"
		ivalue = 1.0
	Case "200YR48HR"
		ivalue = 2.0
	Case "200YR72HR"
		ivalue = 2.0
	Case "200YR4D"
		ivalue = 2.0
	Case "200YR5D"
		ivalue = 2.0

	Case Else
		ivalue=.2
End Select

contourLevels.AutoGenerate(MinLevel:=0, MaxLevel:=20, Interval:=ivalue)
contourLevels.SetLabelFrequency(FirstIndex:=1, NumberToSet:=200, NumberToSkip:=0)
contourMap.LabelFormat.NumDigits = 4

plot.Selection.DeselectAll
mapFrame1.Selected = True
mapFrame2.Selected = True

plot.Selection.OverlayMaps

Dim PageSetup As Object
Set PageSetup = Plot.PageSetup
PageSetup.Orientation = srfLandscape

plot.SaveAs(outputPath+fileName + ".srf")

plot.Selection.Copy

' Pstes the plot into word and chnages the page orientation to landscape
wordApp.Visible = True
wordDoc.content.Paste
wordDoc.PageSetup.Orientation = 1


' Inserts the text
Dim wordRng As Object
Set wordRng = wordDoc.Range

   With wordRng
       .Font.Size = 12
	   .InsertAfter Chr(10)+Chr(13)
       .InsertAfter PlotLabel

		.Select
       .ParagraphFormat.Alignment = 1 'wdAlignParagraphCenter

   End With

wordDoc.SaveAs(outputPath+fileName + ".doc")
wordApp.Quit
End Sub

Public Function Replace(ByVal sInputVal As String, _
   sFind As String, sReplaceWith As String) As String

    'NOTE: IF YOU HAVE VB6 OR HIGHER,Application
    'YOU DON'T NEED THIS. JUST USE
    'THE BUILT IN REPLACE FUNCTION
    Dim nPos As Long
    Dim sAns As String
    Dim sWkg As String

    If Len(sFind) <> 0 Then
        nPos = InStr(sInputVal, sFind)
        If nPos <> 0 Then
            sWkg = sInputVal
            Do
                If nPos >= Len(sWkg) Then
                    sAns = sAns & Left$(sWkg, Len(sWkg) - 1) _
                           & sReplaceWith
                Else
                    sAns = sAns & Left$(sWkg, nPos - 1) _
                           & sReplaceWith
                    nPos = nPos + Len(sFind) - 1
                End If
                sWkg = Mid$(sWkg, nPos + 1)
                nPos = InStr(sWkg, sFind)
            Loop While nPos > 0
            sAns = sAns & sWkg
        Else
            sAns = sInputVal
        End If
        Replace = sAns
    Else
        Replace = sInputVal
    End If

End Function
Public Function CreatePlotLabel(fileName As String) As String
Dim PlotLabel As String

	PlotLabel = fileName
PlotLabel = Replace(PlotLabel, "YR", " Year Return Period ")
PlotLabel = Replace(PlotLabel, "D", " Day Duration Rainfall Volume in Inches")
PlotLabel = Replace(PlotLabel, "HR", " Hour Duration Rainfall Volume in Inches")

CreatePlotLabel = PlotLabel
End Function

 

 

Comments (0)

You don't have permission to comment on this page.