Skip to content

Instantly share code, notes, and snippets.

@mbernasocchi
Created February 12, 2014 11:23
Show Gist options
  • Save mbernasocchi/8953782 to your computer and use it in GitHub Desktop.
Save mbernasocchi/8953782 to your computer and use it in GitHub Desktop.
diff --git a/safe/common/utilities.py b/safe/common/utilities.py
index 2bf265e..149165b 100644
--- a/safe/common/utilities.py
+++ b/safe/common/utilities.py
@@ -78,13 +78,18 @@ def ugettext(s):
"""
path = os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', 'i18n'))
+ print '---------------------'
+ print 'STR: %s' % s
if 'LANG' not in os.environ:
return s
lang = os.environ['LANG']
+ print 'LANG: %s' % lang
filename_prefix = 'inasafe'
t = gettext.translation(filename_prefix,
path, languages=[lang], fallback=True)
- return t.ugettext(s)
+ res = t.ugettext(s)
+ print 'RES: %s' % res
+ return res
@mbernasocchi
Copy link
Author

log:

marco@placebo:~/dev/qgis-plugins/inasafe/inasafe-master$ killall qgis.bin; qgis /home/marco/Desktop/issue-0000/issue759.qgs &
[12]-  Terminated              qgis /home/marco/Desktop/issue-0000/issue759.qgs
[14] 14124
marco@placebo:~/dev/qgis-plugins/inasafe/inasafe-master$ Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_id]
marco@placebo:~/dev/qgis-plugins/inasafe/inasafe-master$ Warning: void DBusMenuExporterPrivate::addAction(QAction*, int): Already tracking action "Kotak peralatan" under id 208 
Str: No data
LANG: en_US.UTF-8
RES: No data
Str: Low
LANG: en_US.UTF-8
RES: Low
Str: Medium
LANG: en_US.UTF-8
RES: Medium
Str: High
LANG: en_US.UTF-8
RES: High
Str: Low
LANG: en_US.UTF-8
RES: Low
Str: Mid
LANG: en_US.UTF-8
RES: Mid
Str: High
LANG: en_US.UTF-8
RES: High
Str: Be impacted
LANG: en_US.UTF-8
RES: Be impacted
Str: To assess the impacts of categorized hazards in raster format on population raster layer.
LANG: en_US.UTF-8
RES: To assess the impacts of categorized hazards in raster format on population raster layer.
Str: Provide details about how many people would likely need to be impacted for each category.
LANG: en_US.UTF-8
RES: Provide details about how many people would likely need to be impacted for each category.
Str: A hazard raster layer where each cell represents the category of the hazard. There should be 3 categories: 1, 2, and 3.
LANG: en_US.UTF-8
RES: A hazard raster layer where each cell represents the category of the hazard. There should be 3 categories: 1, 2, and 3.
Str: An exposure raster layer where each cell represent population count.
LANG: en_US.UTF-8
RES: An exposure raster layer where each cell represent population count.
Str: Map of population exposed to high category and a table with number of people in each category
LANG: en_US.UTF-8
RES: Map of population exposed to high category and a table with number of people in each category
Str: This function will calculate how many people will be impacted per each category for all categories in the hazard layer. Currently there should be 3 categories in the hazard layer. After that it will show the result and the total amount of people that will be impacted for the hazard given.
LANG: en_US.UTF-8
RES: This function will calculate how many people will be impacted per each category for all categories in the hazard layer. Currently there should be 3 categories in the hazard layer. After that it will show the result and the total amount of people that will be impacted for the hazard given.
Str: The number of categories is three.
LANG: en_US.UTF-8
RES: The number of categories is three.
QGIS defaults CALL
Str: Be flooded
LANG: en_US.UTF-8
RES: Be flooded
Str: Be flooded
LANG: en_US.UTF-8
RES: Be flooded
Str: Need evacuation
LANG: en_US.UTF-8
RES: Need evacuation
QGIS defaults CALL
Str: To assess the impacts of (flood or tsunami) inundation in raster format on population.
LANG: en_US.UTF-8
RES: To assess the impacts of (flood or tsunami) inundation in raster format on population.
Str: Provide details about how many people would likely need to be evacuated, where they are located and what resources would be required to support them.
LANG: en_US.UTF-8
RES: Provide details about how many people would likely need to be evacuated, where they are located and what resources would be required to support them.
Str: The population subject to inundation exceeding a threshold (default 1m) is calculated and returned as a raster layer. In addition the total number and the required needs in terms of the BNPB (Perka 7) are reported. The threshold can be changed and even contain multiple numbers in which case evacuation and needs are calculated using the largest number with population breakdowns provided for the smaller numbers. The population raster is resampled to the resolution of the hazard raster and is rescaled so that the resampled population counts reflect estimates of population count per resampled cell. The resulting impact layer has the same resolution and reflects population count per cell which are affected by inundation.
LANG: en_US.UTF-8
RES: The population subject to inundation exceeding a threshold (default 1m) is calculated and returned as a raster layer. In addition the total number and the required needs in terms of the BNPB (Perka 7) are reported. The threshold can be changed and even contain multiple numbers in which case evacuation and needs are calculated using the largest number with population breakdowns provided for the smaller numbers. The population raster is resampled to the resolution of the hazard raster and is rescaled so that the resampled population counts reflect estimates of population count per resampled cell. The resulting impact layer has the same resolution and reflects population count per cell which are affected by inundation.
Str: A hazard raster layer where each cell represents flood depth (in meters).
LANG: en_US.UTF-8
RES: A hazard raster layer where each cell represents flood depth (in meters).
Str: An exposure raster layer where each cell represent population count.
LANG: en_US.UTF-8
RES: An exposure raster layer where each cell represent population count.
Str: Raster layer contains population affected and the minimum needs based on the population affected.
LANG: en_US.UTF-8
RES: Raster layer contains population affected and the minimum needs based on the population affected.
Str: The default threshold of 1 meter was selected based on consensus, not hard evidence.
LANG: en_US.UTF-8
RES: The default threshold of 1 meter was selected based on consensus, not hard evidence.
Str: Rice
LANG: en_US.UTF-8
RES: Rice
Str: Drinking Water
LANG: en_US.UTF-8
RES: Drinking Water
Str: Water
LANG: en_US.UTF-8
RES: Water
Str: Family Kits
LANG: en_US.UTF-8
RES: Family Kits
Str: Toilets
LANG: en_US.UTF-8
RES: Toilets
Str: Rice
LANG: en_US.UTF-8
RES: Rice
Str: Drinking Water
LANG: en_US.UTF-8
RES: Drinking Water
Str: Water
LANG: en_US.UTF-8
RES: Water
Str: Family Kits
LANG: en_US.UTF-8
RES: Family Kits
Str: Toilets
LANG: en_US.UTF-8
RES: Toilets
OrderedDict([(u'Rice', 2.8), (u'Drinking Water', 17.5), (u'Water', 105), (u'Family Kits', 0.2), (u'Toilets', 0.05)])
Str: Need evacuation
LANG: en_US.UTF-8
RES: Need evacuation
Str: To assess the impacts of (flood or tsunami) inundation in vector format on population.
LANG: en_US.UTF-8
RES: To assess the impacts of (flood or tsunami) inundation in vector format on population.
Str: Provide details about how many people would likely need to be evacuated, where they are located and what resources would be required to support them.
LANG: en_US.UTF-8
RES: Provide details about how many people would likely need to be evacuated, where they are located and what resources would be required to support them.
Str: The population subject to inundation is determined whether in an area which affected or not. You can also set an evacuation percentage to calculate how many percent of the total population affected to be evacuated. This number will be used to estimate needs based on BNPB Perka 7/2008 minimum bantuan.
LANG: en_US.UTF-8
RES: The population subject to inundation is determined whether in an area which affected or not. You can also set an evacuation percentage to calculate how many percent of the total population affected to be evacuated. This number will be used to estimate needs based on BNPB Perka 7/2008 minimum bantuan.
Str: A hazard vector layer which has attribute affected the value is either 1 or 0
LANG: en_US.UTF-8
RES: A hazard vector layer which has attribute affected the value is either 1 or 0
Str: An exposure raster layer where each cell represent population count.
LANG: en_US.UTF-8
RES: An exposure raster layer where each cell represent population count.
Str: Vector layer contains population affected and the minimum needs based on evacuation percentage.
LANG: en_US.UTF-8
RES: Vector layer contains population affected and the minimum needs based on evacuation percentage.
QGIS defaults CALL
Str: Rice
LANG: en_US.UTF-8
RES: Rice
Str: Drinking Water
LANG: en_US.UTF-8
RES: Drinking Water
Str: Water
LANG: en_US.UTF-8
RES: Water
Str: Family Kits
LANG: en_US.UTF-8
RES: Family Kits
Str: Toilets
LANG: en_US.UTF-8
RES: Toilets
Str: Be flooded
LANG: en_US.UTF-8
RES: Be flooded
Str: To assess the impacts of (flood or tsunami) inundation on building footprints originating from OpenStreetMap (OSM).
LANG: en_US.UTF-8
RES: To assess the impacts of (flood or tsunami) inundation on building footprints originating from OpenStreetMap (OSM).
Str: Provide details about where critical infrastructure might be flooded
LANG: en_US.UTF-8
RES: Provide details about where critical infrastructure might be flooded
Str: The inundation status is calculated for each building (using the centroid if it is a polygon) based on the hazard levels provided. if the hazard is given as a raster a threshold of 1 meter is used. This is configurable through the InaSAFE interface. If the hazard is given as a vector polygon layer buildings are considered to be impacted depending on the value of hazard attributes (in order) "affected" or "FLOODPRONE": If a building is in a region that has attribute "affected" set to True (or 1) it is impacted. If attribute "affected" does not exist but "FLOODPRONE" does, then the building is considered impacted if "FLOODPRONE" is "yes". If neither "affected" nor "FLOODPRONE" is available, a building will be impacted if it belongs to any polygon. The latter behaviour is implemented through the attribute "inapolygon" which is automatically assigned.
LANG: en_US.UTF-8
RES: The inundation status is calculated for each building (using the centroid if it is a polygon) based on the hazard levels provided. if the hazard is given as a raster a threshold of 1 meter is used. This is configurable through the InaSAFE interface. If the hazard is given as a vector polygon layer buildings are considered to be impacted depending on the value of hazard attributes (in order) "affected" or "FLOODPRONE": If a building is in a region that has attribute "affected" set to True (or 1) it is impacted. If attribute "affected" does not exist but "FLOODPRONE" does, then the building is considered impacted if "FLOODPRONE" is "yes". If neither "affected" nor "FLOODPRONE" is available, a building will be impacted if it belongs to any polygon. The latter behaviour is implemented through the attribute "inapolygon" which is automatically assigned.
Str: A hazard raster layer where each cell represents flood depth (in meters), or a vector polygon layer where each polygon represents an inundated area. In the latter case, the following attributes are recognised (in order): "affected" (True or False) or "FLOODPRONE" (Yes or No). (True may be represented as 1, False as 0
LANG: en_US.UTF-8
RES: A hazard raster layer where each cell represents flood depth (in meters), or a vector polygon layer where each polygon represents an inundated area. In the latter case, the following attributes are recognised (in order): "affected" (True or False) or "FLOODPRONE" (Yes or No). (True may be represented as 1, False as 0
Str: Vector polygon layer extracted from OSM where each polygon represents the footprint of a building.
LANG: en_US.UTF-8
RES: Vector polygon layer extracted from OSM where each polygon represents the footprint of a building.
Str: Vector layer contains building is estimated to be flooded and the breakdown of the building by type.
LANG: en_US.UTF-8
RES: Vector layer contains building is estimated to be flooded and the breakdown of the building by type.
Str: This function only flags buildings as impacted or not either based on a fixed threshold in case of raster hazard or the the attributes mentioned under input in case of vector hazard.
LANG: en_US.UTF-8
RES: This function only flags buildings as impacted or not either based on a fixed threshold in case of raster hazard or the the attributes mentioned under input in case of vector hazard.
Str: Need evacuation
LANG: en_US.UTF-8
RES: Need evacuation
QGIS defaults CALL
Str: To assess the impacts of volcano eruption on population.
LANG: en_US.UTF-8
RES: To assess the impacts of volcano eruption on population.
Str: Provide details about how many population would likely be affected by each hazard zones.
LANG: en_US.UTF-8
RES: Provide details about how many population would likely be affected by each hazard zones.
Str: A hazard vector layer can be polygon or point. If polygon, it must have "KRB" attribute and the valuefor it are "Kawasan Rawan Bencana I", "Kawasan Rawan Bencana II", or "Kawasan Rawan Bencana III."If you want to see the name of the volcano in the result, you need to add "NAME" attribute for point data or "GUNUNG" attribute for polygon data.
LANG: en_US.UTF-8
RES: A hazard vector layer can be polygon or point. If polygon, it must have "KRB" attribute and the valuefor it are "Kawasan Rawan Bencana I", "Kawasan Rawan Bencana II", or "Kawasan Rawan Bencana III."If you want to see the name of the volcano in the result, you need to add "NAME" attribute for point data or "GUNUNG" attribute for polygon data.
Str: An exposure raster layer where each cell represent population count.
LANG: en_US.UTF-8
RES: An exposure raster layer where each cell represent population count.
Str: Vector layer contains population affected and the minimum needs based on the population affected.
LANG: en_US.UTF-8
RES: Vector layer contains population affected and the minimum needs based on the population affected.
Str: Rice
LANG: en_US.UTF-8
RES: Rice
Str: Drinking Water
LANG: en_US.UTF-8
RES: Drinking Water
Str: Water
LANG: en_US.UTF-8
RES: Water
Str: Family Kits
LANG: en_US.UTF-8
RES: Family Kits
Str: Toilets
LANG: en_US.UTF-8
RES: Toilets
Str: Be affected
LANG: en_US.UTF-8
RES: Be affected
Str: To assess the impacts of volcano eruption on building.
LANG: en_US.UTF-8
RES: To assess the impacts of volcano eruption on building.
Str: Provide details about how many building would likely be affected by each hazard zones.
LANG: en_US.UTF-8
RES: Provide details about how many building would likely be affected by each hazard zones.
Str: A hazard vector layer can be polygon or point. If polygon, it must have "KRB" attribute and the values for it are "Kawasan Rawan Bencana I", "Kawasan Rawan Bencana II", or "Kawasan Rawan Bencana III." If you want to see the name of the volcano in the result, you need to add "NAME" attribute for point data or "GUNUNG" attribute for polygon data.
LANG: en_US.UTF-8
RES: A hazard vector layer can be polygon or point. If polygon, it must have "KRB" attribute and the values for it are "Kawasan Rawan Bencana I", "Kawasan Rawan Bencana II", or "Kawasan Rawan Bencana III." If you want to see the name of the volcano in the result, you need to add "NAME" attribute for point data or "GUNUNG" attribute for polygon data.
Str: Vector polygon layer extracted from OSM where each polygon represents the footprint of a building.
LANG: en_US.UTF-8
RES: Vector polygon layer extracted from OSM where each polygon represents the footprint of a building.
Str: Vector layer contains Map of building exposed to volcanic hazard zones for each Kawasan Rawan Bencana or radius.
LANG: en_US.UTF-8
RES: Vector layer contains Map of building exposed to volcanic hazard zones for each Kawasan Rawan Bencana or radius.
Str: Be affected
LANG: en_US.UTF-8
RES: Be affected
Str: Die or be displaced
LANG: en_US.UTF-8
RES: Die or be displaced
Str: To assess the impact of earthquake on population based on earthquake model developed by ITB
LANG: en_US.UTF-8
RES: To assess the impact of earthquake on population based on earthquake model developed by ITB
Str:  * Indonesian Earthquake Building-Damage and Fatality Models and    Post Disaster Survey Guidelines Development Bali, 27-28    February 2012, 54pp.
 * Allen, T. I., Wald, D. J., Earle, P. S., Marano, K. D.,    Hotovec, A. J., Lin, K., and Hearne, M., 2009. An Atlas    of ShakeMaps and population exposure catalog for    earthquake loss modeling, Bull. Earthq. Eng. 7, 701-718.
 * Jaiswal, K., and Wald, D., 2010. An empirical model for    global earthquake fatality estimation, Earthq. Spectra    26, 1017-1037.

LANG: en_US.UTF-8
RES:  * Indonesian Earthquake Building-Damage and Fatality Models and    Post Disaster Survey Guidelines Development Bali, 27-28    February 2012, 54pp.
 * Allen, T. I., Wald, D. J., Earle, P. S., Marano, K. D.,    Hotovec, A. J., Lin, K., and Hearne, M., 2009. An Atlas    of ShakeMaps and population exposure catalog for    earthquake loss modeling, Bull. Earthq. Eng. 7, 701-718.
 * Jaiswal, K., and Wald, D., 2010. An empirical model for    global earthquake fatality estimation, Earthq. Spectra    26, 1017-1037.

Str:  - The model is based on limited number of observed fatality    rates during 4 past fatal events. 
 - The model clearly over-predicts the fatality rates at    intensities higher than VIII.
 - The model only estimates the expected fatality rate    for a given intensity level; however the associated    uncertainty for the proposed model is not addressed.
 - There are few known mistakes in developing the current    model:

   * rounding MMI values to the nearest 0.5,
   * Implementing Finite-Fault models of candidate events, and
   * consistency between selected GMPEs with those in use by      BMKG.

LANG: en_US.UTF-8
RES:  - The model is based on limited number of observed fatality    rates during 4 past fatal events. 
 - The model clearly over-predicts the fatality rates at    intensities higher than VIII.
 - The model only estimates the expected fatality rate    for a given intensity level; however the associated    uncertainty for the proposed model is not addressed.
 - There are few known mistakes in developing the current    model:

   * rounding MMI values to the nearest 0.5,
   * Implementing Finite-Fault models of candidate events, and
   * consistency between selected GMPEs with those in use by      BMKG.

Str: Provide details about the population will be die or displaced
LANG: en_US.UTF-8
RES: Provide details about the population will be die or displaced
Str: This model was developed by Institut Teknologi Bandung (ITB) and implemented by Dr. Hadi Ghasemi, Geoscience Australia
Algorithm:
In this study, the same functional form as Allen (2009) is adopted o express fatality rate as a function of intensity (see Eq. 10 in the report). The Matlab built-in function (fminsearch) for  Nelder-Mead algorithm was used to estimate the model parameters. The objective function (L2G norm) that is minimized during the optimisation is the same as the one used by Jaiswal et al. (2010).
The coefficients used in the indonesian model are x=0.62275231, y=8.03314466, zeta=2.15
LANG: en_US.UTF-8
RES: This model was developed by Institut Teknologi Bandung (ITB) and implemented by Dr. Hadi Ghasemi, Geoscience Australia
Algorithm:
In this study, the same functional form as Allen (2009) is adopted o express fatality rate as a function of intensity (see Eq. 10 in the report). The Matlab built-in function (fminsearch) for  Nelder-Mead algorithm was used to estimate the model parameters. The objective function (L2G norm) that is minimized during the optimisation is the same as the one used by Jaiswal et al. (2010).
The coefficients used in the indonesian model are x=0.62275231, y=8.03314466, zeta=2.15
QGIS defaults CALL
Str: Rice
LANG: en_US.UTF-8
RES: Rice
Str: Drinking Water
LANG: en_US.UTF-8
RES: Drinking Water
Str: Water
LANG: en_US.UTF-8
RES: Water
Str: Family Kits
LANG: en_US.UTF-8
RES: Family Kits
Str: Toilets
LANG: en_US.UTF-8
RES: Toilets
Str: Be damaged depending on building type
LANG: en_US.UTF-8
RES: Be damaged depending on building type
Str: To assess the impact of earthquake on population based on Population Vulnerability Model Pager
LANG: en_US.UTF-8
RES: To assess the impact of earthquake on population based on Population Vulnerability Model Pager
Str:  * Jaiswal, K. S., Wald, D. J., and Hearne, M. (2009a).    Estimating casualties for large worldwide earthquakes using    an empirical approach. U.S. Geological Survey Open-File    Report 2009-1136.
LANG: en_US.UTF-8
RES:  * Jaiswal, K. S., Wald, D. J., and Hearne, M. (2009a).    Estimating casualties for large worldwide earthquakes using    an empirical approach. U.S. Geological Survey Open-File    Report 2009-1136.
Str: Die or be displaced according Pager model
LANG: en_US.UTF-8
RES: Die or be displaced according Pager model
QGIS defaults CALL
Str: Rice
LANG: en_US.UTF-8
RES: Rice
Str: Drinking Water
LANG: en_US.UTF-8
RES: Drinking Water
Str: Water
LANG: en_US.UTF-8
RES: Water
Str: Family Kits
LANG: en_US.UTF-8
RES: Family Kits
Str: Toilets
LANG: en_US.UTF-8
RES: Toilets
Str: Water
LANG: en_US.UTF-8
RES: Water
QGIS defaults CALL
/home/marco
Str: buildings
LANG: id
RES: buildings
Str: buildings
LANG: id
RES: buildings
Str: buildings
LANG: id
RES: buildings
Str: buildings
LANG: id
RES: buildings
Str: buildings
LANG: id
RES: buildings
Str: gempa_shake
LANG: id
RES: gempa_shake
Str: buildings
LANG: id
RES: buildings
Str: gempa_shake
LANG: id
RES: gempa_shake
Str: Be affected
LANG: id
RES: Terkena dampak
Str: gempa_shake
LANG: id
RES: gempa_shake
Str: buildings
LANG: id
RES: buildings
Str: buildings
LANG: id
RES: buildings
Str: gempa_shake
LANG: id
RES: gempa_shake
Str: Be affected
LANG: id
RES: Terkena dampak
Str: buildings
LANG: id
RES: buildings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment