Display views - read-only views which manipulate and present scenario data, and can be though of as reporting scripts - are generally most useful when they support multiple scenarios for comparison alongside each another.
Below is an example of a simple multi-scenario display view which calculates average energy intensities across states. Note the use of:
localview
objects, which are arrays of tool objects. These are analogous to local
object declarations in single-scenario views - but these are declared before the $numScns
for loop.$numScns
is an environmental variable, which as its name implies, lists the number of scenarios selected (including the history)view energyUsed[st,ind,ts][] view GDP[st,ind,ts][] boolean $answer if $history == false say ("This view requires a history.") listen (" enter to continue >> ",$answer) quit (-1) endif localview energyUsed_T[ind,ts][] localview GDP_T[ind,ts][] localview energyInt[ind,ts][] say ("working on") integer $i for $i from 1 upto $numScns say (" ", $scnDescs[$i]) energyUsed_T[ind,ts][$i] = sum (energyUsed[st,ind,ts][$i]; dim=state) GDP_T[ind,ts][$i] = sum (energyUsed[st,ind,ts][$i]; dim=state) energyInt[ind,ts][$i] = energyUsed_T[ind,ts][$i] / GDP_T[ind,ts][$i] endfor graph (energyInt[ind,ts][all]; \ window1=$numScns, \ objColours=$scnColours[all], \ title1="Average energy intensity in BTU/$")