'
'----------------------------
'--- Creation information ---
'----------------------------
'
'Name: rogrid.ave
'Version: 1.0
'Date: 02/18/97
'Author: Ferdi Hellweger
' Center for Research in Water Resources
' The University of Texas at Austin
' ferdi@crwr.utexas.edu
'Modified: 02/28/97
' Ann Quenzer
' Center for Research in Water Resources
' The University of Texas at Austin
' quenzer@mail.utexas.edu
' 1) changed the runoff equation to reflect the project area
' 2) computes an integer grid
' 3) built vat file for the resulting grid
' 4) added purpose and description
' 5) changed the message box description to reflect the script
'
'---------------------------
'--- Purpose/Description ---
'---------------------------
'
'Computes a runoff grid in mm/yr from the precipitation grid. Uses the runoff equation
'from Sean Reed's paper Water Balance of Texas.
'
'----------------
'--- Get view ---
'----------------
'
theproject = av.getproject
thedocs = theproject.getdocs
theviews = list.make
for each thedoc in thedocs
if (thedoc.getclass.getclassname = "view") then
theviews = theviews.add(thedoc)
end
end
if (theviews.count = 0) then
msgbox.error("No View Found", "RUNOFF GRID")
exit
end
if (theviews.count = 1) then
theview = theviews.get(0)
end
if (theviews.count > 1) then
theview = msgbox.listasstring(theviews, "Pick a View", "RUNOFF GRID")
if (theview = nil) then
exit
end
end
'
'------------------
'--- Get themes ---
'------------------
'
thethemes = theview.getthemes
if (thethemes.count = 0) then
msgbox.error("No themes found", "RUNOFF GRID")
exit
end
thegthemes = list.make
for each thetheme in thethemes
if (thetheme.getclass.getclassname = "gtheme") then
thegthemes.add(thetheme)
end
end
if (thegthemes.count = 0) then
msgbox.error("No grid themes found", "RUNOFF GRID")
exit
end
pretheme = msgbox.listasstring(thegthemes, "Precipitation theme", "RUNOFF GRID")
if (pretheme = nil) then
exit
end
'
'-----------------
'--- Calculate ---
'-----------------
'
pregrid = pretheme.getgrid
'
cellsize = number.makenull
dummmy = grid.getanalysiscellsize(cellsize)
extent = rect.makenull
dummy = grid.getanalysisextent(extent)
'
rogrid1 = (pregrid < 801.asgrid).con(((0.00064.asgrid * PREGRID * (0.0061.asgrid * PREGRID).exp)), (0.510.asgrid * PREGRID - 339.1.asgrid))
rogrid = rogrid1.int
ok = rogrid.buildvat
if (not ok) then
msgbox.error("Error building VAT", "RUNOFF GRID")
end
rofilename = av.getproject.makefilename("rogrid", "")
rogrid.savedataset("/home1/alpha62/boleskm/lavaca/runoff".asfilename)
rogtheme = gtheme.make(rogrid)
theview.addtheme(rogtheme)
rogtheme.setvisible(true)
'
'final message to user
'
message = "Runoff grid calculated."
msgbox.info(message,"RUNOFF GRID")
'
'-----------
'--- End ---
'-----------
'