Permalink
Browse files

Added estimated fatalities as a single total at top of report

  • Loading branch information...
1 parent 05acc32 commit 4fc4d99fa62fea2b12d70f1fa0de53e540e349a9 @timlinux timlinux committed Dec 12, 2012
@@ -250,6 +250,9 @@ your own template. More on that below in the next section.
* **bearing-text**: bearing
* **elapsed-time-name**: Elapsed time
* **elapsed-time**: 26-Jul-12 02:15:35
+* **fatality-name**: Estimated Fatalities
+* **fatality-count**: 55
+
Customising the template
------------------------
@@ -1,5 +1,5 @@
<Composer title="Realtime" visible="1">
- <Composition printResolution="300" paperWidth="210" snapGridOffsetX="0" snapGridResolution="0" snapGridOffsetY="0" snapping="0" numPages="1" paperHeight="297" printAsRaster="1">
+ <Composition printResolution="300" paperWidth="210" snapGridOffsetX="0" snapGridResolution="2" snapGridOffsetY="0" snapping="1" numPages="1" paperHeight="297" printAsRaster="1">
<ComposerShape shapeType="1" shapeWidth="81.9966" outlineWidth="0.1" transparentFill="1" shapeHeight="27.2144">
<OutlineColor alpha="255" red="0" blue="0" green="0"/>
<FillColor alpha="255" red="0" blue="0" green="0"/>
@@ -8,18 +8,18 @@
<BackgroundColor alpha="0" red="255" blue="255" green="255"/>
</ComposerItem>
</ComposerShape>
- <ComposerLabel valign="32" labelText="[elapsed-time-name] [elapsed-time]" halign="2" margin="1">
- <LabelFont description="Ubuntu,10,-1,5,50,0,0,0,0,0"/>
+ <ComposerLabel valign="32" labelText="[legend-name]" halign="4" margin="1">
+ <LabelFont description="Ubuntu,14,-1,5,75,0,0,0,0,0"/>
<FontColor red="0" blue="0" green="0"/>
- <ComposerItem width="90.9957" x="108.096" y="42.1389" rotation="0" height="6.7178" frame="false" outlineWidth="0.3" zValue="18" lastValidViewScaleFactor="3.27488" id="elapsed-time" positionLock="false">
+ <ComposerItem width="81.919" x="118.832" y="216.888" rotation="0" height="7.42211" frame="true" outlineWidth="0.1" zValue="18" lastValidViewScaleFactor="2.82938" id="" positionLock="false">
<FrameColor alpha="255" red="0" blue="0" green="0"/>
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
</ComposerLabel>
- <ComposerLabel valign="32" labelText="[legend-name]" halign="4" margin="1">
- <LabelFont description="Ubuntu,14,-1,5,75,0,0,0,0,0"/>
+ <ComposerLabel valign="32" labelText="[elapsed-time-name] [elapsed-time]" halign="2" margin="1">
+ <LabelFont description="Ubuntu,10,-1,5,50,0,0,0,0,0"/>
<FontColor red="0" blue="0" green="0"/>
- <ComposerItem width="81.919" x="118.832" y="216.888" rotation="0" height="7.42211" frame="true" outlineWidth="0.1" zValue="18" lastValidViewScaleFactor="2.82938" id="" positionLock="false">
+ <ComposerItem width="62" x="136" y="41.7115" rotation="0" height="7.0502" frame="false" outlineWidth="0.3" zValue="18" lastValidViewScaleFactor="6.28188" id="elapsed-time" positionLock="false">
<FrameColor alpha="255" red="0" blue="0" green="0"/>
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
@@ -48,10 +48,10 @@
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
</ComposerLabel>
- <ComposerLabel valign="32" labelText="M [mmi] [formatted-date-time]" halign="1" margin="1">
+ <ComposerLabel valign="32" labelText="M [mmi] [formatted-date-time] [fatalities-name]: [fatalities-count]" halign="1" margin="1">
<LabelFont description="Ubuntu,10,-1,5,75,0,0,0,0,0"/>
<FontColor red="0" blue="0" green="0"/>
- <ComposerItem width="86.2337" x="4.73016" y="41.7115" rotation="0" height="6.63302" frame="false" outlineWidth="0.3" zValue="10" lastValidViewScaleFactor="2.82938" id="intensity-date" positionLock="false">
+ <ComposerItem width="129.27" x="4.73016" y="41.7115" rotation="0" height="6.63302" frame="false" outlineWidth="0.3" zValue="10" lastValidViewScaleFactor="6.28188" id="intensity-date" positionLock="false">
<FrameColor alpha="255" red="0" blue="0" green="0"/>
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
@@ -148,7 +148,7 @@
</symbol>
<Annotation rightDirection="1" bottomDirection="0" format="1" topPosition="2" precision="0" leftDirection="0" rightPosition="1" bottomPosition="1" frameDistance="1" show="1" font="Ubuntu,8,-1,5,75,1,0,0,0,0" leftPosition="2" topDirection="0"/>
</Grid>
- <ComposerItem width="100" x="4.73016" y="108" rotation="0" height="100" frame="false" outlineWidth="0.3" zValue="5" lastValidViewScaleFactor="2.82938" id="main-map" positionLock="false">
+ <ComposerItem width="100" x="4.73016" y="108" rotation="0" height="100" frame="false" outlineWidth="0.3" zValue="5" lastValidViewScaleFactor="6.28188" id="main-map" positionLock="false">
<FrameColor alpha="255" red="0" blue="0" green="0"/>
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
@@ -187,14 +187,6 @@
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
</ComposerLegend>
- <ComposerHtml resizeMode="0" url="file:///tmp/inasafe/realtime/shakemaps-extracted/20120918134658/impacts.html">
- <ComposerFrame sectionWidth="198.791" sectionHeight="34.2984" sectionX="0" sectionY="0">
- <ComposerItem width="198.791" x="4.73016" y="69.3883" rotation="0" height="34.2984" frame="false" outlineWidth="0.3" zValue="14" lastValidViewScaleFactor="2.82938" id="impacts-table" positionLock="false">
- <FrameColor alpha="255" red="0" blue="0" green="0"/>
- <BackgroundColor alpha="255" red="255" blue="255" green="255"/>
- </ComposerItem>
- </ComposerFrame>
- </ComposerHtml>
<ComposerHtml resizeMode="0" url="file:///tmp/inasafe/realtime/shakemaps-extracted/20120918134658/affected-cities.html">
<ComposerFrame sectionWidth="79.4918" sectionHeight="81.3817" sectionX="0" sectionY="0">
<ComposerItem width="77.94" x="118.403" y="117.699" rotation="0" height="92.3849" frame="false" outlineWidth="0.3" zValue="13" lastValidViewScaleFactor="2.82938" id="affected-cities" positionLock="false">
@@ -205,7 +197,15 @@
</ComposerHtml>
<ComposerHtml resizeMode="0" url="">
<ComposerFrame sectionWidth="0" sectionHeight="0" sectionX="0" sectionY="0">
- <ComposerItem width="0" x="151.747" y="179.212" rotation="0" height="0" frame="false" outlineWidth="0.3" zValue="12" lastValidViewScaleFactor="2.82938" id="" positionLock="false">
+ <ComposerItem width="0" x="151.747" y="179.212" rotation="0" height="0" frame="false" outlineWidth="0.3" zValue="12" lastValidViewScaleFactor="6.28188" id="" positionLock="false">
+ <FrameColor alpha="255" red="0" blue="0" green="0"/>
+ <BackgroundColor alpha="255" red="255" blue="255" green="255"/>
+ </ComposerItem>
+ </ComposerFrame>
+ </ComposerHtml>
+ <ComposerHtml resizeMode="0" url="file:///tmp/inasafe/realtime/shakemaps-extracted/20120918134658/impacts.html">
+ <ComposerFrame sectionWidth="198.791" sectionHeight="34.2984" sectionX="0" sectionY="0">
+ <ComposerItem width="198.791" x="4.73016" y="69.3883" rotation="0" height="34.2984" frame="false" outlineWidth="0.3" zValue="14" lastValidViewScaleFactor="2.82938" id="impacts-table" positionLock="false">
<FrameColor alpha="255" red="0" blue="0" green="0"/>
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
@@ -45,8 +45,8 @@
</filegroup>
</legendlayer>
</legend>
- <Composer title="Realtime" visible="0">
- <Composition printResolution="300" paperWidth="210" snapGridOffsetX="0" snapGridResolution="0" snapGridOffsetY="0" snapping="0" numPages="1" paperHeight="297" printAsRaster="1">
+ <Composer title="Realtime" visible="1">
+ <Composition printResolution="300" paperWidth="210" snapGridOffsetX="0" snapGridResolution="2" snapGridOffsetY="0" snapping="1" numPages="1" paperHeight="297" printAsRaster="1">
<ComposerShape shapeType="1" shapeWidth="81.9966" outlineWidth="0.1" transparentFill="1" shapeHeight="27.2144">
<OutlineColor alpha="255" red="0" blue="0" green="0"/>
<FillColor alpha="255" red="0" blue="0" green="0"/>
@@ -55,18 +55,18 @@
<BackgroundColor alpha="0" red="255" blue="255" green="255"/>
</ComposerItem>
</ComposerShape>
- <ComposerLabel valign="32" labelText="[elapsed-time-name] [elapsed-time]" halign="2" margin="1">
- <LabelFont description="Ubuntu,10,-1,5,50,0,0,0,0,0"/>
+ <ComposerLabel valign="32" labelText="[legend-name]" halign="4" margin="1">
+ <LabelFont description="Ubuntu,14,-1,5,75,0,0,0,0,0"/>
<FontColor red="0" blue="0" green="0"/>
- <ComposerItem width="90.9957" x="108.096" y="42.1389" rotation="0" height="6.7178" frame="false" outlineWidth="0.3" zValue="18" lastValidViewScaleFactor="3.27488" id="elapsed-time" positionLock="false">
+ <ComposerItem width="81.919" x="118.832" y="216.888" rotation="0" height="7.42211" frame="true" outlineWidth="0.1" zValue="18" lastValidViewScaleFactor="2.82938" id="" positionLock="false">
<FrameColor alpha="255" red="0" blue="0" green="0"/>
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
</ComposerLabel>
- <ComposerLabel valign="32" labelText="[legend-name]" halign="4" margin="1">
- <LabelFont description="Ubuntu,14,-1,5,75,0,0,0,0,0"/>
+ <ComposerLabel valign="32" labelText="[elapsed-time-name] [elapsed-time]" halign="2" margin="1">
+ <LabelFont description="Ubuntu,10,-1,5,50,0,0,0,0,0"/>
<FontColor red="0" blue="0" green="0"/>
- <ComposerItem width="81.919" x="118.832" y="216.888" rotation="0" height="7.42211" frame="true" outlineWidth="0.1" zValue="18" lastValidViewScaleFactor="2.82938" id="" positionLock="false">
+ <ComposerItem width="62.6676" x="136.424" y="42.1389" rotation="0" height="7.0502" frame="false" outlineWidth="0.3" zValue="18" lastValidViewScaleFactor="6.28188" id="elapsed-time" positionLock="false">
<FrameColor alpha="255" red="0" blue="0" green="0"/>
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
@@ -95,10 +95,10 @@
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
</ComposerLabel>
- <ComposerLabel valign="32" labelText="M [mmi] [formatted-date-time]" halign="1" margin="1">
+ <ComposerLabel valign="32" labelText="M [mmi] [formatted-date-time] [fatalities-name]: [fatalities-count]" halign="1" margin="1">
<LabelFont description="Ubuntu,10,-1,5,75,0,0,0,0,0"/>
<FontColor red="0" blue="0" green="0"/>
- <ComposerItem width="86.2337" x="4.73016" y="41.7115" rotation="0" height="6.63302" frame="false" outlineWidth="0.3" zValue="10" lastValidViewScaleFactor="2.82938" id="intensity-date" positionLock="false">
+ <ComposerItem width="86.2337" x="4.73016" y="41.7115" rotation="0" height="6.63302" frame="false" outlineWidth="0.3" zValue="10" lastValidViewScaleFactor="6.28188" id="intensity-date" positionLock="false">
<FrameColor alpha="255" red="0" blue="0" green="0"/>
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
@@ -195,7 +195,7 @@
</symbol>
<Annotation rightDirection="1" bottomDirection="0" format="1" topPosition="2" precision="0" leftDirection="0" rightPosition="1" bottomPosition="1" frameDistance="1" show="1" font="Ubuntu,8,-1,5,75,1,0,0,0,0" leftPosition="2" topDirection="0"/>
</Grid>
- <ComposerItem width="100" x="4.73016" y="108" rotation="0" height="100" frame="false" outlineWidth="0.3" zValue="5" lastValidViewScaleFactor="2.82938" id="main-map" positionLock="false">
+ <ComposerItem width="100" x="4.73016" y="108" rotation="0" height="100" frame="false" outlineWidth="0.3" zValue="5" lastValidViewScaleFactor="6.28188" id="main-map" positionLock="false">
<FrameColor alpha="255" red="0" blue="0" green="0"/>
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
@@ -234,14 +234,6 @@
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
</ComposerLegend>
- <ComposerHtml resizeMode="0" url="file:///tmp/inasafe/realtime/shakemaps-extracted/20120918134658/impacts.html">
- <ComposerFrame sectionWidth="198.791" sectionHeight="34.2984" sectionX="0" sectionY="0">
- <ComposerItem width="198.791" x="4.73016" y="69.3883" rotation="0" height="34.2984" frame="false" outlineWidth="0.3" zValue="14" lastValidViewScaleFactor="2.82938" id="impacts-table" positionLock="false">
- <FrameColor alpha="255" red="0" blue="0" green="0"/>
- <BackgroundColor alpha="255" red="255" blue="255" green="255"/>
- </ComposerItem>
- </ComposerFrame>
- </ComposerHtml>
<ComposerHtml resizeMode="0" url="file:///tmp/inasafe/realtime/shakemaps-extracted/20120918134658/affected-cities.html">
<ComposerFrame sectionWidth="79.4918" sectionHeight="81.3817" sectionX="0" sectionY="0">
<ComposerItem width="77.94" x="118.403" y="117.699" rotation="0" height="92.3849" frame="false" outlineWidth="0.3" zValue="13" lastValidViewScaleFactor="2.82938" id="affected-cities" positionLock="false">
@@ -252,7 +244,15 @@
</ComposerHtml>
<ComposerHtml resizeMode="0" url="">
<ComposerFrame sectionWidth="0" sectionHeight="0" sectionX="0" sectionY="0">
- <ComposerItem width="0" x="151.747" y="179.212" rotation="0" height="0" frame="false" outlineWidth="0.3" zValue="12" lastValidViewScaleFactor="2.82938" id="" positionLock="false">
+ <ComposerItem width="0" x="151.747" y="179.212" rotation="0" height="0" frame="false" outlineWidth="0.3" zValue="12" lastValidViewScaleFactor="6.28188" id="" positionLock="false">
+ <FrameColor alpha="255" red="0" blue="0" green="0"/>
+ <BackgroundColor alpha="255" red="255" blue="255" green="255"/>
+ </ComposerItem>
+ </ComposerFrame>
+ </ComposerHtml>
+ <ComposerHtml resizeMode="0" url="file:///tmp/inasafe/realtime/shakemaps-extracted/20120918134658/impacts.html">
+ <ComposerFrame sectionWidth="198.791" sectionHeight="34.2984" sectionX="0" sectionY="0">
+ <ComposerItem width="198.791" x="4.73016" y="69.3883" rotation="0" height="34.2984" frame="false" outlineWidth="0.3" zValue="14" lastValidViewScaleFactor="2.82938" id="impacts-table" positionLock="false">
<FrameColor alpha="255" red="0" blue="0" green="0"/>
<BackgroundColor alpha="255" red="255" blue="255" green="255"/>
</ComposerItem>
View
@@ -149,6 +149,8 @@ def __init__(self, theEventId=None,
self.impactKeywordsFile = None
# number of people killed per mmi band
self.fatalityCounts = None
+ # Total number of predicted fatalities
+ self.fatalityTotal = None
# number of people displaced per mmi band
self.displacedCounts = None
# number of people affected per mmi band
@@ -1612,8 +1614,6 @@ def impactTable(self):
header=True)]
myAffectedRow = [TableCell(self.tr('People Affected (x 1000)'),
header=True)]
- myFatalitiesRow = [TableCell(self.tr('Predicted fatalities'),
- header=True)]
myImpactRow = [TableCell(self.tr('Perceived Shaking'),
header=True)]
for myMmi in range(2, 10):
@@ -1626,17 +1626,10 @@ def impactTable(self):
else:
myAffectedRow.append(0.00)
- if myMmi in self.fatalityCounts:
- myFatalitiesRow.append(
- '%0.2f' % round(self.fatalityCounts[myMmi]))
- else:
- myFatalitiesRow.append(0.00)
-
myImpactRow.append(TableCell(self.mmiShaking(myMmi)))
myTableBody = []
myTableBody.append(myAffectedRow)
- myTableBody.append(myFatalitiesRow)
myTableBody.append(myImpactRow)
myTable = Table(myTableBody, header_row=myHeader,
table_class='table table-striped table-condensed')
@@ -1723,6 +1716,10 @@ def calculateImpacts(self,
self.impactFile = myTifPath
self.impactKeywordsFile = myKeywordsPath
self.fatalityCounts = myFatalities
+ myFatalityTotal = 0
+ for myFatality in myFatalities:
+ myFatalityTotal += myFatality
+ self.fatalityTotal = myFatalityTotal
self.displacedCounts = myDisplaced
self.affectedCounts = myAffected
LOGGER.info('***** Fatalities: %s ********' % self.fatalityCounts)
@@ -2118,6 +2115,8 @@ def eventDict(self):
myMapName = self.tr('Estimated Earthquake Impact')
myExposureTableName = self.tr('Estimated number of people exposed to '
'each MMI level')
+ myFatalitiesName = self.tr('Estimated fatalities')
+ myFatalitiesCount = self.fatalityTotal
myCityTableName = self.tr('Places Affected')
myLegendName = 'Population density'
myLimitations = self.tr(
@@ -2170,6 +2169,8 @@ def eventDict(self):
'legend-name': myLegendName,
'limitations': myLimitations,
'credits': myCredits,
+ 'fatalities-name': myFatalitiesName,
+ 'fatalities-count': '%s' % myFatalitiesCount,
'mmi': '%s' % self.magnitude,
'date': '%s-%s-%s' % (self.day,
self.month,

0 comments on commit 4fc4d99

Please sign in to comment.