' '---------------------------- '--- 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 --- '---------------- ' theview = av.getactivedoc ' '------------------ '--- 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) ' rogrid = (pregrid < 697.asgrid).con(((0.00064.asgrid * PREGRID * (0.0061.asgrid * PREGRID).exp)), (0.510.asgrid * PREGRID - 339.1.asgrid)).int ok = rogrid.buildvat if (not ok) then msgbox.error("Error building VAT", "RUNOFF GRID") end rofilename = av.getproject.makefilename("rogrid", "") rogrid.savedataset("/home/ferdi/quenzer/trialrun/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 --- '----------- '