Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: InaSAFE Keyword Creation Wizard #3

Open
mf4dl1 opened this issue Jun 29, 2015 · 4 comments
Open

RFC: InaSAFE Keyword Creation Wizard #3

mf4dl1 opened this issue Jun 29, 2015 · 4 comments

Comments

@mf4dl1
Copy link
Owner

mf4dl1 commented Jun 29, 2015

Status

This RFC is in draft

Problem

Before DaLA calculation conducted, we need to setup several input file using InaSAFE Keyword Creation Wizard feature that already exist in the latest version of InaSAFE. This RFC define how InaSAFE Keyword Creation Wizard should be enhanced.

User Interface

Hazard

After user succeed download the Hazard layer using Flood Hazard Compiler, Pick Hazard Layer in canvas,

4 dala calculation - 00a - wizard 1

and then choose InaSAFE Keyword Creation Wizard button at Plugin > InaSAFE > InaSAFE Keyword Creation Wizard

4 dala calculation - 00 - wizard 1

choose hazard,

4 dala calculation - 01 - wizard 1

choose flood,

4 dala calculation - 02 - wizard 2

choose DaLA classes,

4 dala calculation - 03 - wizard 3

pick attribute that consist of DaLA class information (see Flow Process). Example below using "KELAS" attribute.

4 dala calculation - 04 - wizard 4

Set Metadata,

4 dala calculation - 04a - wizard 4a

then put a title,

4 dala calculation - 05 - wizard 5

InaSAFE will create the following keyword file, in the same folder with the physical hazard file.

4 dala calculation - 06 - wizard 6

content of the file is:

category: hazard
field: KELAS
subcategory: flood
unit: DaLa classes
title: JAK_150629_150630

Exposure

Pick layer in canvas which consider as an Exposure,

4 dala calculation - 08a - exposure 0

Click InaSAFE Keyword Creation Wizard button at Plugin > InaSAFE > InaSAFE Keyword Creation Wizard and then choose exposure

4 dala calculation - 08 - exposure 1

pick unit asset,

4 dala calculation - 09 - exposure 2

Select the attribute that represents Sector, Sub-Sector, Asset and Coefficient,

4 dala calculation - 10 - exposure 3

select damage matrix, loss matrix and asset impact tables in the csv format, these files will be used as lookup matrix related to exposure information.

4 dala calculation - 11 - exposure 4

Set Metadata,

4 dala calculation - 12 - exposure 5

then put a title,

4 dala calculation - 13 - exposure 6

InaSAFE will create the following keyword file, in the same folder with the physical exposure file.

4 dala calculation - 14 - exposure 7

content of the file is:

category: exposure
subcategory: unit asset
field_sector: SECTOR
field_sub-sector: SUB-SECTOR
field_asset: ASSET
field_coefficient: COEFFICIENT
damage_matrix: C:/User/Fadli/InaSAFE/damage.csv
loss_matrix: C:/User/Fadli/InaSAFE/loss.csv
asset_impact_table: C:/User/Fadli/InaSAFE/asset_impact.csv
title: bulding_jakarta_osm2013_utm48s

Aggregate

Pick layer in canvas which is consider as an Aggregate,
4 dala calculation - 16 - aggregation 0

Click InaSAFE Keyword Creation Wizard button at Plugin > InaSAFE > InaSAFE Keyword Creation Wizard and then choose aggregation

4 dala calculation - 16 - aggregation 1

Choose DaLA aggregation. DaLA aggregation means an aggregation layer will be used as a reference for aggregated information. For example: population aggregated by City, insurance penetration ratio, aggregated asset information, etc.

4 dala calculation - 16 - aggregation 2

Select the attribute in this layer that represents hierarchy level of the aggregation area.

4 dala calculation - 16 - aggregation 3

define the following matrix aggregated assumptions:

4 dala calculation - 16 - aggregation 4

Set Metadata and then put a title,
InaSAFE will create the following keyword file, in the same folder with the aggregation file.

4 dala calculation - 16 - aggregation 5

Content example:

