'---------------------------------------------- '---------Creation Information----------------- '---------------------------------------------- ' 'Name: displayemm 'Author: Cindy How 'Date: 3/97 ' '---------------------------------------------- '------------Purpose/Description--------------- '---------------------------------------------- ' 'This script offers two options in displaying the 'data output from naUTilus. 'Option 1 finds the maximum and minimum emissions at 'the nodes, breaks the range into 4 intervals, and creates 'colored circles (coded by emissions range) around the nodes. 'Option 2 displays the data which exceed pre-set limits. ' '----------------------------------------------- '-------------------Input----------------------- '----------------------------------------------- ' '1. Attribute table for the theme nodes (joined with naUTilus output) ' '----------------------------------------------- '------------------Output----------------------- '----------------------------------------------- ' '----------------------------------------------- '---------Get Initial Information--------------- '----------------------------------------------- TheProject = av.GetProject TheView = av.GetActiveDoc ThemeList = TheView.GetThemes TheTheme=MsgBox.ChoiceAsString(ThemeList,"Choose the theme representing your nodes.",ThemeList.Get(0).GetName) If (TheTheme = nil) then msgbox.info("No theme was selected","Exit") exit end TheFtab = TheTheme.GetFtab TheField = TheFtab.FindField("Emissions") '-------------------------------------------------------------------- '---------Set option: Relative or Absolute emission display---------- '-------------------------------------------------------------------- Disp = MsgBox.input("Display emissions by 1) relative amounts or 2) absolute amounts","Choose emissions display",1.AsString) Disp = Disp.AsNumber '------------------------------------------------ '-----------Setup Legend options----------------- '------------------------------------------------ theLegend = Thetheme.GetLegend SymbList = theLegend.GetSymbols SColor = Color.GetYellow EColor = Color.GetRed theLegend.ResetClasses(theTheme,theField.AsString) theLegend.SetLegendType(#Legend_type_color) theLegend.Interval(theTheme,theField.AsString,4) 'theLegend.Natural(theTheme,theField.AsString,4) theColorRamp = SymbList.RampColors(SColor,EColor) theLegend.DisplayNoDataClass(false) SymbList.RampSizes(6,6) If ( Disp = 1 ) then '-------------------------------------------------------------------- '----------------------Relative Emissions displayed------------------ '-------------------------------------------------------------------- '----------------------------------------------- '------------Find Maximum emission-------------- '----------------------------------------------- maxnum = 0 minnum = 0 i = 0 For each record in TheFtab check = TheFtab.ReturnValueNumber(TheField,i) if (maxnum < check) then maxnum = check else end '----------------------------------------------- '-------------Find Minimum emission------------- '----------------------------------------------- 'Set initial minimum to emission value from node 1 if ( i = 0) then minnum = check else end if (minnum > check) then minnum = check else end i = i + 1 continue end 'Check Max/Min values. 'msgBox.info("Minimum ="++minnum.AsString+", Maximum ="++maxnum.AsString,"Minimum and maximum values") 'Divide into 4 ranges intervalsize = (maxnum - minnum)/4 val = minnum + intervalsize k = 1 for each int in theLegend.GetClassifications cls = int if (k > 1) then cls.setMinimum(val - intervalsize) lval = val - intervalsize else cls.setMinimum(0) lval = 0 end cls.setMaximum(val) LString = lval.AsString++"-"++val.asString cls.SetLabel(LString) val = val + intervalsize theTheme.UpdateLegend k = k + 1 end 'NOTE: This will change. Different values for different chemicals (see chemdat.dbf) elseif (disp = 2) then'disp = 2 '----------------------------------------------------------------------------- '--------------------Absolute Emissions Displayed----------------------------- '----------------------------------------------------------------------------- 'idea: make table for common VOCs--can then put Hc, limit parameters in table...have user specify chem. ' Also, have an option "other" val = 0 for each int in theLegend.GetClassifications cls = int cls.SetMinimum(val) lval = val val = val + 3 cls.SetMaximum(val) cls.SetLabel(lval.asString++"-"++val.asString) theTheme.UpdateLegend end else msgbox.info("Not a valid choice","Exit") Exit end