' '---------------------------- '--- Creation information --- '---------------------------- ' 'Name: wfacgrid.ave 'Version: 1.0 'Date: 02/17/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 conversions to reflect project ' 2) changed the message box descriptions to ' reflect the script ' 3) computes an integer grid ' 4) added purpose and description ' ' Modified 3/9/98 by Patrice Melancon (pmelancon@mail.utexas.edu) ' 1) Edited the purpose and script to reflect accumulation of rainfall ' 2) No conversion factor in this; only accumulates precip values ' 3) Script was renamed as accpreci.ave '--------------------------- '--- Purpose/Description --- '--------------------------- ' 'Computes the weighted flow accumulation using the flow 'direction grid and the precipitation grid. The 'resulting grid produces a grid (precipload) with the 'total accumulated precipitation at any given point in in/yr*cells ' '---------------- '--- Get view --- '---------------- ' theview = av.getactivedoc ' '------------------ '--- Get themes --- '------------------ ' thethemes = theview.getthemes if (thethemes.count = 0) then msgbox.error("No themes found", "WFAC GRID") exit end if (thethemes.count = 1) then msgbox.error("Only one theme found", "WFAC 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", "WFAC GRID") exit end if (thethemes.count = 1) then msgbox.error("Only grid one theme found", "WFAC GRID") exit end fdrtheme = msgbox.listasstring(thegthemes, "Flow direction theme", "WFAC GRID") if (fdrtheme = nil) then exit end ldtheme = msgbox.listasstring(thegthemes, "Precip Grid", "WFAC GRID") if (ldtheme = nil) then exit end ' '----------------- '--- Calculate --- '----------------- ' fdrgrid = fdrtheme.getgrid ldgrid = ldtheme.getgrid ' cellsize = number.makenull dummmy = grid.getanalysiscellsize(cellsize) extent = rect.makenull dummy = grid.getanalysisextent(extent) ' facgrid = (fdrgrid.flowaccumulation(ldgrid)) facfilename = av.getproject.makefilename("facgrid", "") facgrid.savedataset("accprecip".asfilename) facgtheme = gtheme.make(facgrid) theview.addtheme(facgtheme) facgtheme.setvisible(true) ' 'final message to user ' message = "Accumulated precip grid calculated." msgbox.info(message,"WFAC GRID") ' '----------- '--- End --- '----------- '