Definition L updates (#862)

* Changing FEMA risk measure 

* Adding "basic stats" feature to comparison tool 

* Tweaking Definition L
This commit is contained in:
Lucas Merrill Brown 2021-11-05 15:43:52 -04:00 committed by GitHub
commit 03e59f2abd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 265 additions and 63 deletions

View file

@ -1,6 +1,6 @@
TRACT,TRACTFIPS,RISK_SCORE,RISK_RATNG,RISK_NPCTL,EAL_SCORE
40300,05007040300,10.492015,Very Low,15.3494,11.5
20100,05001020100,14.705854,Relatively Low,36.725828,12.5
40500,15007040500,10.234981,Very Low,13.997993,13.5
21010,15001021010,21.537231,Relatively Moderate,59.488033,14.5
21101,15001021101,19.434585,Relatively Low,53.392265,15.5
TRACT,TRACTFIPS,RISK_SCORE,RISK_RATNG,RISK_NPCTL,EAL_SCORE,AVLN_EALT,CFLD_EALT,CWAV_EALT,DRGT_EALT,ERQK_EALT,HAIL_EALT,HWAV_EALT,HRCN_EALT,ISTM_EALT,LNDS_EALT,LTNG_EALT,RFLD_EALT,SWND_EALT,TRND_EALT,TSUN_EALT,VLCN_EALT,WFIR_EALT,WNTW_EALT,AVLN_EXPT,CFLD_EXPT,CWAV_EXPT,DRGT_EXPT,ERQK_EXPT,HAIL_EXPT,HWAV_EXPT,HRCN_EXPT,ISTM_EXPT,LNDS_EXPT,LTNG_EXPT,RFLD_EXPT,SWND_EXPT,TRND_EXPT,TSUN_EXPT,VLCN_EXPT,WFIR_EXPT,WNTW_EXPT
40300,05007040300,10.492015,Very Low,15.3494,11.5,12.5,13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,31.5,32.5,33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5,41.5,42.5,43.5,44.5,45.5,46.5,47.5
20100,05001020100,14.705854,Relatively Low,36.725828,12.5,13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,31.5,32.5,33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5,41.5,42.5,43.5,44.5,45.5,46.5,47.5,48.5
40500,15007040500,10.234981,Very Low,13.997993,13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,31.5,32.5,33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5,41.5,42.5,43.5,44.5,45.5,46.5,47.5,48.5,49.5
21010,15001021010,21.537231,Relatively Moderate,59.488033,14.5,15.5,16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,31.5,32.5,33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5,41.5,42.5,43.5,44.5,45.5,46.5,47.5,48.5,49.5,50.5
21101,15001021101,19.434585,Relatively Low,53.392265,15.5,16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,31.5,32.5,33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5,41.5,42.5,43.5,44.5,45.5,46.5,47.5,48.5,49.5,50.5,51.5

1 TRACT TRACTFIPS RISK_SCORE RISK_RATNG RISK_NPCTL EAL_SCORE AVLN_EALT CFLD_EALT CWAV_EALT DRGT_EALT ERQK_EALT HAIL_EALT HWAV_EALT HRCN_EALT ISTM_EALT LNDS_EALT LTNG_EALT RFLD_EALT SWND_EALT TRND_EALT TSUN_EALT VLCN_EALT WFIR_EALT WNTW_EALT AVLN_EXPT CFLD_EXPT CWAV_EXPT DRGT_EXPT ERQK_EXPT HAIL_EXPT HWAV_EXPT HRCN_EXPT ISTM_EXPT LNDS_EXPT LTNG_EXPT RFLD_EXPT SWND_EXPT TRND_EXPT TSUN_EXPT VLCN_EXPT WFIR_EXPT WNTW_EXPT
2 40300 05007040300 10.492015 Very Low 15.3494 11.5 12.5 13.5 14.5 15.5 16.5 17.5 18.5 19.5 20.5 21.5 22.5 23.5 24.5 25.5 26.5 27.5 28.5 29.5 30.5 31.5 32.5 33.5 34.5 35.5 36.5 37.5 38.5 39.5 40.5 41.5 42.5 43.5 44.5 45.5 46.5 47.5
3 20100 05001020100 14.705854 Relatively Low 36.725828 12.5 13.5 14.5 15.5 16.5 17.5 18.5 19.5 20.5 21.5 22.5 23.5 24.5 25.5 26.5 27.5 28.5 29.5 30.5 31.5 32.5 33.5 34.5 35.5 36.5 37.5 38.5 39.5 40.5 41.5 42.5 43.5 44.5 45.5 46.5 47.5 48.5
4 40500 15007040500 10.234981 Very Low 13.997993 13.5 14.5 15.5 16.5 17.5 18.5 19.5 20.5 21.5 22.5 23.5 24.5 25.5 26.5 27.5 28.5 29.5 30.5 31.5 32.5 33.5 34.5 35.5 36.5 37.5 38.5 39.5 40.5 41.5 42.5 43.5 44.5 45.5 46.5 47.5 48.5 49.5
5 21010 15001021010 21.537231 Relatively Moderate 59.488033 14.5 15.5 16.5 17.5 18.5 19.5 20.5 21.5 22.5 23.5 24.5 25.5 26.5 27.5 28.5 29.5 30.5 31.5 32.5 33.5 34.5 35.5 36.5 37.5 38.5 39.5 40.5 41.5 42.5 43.5 44.5 45.5 46.5 47.5 48.5 49.5 50.5
6 21101 15001021101 19.434585 Relatively Low 53.392265 15.5 16.5 17.5 18.5 19.5 20.5 21.5 22.5 23.5 24.5 25.5 26.5 27.5 28.5 29.5 30.5 31.5 32.5 33.5 34.5 35.5 36.5 37.5 38.5 39.5 40.5 41.5 42.5 43.5 44.5 45.5 46.5 47.5 48.5 49.5 50.5 51.5

View file

@ -1,11 +1,11 @@
GEOID10,FEMA Risk Index Expected Annual Loss Score
050070403001,11.5
050070403002,11.5
050010201001,12.5
050010201002,12.5
150070405001,13.5
150070405002,13.5
150010210101,14.5
150010210102,14.5
150010211011,15.5
150010211012,15.5
GEOID10,FEMA Risk Index Expected Annual Loss Score,FEMA Risk Index Expected Annual Loss Rate
050070403001,11.5,9.540442348853764
050070403002,11.5,9.540442348853764
050010201001,12.5,9.759472262661436
050010201002,12.5,9.759472262661436
150070405001,13.5,9.967264470453644
150070405002,13.5,9.967264470453644
150010210101,14.5,10.16467498073544
150010210102,14.5,10.16467498073544
150010211011,15.5,10.352473850464468
150010211012,15.5,10.352473850464468

1 GEOID10 FEMA Risk Index Expected Annual Loss Score FEMA Risk Index Expected Annual Loss Rate
2 050070403001 11.5 9.540442348853764
3 050070403002 11.5 9.540442348853764
4 050010201001 12.5 9.759472262661436
5 050010201002 12.5 9.759472262661436
6 150070405001 13.5 9.967264470453644
7 150070405002 13.5 9.967264470453644
8 150010210101 14.5 10.16467498073544
9 150010210102 14.5 10.16467498073544
10 150010211011 15.5 10.352473850464468
11 150010211012 15.5 10.352473850464468

View file

@ -1,11 +1,11 @@
GEOID10,GEOID10_TRACT,FEMA Risk Index Expected Annual Loss Score
050070403001,05007040300,11.5
050070403002,05007040300,11.5
050010201001,05001020100,12.5
050010201002,05001020100,12.5
150070405001,15007040500,13.5
150070405002,15007040500,13.5
150010210101,15001021010,14.5
150010210102,15001021010,14.5
150010211011,15001021101,15.5
150010211012,15001021101,15.5
GEOID10,GEOID10_TRACT,FEMA Risk Index Expected Annual Loss Score,FEMA Risk Index Expected Annual Loss Rate
050070403001,05007040300,11.5,9.540442348853764
050070403002,05007040300,11.5,9.540442348853764
050010201001,05001020100,12.5,9.759472262661436
050010201002,05001020100,12.5,9.759472262661436
150070405001,15007040500,13.5,9.967264470453644
150070405002,15007040500,13.5,9.967264470453644
150010210101,15001021010,14.5,10.164674980735441
150010210102,15001021010,14.5,10.164674980735441
150010211011,15001021101,15.5,10.352473850464467
150010211012,15001021101,15.5,10.352473850464467

1 GEOID10 GEOID10_TRACT FEMA Risk Index Expected Annual Loss Score FEMA Risk Index Expected Annual Loss Rate
2 050070403001 05007040300 11.5 9.540442348853764
3 050070403002 05007040300 11.5 9.540442348853764
4 050010201001 05001020100 12.5 9.759472262661436
5 050010201002 05001020100 12.5 9.759472262661436
6 150070405001 15007040500 13.5 9.967264470453644
7 150070405002 15007040500 13.5 9.967264470453644
8 150010210101 15001021010 14.5 10.164674980735441
9 150010210102 15001021010 14.5 10.164674980735441
10 150010211011 15001021101 15.5 10.352473850464467
11 150010211012 15001021101 15.5 10.352473850464467

View file

@ -61,9 +61,10 @@ class TestNationalRiskIndexETL:
)
# execution
etl.transform()
# validation
assert etl.df.shape == (10, 3)
assert etl.df.equals(expected)
assert etl.df.shape == (10, 4)
pd.testing.assert_frame_equal(etl.df, expected)
def test_load(self, mock_etl):
"""Tests the load() method for NationalRiskIndexETL
@ -89,7 +90,8 @@ class TestNationalRiskIndexETL:
# execution
etl.load()
output = pd.read_csv(output_path, dtype={BLOCK_COL: str})
# validation
assert output_path.exists()
assert output.shape == (10, 2)
assert output.equals(expected)
assert output.shape == (10, 3)
pd.testing.assert_frame_equal(output, expected)