' '---------------------------- '--- 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 ' '--------------------------- '--- Purpose/Description --- '--------------------------- ' 'Computes the weighted flow accumulation using the flow direction grid 'and the land surface loading grid. The resulting grid produces 'a grid (wfacload) with the loadings to the bay in Kg/day. ' '---------------- '--- 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, "Load theme", "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)).int facfilename = av.getproject.makefilename("facgrid", "") facgrid.savedataset("/home1/alpha62/maidment/ex7/wfacgrid".asfilename) facgtheme = gtheme.make(facgrid) theview.addtheme(facgtheme) facgtheme.setvisible(true) ' 'final message to user ' message = "Accumulated load grid calculated." msgbox.info(message,"WFAC GRID") ' '----------- '--- End --- '----------- '