category: postprocessing
aggregation type: DaLA aggregation
aggregation_level_1: PROVINSI
aggregation_level_2: KOTA
aggregation_level_3: KECAMATAN
aggregation_level_4: KELURAHAN
aggregation_level_5: RW
aggregation_level_6: RT
insurance_assumptions: C:/User/Fadli/InaSAFE/asumsi_asuransi.csv
insurance_penetration_matrix: C:/User/Fadli/InaSAFE/asumsi_penetrasi_asuransi.csv
title: boundary

Data

Hazard layer

Hazard layer (in the form of shapefile) is generated by Flood Hazard Compiler process consists of polygon of flood hazard in the level of RW or RT.

The type of attribute are:

4 dala calculation - 07 - data hazard

Name Mandatory value example
full_id Yes w313772540
osm_id No 313772540
ID Yes 3171060004001004
KELURAHAN Yes PETOGOGAN
KECAMATAN Yes KEBAYORAN BARU
KABUPATEN Yes JAKARTA SELATAN
RW Yes RW 01
RT Yes 004
AREA_HZ No 13929,377
M_DEPTH No 100,00
DURATION No 0,25
KELAS Yes A2
KRB No 1
DEPTH_M No 1,00

CLASS attribute (can be change to any label such as: KELAS, CATEGORY, etc.) define following flood category:

Impact Class Height(cm) Duration (days) Imact Class Height(cm) Duration (days)
a1 10-70 <1 c1 10-70 5-8
a2 71-150 <1 c2 71-150 5-8
a3 >150 <1 c3 >150 5-8
a4 Impacted <1 c4 Impacted 5-8
b1 10-70 1-4 d1 10-70 >8
b2 71-150 1-4 d2 71-150 >8
b3 >150 1-4 d3 >150 >8
b4 Impacted 1-4 d4 Impacted >8

Exposure layer

Type: ESRI Shapefile
Example of the polygon form:
4 dala calculation - 15 - exposure 8

Exposure layer is an exposure polygon data that consist of the following mandatory attributes:

Name Data Type Example
Asset String Pasar Tradisional
Coefficient Numeric 1.0

Damage Matrix

Type: CSV Comma Delimited

Data Definition Language:

field type example value
SUBSEKTOR string PERTANIAN
ASET string TAMBAK
A1 numeric 2000000
A2 numeric 3000000
A3 numeric 4000000
A4 numeric 100000
B1 numeric 3000000
B2 numeric 4000000
B3 numeric 5000000
B4 numeric 200000
C1 numeric 5000000
C2 numeric 6000000
C3 numeric 7000000
C4 numeric 2000000
D1 numeric 2000000
D2 numeric 2000000
D3 numeric 2000000
D4 numeric 2000000

Example data:

SUBSEKTOR,ASET,A1,A2,A3,A4,B1,B2,B3,B4,C1,C2,C3,C4,D1,D2,D3,D4
PERTANIAN,TAMBAK,2000000,2000000,2000000,2000000,2000000,2000000,2000000,2000000,2000000,2000000,2000000,2000000,2000000,2000000,2000000,2000000
PERDAGANGAN,PASAR TRADISIONAL,1760000000,1760000000,1760000000,1760000000,7040000000,7040000000,7040000000,7040000000,14080000000,14080000000,14080000000,14080000000,26400000000,26400000000,26400000000,26400000000
PERDAGANGAN,MAL,20500000000,20500000000,20500000000,20500000000,82000000000,82000000000,82000000000,82000000000,164000000000,164000000000,164000000000,164000000000,307500000000,307500000000,307500000000,307500000000
PERDAGANGAN,RESTORAN,17000000,17000000,17000000,17000000,68000000,68000000,68000000,68000000,136000000,136000000,136000000,136000000,255000000,255000000,255000000,255000000

...

Loss Matrix

similar with Damage Matrix.

Asset Impact Matrix

Type: Textfile

Example data:

Pasar Tradisional: Usaha Mikro, Usaha Kecil
Pusat Grosir: Usaha Mikro, Usaha Kecil
Pusat Perbelanjaan: Usaha Besar
Pusat Kuliner:  Usaha Mikro, Usaha Kecil

