Skip to content

Commit

Permalink
update notebooks (align input naming as in parallel proc)
Browse files Browse the repository at this point in the history
  • Loading branch information
matamadio committed Sep 22, 2023
1 parent 83aeb80 commit 114ac3b
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 145 deletions.
52 changes: 29 additions & 23 deletions Top-down/notebooks/Coastal_flood.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@
" \"MLI\": 155,\n",
" \"NER\": 181,\n",
" \"TCD\": 50,\n",
" \"MRT\": 159\n",
" \"MRT\": 159,\n",
" \"NGA\": 182,\n",
" \"DOM\": 'DO',\n",
" \"PNG\": 'PG',\n",
" \"GNB\": 'GW'\n",
"}"
]
},
Expand All @@ -72,6 +76,7 @@
" .. [1] JRC, 2017\n",
" \"\"\"\n",
" #return np.maximum(0.0, np.minimum(1.0, -0.0028*x**3 + 0.0362*x**2 + 0.0095*x)) # Floods - AFRICA\n",
" #return np.maximum(0.0, np.minimum(1.0, 0.9981236 - 0.9946279*np.exp(-1.711056*x))) # Floods - LAC\n",
" return np.maximum(0.0, np.minimum(1.0, 0.00723*x**3 - 0.1000*x**2 + 0.5060*x)) # Floods - ASIA"
]
},
Expand Down Expand Up @@ -194,21 +199,21 @@
" else:\n",
" min_haz_threshold = min_haz_slider.value\n",
"\n",
" valid_RPs = [10, 100, 1000]\n",
" valid_RPs = [5, 10, 25, 50, 100, 250]\n",
"\n",
" # Testing data file locations\n",
" # TODO: Temp data store, to be replaced with a config spec (.env file?) before deployment\n",
" \n",
" exposure_dir = f\"{DATA_DIR}/EXP/{country}\"\n",
" if exp_cat_dd.value == 'pop':\n",
" damage_factor = mortality_factor\n",
" exp_raster_fn = f\"{exposure_dir}_WPOP20.tif\"\n",
" exp_raster_fn = f\"{exposure_dir}_POP.tif\"\n",
" elif exp_cat_dd.value == 'builtup':\n",
" damage_factor = damage_factor_builtup\n",
" exp_raster_fn = f\"{exposure_dir}_WSF19.tif\"\n",
" exp_raster_fn = f\"{exposure_dir}_BU.tif\"\n",
" elif exp_cat_dd.value == 'agri':\n",
" damage_factor = damage_factor_agri\n",
" exp_raster_fn = f\"{exposure_dir}_ESA20_agri.tif\"\n",
" exp_raster_fn = f\"{exposure_dir}_AGR.tif\"\n",
" else:\n",
" ValueError(f\"Missing or unknown data layer {exp_cat_dd.value}\")\n",
"\n",
Expand Down Expand Up @@ -400,7 +405,8 @@
"country_dd = widgets.Dropdown(\n",
" options=[('Nepal', 'NPL'), ('Pakistan', 'PAK'),('Bangladesh', 'BGD'),('Ghana', 'GHA'),\n",
" ('Ethiopia', 'ETH'), ('Burkina Faso', 'BFA'), ('Mali', 'MLI'), ('Niger', 'NER'),\n",
" ('Chad', 'TCD'), ('Mauritania', 'MRT')],\n",
" ('Chad', 'TCD'), ('Mauritania', 'MRT'), ('Nigeria', 'NGA'), ('Dominican Republic', 'DOM'), \n",
" ('Papua New Guinea', 'PNG'), ('Guinea-Bissau', 'GNB')],\n",
" value='NPL',\n",
" description='Country:',\n",
" style={'description_width': 'initial'}\n",
Expand All @@ -414,7 +420,7 @@
")\n",
"\n",
"adm_dd = widgets.Dropdown(\n",
" options=['ADM1', 'ADM2', 'ADM3'],\n",
" options=['ADM1', 'ADM2', 'ADM3', 'ADM4'],\n",
" value='ADM2',\n",
" description='Administrative Unit Level:',\n",
" style={'description_width': 'initial'}\n",
Expand Down Expand Up @@ -565,7 +571,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ae3810566f0240a190267bb13010eec7",
"model_id": "a7ee0ffe7cbb4cabbed3a2e46e9eb387",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -579,7 +585,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "33094bbc2be649e9b1523bc3cce5f8c8",
"model_id": "0072891302af484d805ae5d83bb0fabd",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -593,12 +599,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2f3930e0b9c74600882bed16b22938d8",
"model_id": "6e9c84a2bb6c48f685eca52f05292746",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Dropdown(description='Administrative Unit Level:', index=1, options=('ADM1', 'ADM2', 'ADM3'), style=Descriptio"
"Dropdown(description='Administrative Unit Level:', index=1, options=('ADM1', 'ADM2', 'ADM3', 'ADM4'), style=De"
]
},
"metadata": {},
Expand All @@ -607,7 +613,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a0af220c62bf4d62ae3a422e5a429310",
"model_id": "7978151702d241c38aec27e927d9ba36",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -621,7 +627,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cd7a8a3e2335412b9dd0ac8c924facc7",
"model_id": "25be641ce0b040bb885835e116781c4f",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -635,7 +641,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "14c135c26bd948e39bb59da413acf26d",
"model_id": "45278e7ec7b6407cb6903419649a7ed6",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -649,7 +655,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "edc092cf40e84eaaaed24bf672c2cd33",
"model_id": "44991d71a38a445eae379335806820d0",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -663,7 +669,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7c9b958724314a0c93c8d4e56ed0c999",
"model_id": "b04ed87a1e0a443ea80fc7ee319c8695",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -677,7 +683,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4f85ad17c23f4f9b8f184b952357d9e2",
"model_id": "e2a00ed631c14621acafc574508ea952",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -691,7 +697,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "080d41549f3f42a6a6591a90e7178533",
"model_id": "5b2691df8d7c499ebb9f55d93562ac25",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -705,7 +711,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "40e32a9b7c984095a0ecabb3bc2e75c7",
"model_id": "464e14997b784a96a25695294d4374cf",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -719,7 +725,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f230341479084e6a8e53b2342425b6c6",
"model_id": "296565d47bbf45bd8dd33c6e72c111cf",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -733,7 +739,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8cbd1ca0371349c08498692bce304da6",
"model_id": "b906823b2129442dbd8e5e0553f68aa9",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -747,7 +753,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "54aaafe6e20342d0b506e99928d6b4ce",
"model_id": "0692a24d6b7248b1be08aa1babfdfb52",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -761,7 +767,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8b370a76bd85420fadb810f80f3e94ce",
"model_id": "2df37411104a4eab9b3e69733ab77463",
"version_major": 2,
"version_minor": 0
},
Expand Down
Loading

0 comments on commit 114ac3b

Please sign in to comment.