...

Example above means Pasar Tradisional also affected damage and loss of Usaha Mikro and Usaha Kecil assets. The relation (logic calculation) between those assets will be define in separate RFC.

Insurance Assumption Matrix

Type: Text File
This file consist of following insurance variable:

  • Population
  • Accident probability
  • Total Insurance Exposure

Example file:

population: 100000000
accident_probability: 0.001
total_insurance_exposure: 100000000

Insurance Penetration Matrix

This file consist of insurance penetration index each aggregate level.

Example file:

SUBSEKTOR,ASET,INSURANCE TYPE,PROVINSI,KOTA,KECAMATAN,KELURAHAN,PENETRASI ASURANSI
PERTANIAN,TAMBAK,PROPERTY,DKI JAKARTA,,,,0.62
PERDAGANGAN,PASAR TRADISIONAL,PROPERTY,DKI JAKARTA,,,,0.64
PERDAGANGAN,MAL,PROPERTY,DKI JAKARTA,,,,0.9
PERDAGANGAN,RESTORAN,PROPERTY,DKI JAKARTA,,,,0.08
PERDAGANGAN,RUKO,PROPERTY,DKI JAKARTA,,,,0.11
PERDAGANGAN,UKM + MIKRO,PROPERTY,DKI JAKARTA,,,,0.63
...
@mf4dl1 mf4dl1 changed the title Damage and Loss Assessment RFC: DaLA Calculation Jun 30, 2015
@mf4dl1 mf4dl1 changed the title RFC: DaLA Calculation RFC: InaSAFE Keyword Creation Wizard Jul 10, 2015
@mf4dl1 mf4dl1 assigned ghost Jul 10, 2015
@mf4dl1
Copy link
Owner Author

mf4dl1 commented Jul 10, 2015

Hi @ekaakurniawan ,

I just finished the RFC of InaSAFE Keyword Creation Wizard. This steps is pre-definition before DaLA calculation conducted.
If you finished with the configuration, you can try to develop this section. We can discuss more detail in the next Standup Meeting Tuesday, 14th July.

Hi @jj0hns0n ,

Kindly to put some comments and suggestion on this RFC.

@mf4dl1
Copy link
Owner Author

mf4dl1 commented Jul 10, 2015

Hi @ismailsunni ,
Could you help us to address which part of the code to be enhance for InaSAFE Keyword Creation Wizard and do you think the enhancement above is possible?
Thank you.

@ismailsunni
Copy link
Collaborator

hi @mf4dl1

It seems the part that you want to enhance is https://github.com/AIFDR/inasafe/blob/develop/safe/gui/tools/wizard_dialog.py and the metadata of the impact function that you want to add.

I recommend you to switch to the latest version of InaSAFE (in develop now, will be released as 3.2 in the end of this July). Some changes are made in this wizard and the metadata things. We introduce many things related to metadata and wizard., it's up to you if you want to stay with 3.1

For step to choose DaLA classes in hazard layer, you just need to add the definition of DaLa classess in safe/definiitons.py and add it to the metadata in you Impact Function. InaSAFE will automatically add it to the wizard.

For the exposure layer, choosing unit asset should be the same as above. Add the definitions in safe/definitions.py and add it to your impact function's metadata.
For the next two steps after it, you need to add new steps in the keywords wizard. It's completely new.

For aggregation layer, you need to add new steps in the keyword wizard.

Updating the wizard will be little complex, since it's a very long class. And it's easy to break the wizard, especially if we set the wrong wizard's step. You can run the test if you want to see if you break something or not. Although, there are some possibility that there is a case that is not covered by tests.

@mf4dl1
Copy link
Owner Author

mf4dl1 commented Jul 13, 2015

Dear @ismailsunni ,

Thanx for the quick response of these. Tomorrow we will discuss this with @ekaakurniawan , @fariskhi and @jj0hns0n . You are welcome if you want to join us at 9.00am (14/07/2015).

Dear @ekaakurniawan ,

Please have a look at the code what @ismailsunni 's suggestion. Do not hesitate to throw some question in this RFC if there's something that not clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants