Skip to content

Commit ddb34eb

Browse files
committed
Remove the table of contents on top of each tutorial file
1 parent 9d549e9 commit ddb34eb

10 files changed

+88
-244
lines changed

doc/guide/Guide_CLIMADA_Tutorial.ipynb

Lines changed: 0 additions & 19 deletions
Large diffs are not rendered by default.

doc/tutorial/0_intro_python.ipynb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@
1111
"Most of the examples come from the official Python tutorial: https://docs.python.org/3/tutorial/"
1212
]
1313
},
14-
{
15-
"attachments": {},
16-
"cell_type": "markdown",
17-
"metadata": {},
18-
"source": [
19-
"## Contents\n",
20-
"\n",
21-
"- [Numbers and Strings](#Numbers-and-Strings)\n",
22-
"- [Lists](#Lists)\n",
23-
"- [Tuples](#Tuples)\n",
24-
"- [Sets](#Sets)\n",
25-
"- [Dictonaries](#Dictionaries)\n",
26-
"- [Functions](#Functions)\n",
27-
"- [Objects](#Objects)"
28-
]
29-
},
3014
{
3115
"attachments": {},
3216
"cell_type": "markdown",

doc/tutorial/1_main_climada.ipynb

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# CLIMADA overview\n",
8-
"\n",
9-
"## Contents\n",
10-
"\n",
11-
"- [Introduction](#Introduction)\n",
12-
" - [What is CLIMADA?](#What-is-CLIMADA)\n",
13-
" - [This tutorial](#This-tutorial)\n",
14-
" - [Resources beyond this tutorial](#Resources-beyond-this-tutorial)\n",
15-
"- [CLIMADA features](#CLIMADA-features)\n",
16-
" - [CLIMADA classes](#CLIMADA-classes)\n",
17-
"- [Tutorial: an example risk assessment](#Tutorial--an-example-risk-assessment)\n",
18-
" - [Hazard](#Hazard)\n",
19-
" - [Storm tracks](#Storm-tracks)\n",
20-
" - [Centroids](#Centroids)\n",
21-
" - [Hazard footprint](#Hazard-footprint)\n",
22-
" - [Entity](#Entity)\n",
23-
" - [Exposures](#Exposures)\n",
24-
" - [Impact functions](#Impact-functions)\n",
25-
" - [Adaptation measures](#Adaptation-measures)\n",
26-
" - [Discount rates](#Discount-rates)\n",
27-
" - [Engine](#Engine)\n",
28-
" - [Impact](#Impact)\n",
29-
" - [Adaptation options appraisal](#Adaptation-options-appraisal)\n",
30-
" "
7+
"# CLIMADA overview"
318
]
329
},
3310
{
@@ -956,8 +933,7 @@
956933
"cell_type": "code",
957934
"execution_count": 18,
958935
"metadata": {},
959-
"outputs": [
960-
],
936+
"outputs": [],
961937
"source": [
962938
"from climada.entity import Entity\n",
963939
"\n",

doc/tutorial/climada_engine_CostBenefit.ipynb

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,6 @@
77
"# END-TO-END COST BENEFIT CALCULATION"
88
]
99
},
10-
{
11-
"cell_type": "markdown",
12-
"metadata": {},
13-
"source": [
14-
"## Contents\n",
15-
"\n",
16-
"- [Introduction](#Introduction)\n",
17-
"- [What is a cost-benefit?](#What-is-a-cost-benefit?)\n",
18-
"- [CostBenefit class data structure](#CostBenefit-class-data-structure)\n",
19-
"- [Detailed CostBenefit calculation: LitPop + TropCyclone](#Detailed-CostBenefit-calculation:-LitPop-+-TropCyclone)\n",
20-
"- [Conclusion](#Conclusion)"
21-
]
22-
},
2310
{
2411
"attachments": {},
2512
"cell_type": "markdown",
@@ -270,12 +257,12 @@
270257
"\n",
271258
"client = Client()\n",
272259
"future_year = 2080\n",
273-
"haz_present = client.get_hazard('tropical_cyclone', \n",
274-
" properties={'country_name': 'Haiti', \n",
260+
"haz_present = client.get_hazard('tropical_cyclone',\n",
261+
" properties={'country_name': 'Haiti',\n",
275262
" 'climate_scenario': 'historical',\n",
276263
" 'nb_synth_tracks':'10'})\n",
277-
"haz_future = client.get_hazard('tropical_cyclone', \n",
278-
" properties={'country_name': 'Haiti', \n",
264+
"haz_future = client.get_hazard('tropical_cyclone',\n",
265+
" properties={'country_name': 'Haiti',\n",
279266
" 'climate_scenario': 'rcp60',\n",
280267
" 'ref_year': str(future_year),\n",
281268
" 'nb_synth_tracks':'10'})\n"

doc/tutorial/climada_engine_unsequa.ipynb

Lines changed: 31 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,6 @@
1515
"This is a tutorial for the unsequa module in CLIMADA. A detailled description can be found in [Kropf (2021)](https://eartharxiv.org/repository/view/3123/)."
1616
]
1717
},
18-
{
19-
"cell_type": "markdown",
20-
"metadata": {},
21-
"source": [
22-
"# Table of Contents\n",
23-
"- [Unsequa - a module for uncertainty and sensitivity analysis](#unsequa-a-module-for-uncertainty-and-sensitivity-analysis)\n",
24-
" - [Uncertainty and sensitivity analysis](#uncertainty-and-sensitivity-analysis)\n",
25-
" - [Unsequa Module Structure](#unsequa-module-structure)\n",
26-
" - [InputVar](#inputvar)\n",
27-
" - [Example - custom continuous uncertainty parameter](#example-custom-continuous-uncertainty-parameter)\n",
28-
" - [Example - custom categorical uncertainty parameter](#example-custom-categorical-uncertainty-parameter)\n",
29-
" - [UncOutput](#uncoutput)\n",
30-
" - [Example from file](#example-from-file)\n",
31-
" - [CalcImpact](#calcimpact)\n",
32-
" - [Set the InputVars](#set-the-inputvars)\n",
33-
" - [Compute uncertainty and sensitivity using default methods](#compute-uncertainty-and-sensitivity-using-default-methods)\n",
34-
" - [A few non-default parameters](#a-few-non-default-parameters)\n",
35-
" - [CalcDeltaImpact](#calcdeltaimpact)\n",
36-
" - [Set the Input Vars](#set-the-input-vars)\n",
37-
" - [Compute uncertainty and sensitivity](#compute-uncertainty-and-sensitivity)\n",
38-
" - [CalcCostBenefit](#calccostbenefit)\n",
39-
" - [Set the Input Vars](#set-the-input-vars)\n",
40-
" - [Compute cost benefit uncertainty and sensitivity using default methods](#compute-cost-benefit-uncertainty-and-sensitivity-using-default-methods)\n",
41-
" - [Advanced examples](#advanced-examples)\n",
42-
" - [Coupled variables](#coupled-variables)\n",
43-
" - [Many scenarios of hazards and exposures](#many-scenarios-of-hazards-and-exposures)\n",
44-
" - [Input variable: Repeated loading of files made efficient](#input-variable-repeated-loading-of-files-made-efficient)"
45-
]
46-
},
4718
{
4819
"cell_type": "markdown",
4920
"metadata": {},
@@ -183,7 +154,7 @@
183154
"outputs": [],
184155
"source": [
185156
"import warnings\n",
186-
"warnings.filterwarnings('ignore') #Ignore warnings for making the tutorial's pdf. \n",
157+
"warnings.filterwarnings('ignore') #Ignore warnings for making the tutorial's pdf.\n",
187158
"\n",
188159
"#Define the base exposure\n",
189160
"from climada.util.constants import EXP_DEMO_H5\n",
@@ -346,7 +317,7 @@
346317
"\n",
347318
"# Define the function\n",
348319
"# Note that this here works, but might be slow because the method LitPop is called everytime the the function\n",
349-
"# is evaluated, and LitPop is relatively slow. \n",
320+
"# is evaluated, and LitPop is relatively slow.\n",
350321
"def litpop_cat(m, n):\n",
351322
" exp = Litpop.from_countries('CHE', res_arcsec=150, exponent=[m, n])\n",
352323
" return exp"
@@ -372,7 +343,7 @@
372343
" for n in range(n_min, n_max + 1):\n",
373344
" exp_mn = LitPop.from_countries('CHE', res_arcsec=150, exponents=[m, n]);\n",
374345
" litpop_dict[(m, n)] = exp_mn\n",
375-
" \n",
346+
"\n",
376347
"def litpop_cat(m, n, litpop_dict=litpop_dict):\n",
377348
" return litpop_dict[(m, n)]"
378349
]
@@ -992,16 +963,16 @@
992963
"from climada.hazard import Hazard\n",
993964
"\n",
994965
"def impf_func(G=1, v_half=84.7, vmin=25.7, k=3, _id=1):\n",
995-
" \n",
966+
"\n",
996967
" def xhi(v, v_half, vmin):\n",
997968
" return max([(v - vmin), 0]) / (v_half - vmin)\n",
998969
"\n",
999970
" def sigmoid_func(v, G, v_half, vmin, k):\n",
1000971
" return G * xhi(v, v_half, vmin)**k / (1 + xhi(v, v_half, vmin)**k)\n",
1001972
"\n",
1002973
" #In-function imports needed only for parallel computing on Windows\n",
1003-
" import numpy as np \n",
1004-
" from climada.entity import ImpactFunc, ImpactFuncSet \n",
974+
" import numpy as np\n",
975+
" from climada.entity import ImpactFunc, ImpactFuncSet\n",
1005976
" intensity_unit = 'm/s'\n",
1006977
" intensity = np.linspace(0, 150, num=100)\n",
1007978
" mdd = np.repeat(1, len(intensity))\n",
@@ -1015,7 +986,7 @@
1015986
"exp_base = Exposures.from_hdf5(EXP_DEMO_H5)\n",
1016987
"#It is a good idea to assign the centroids to the base exposures in order to avoid repeating this\n",
1017988
"# potentially costly operation for each sample.\n",
1018-
"exp_base.assign_centroids(haz) \n",
989+
"exp_base.assign_centroids(haz)\n",
1019990
"def exp_base_func(x_exp, exp_base):\n",
1020991
" exp = exp_base.copy()\n",
1021992
" exp.gdf.value *= x_exp\n",
@@ -1066,9 +1037,9 @@
10661037
"import scipy as sp\n",
10671038
"from climada.engine.unsequa import InputVar\n",
10681039
"\n",
1069-
"exp_distr = {\"x_exp\": sp.stats.beta(10, 1.1)} #This is not really a reasonable distribution but is used \n",
1040+
"exp_distr = {\"x_exp\": sp.stats.beta(10, 1.1)} #This is not really a reasonable distribution but is used\n",
10701041
" #here to show that you can use any scipy distribution.\n",
1071-
" \n",
1042+
"\n",
10721043
"exp_iv = InputVar(exp_func, exp_distr)\n",
10731044
"\n",
10741045
"impf_distr = {\n",
@@ -2128,7 +2099,7 @@
21282099
],
21292100
"source": [
21302101
"# Compute also the distribution of the metric `eai_exp`\n",
2131-
"# To speed-up the comutations, we can use more than one process \n",
2102+
"# To speed-up the comutations, we can use more than one process\n",
21322103
"# Note that for large dataset a single process might be more efficient\n",
21332104
"import time\n",
21342105
"\n",
@@ -2244,7 +2215,7 @@
22442215
},
22452216
"outputs": [],
22462217
"source": [
2247-
"# Use the method 'rbd_fast' which is recommend in pair with 'latin'. In addition, change one of the kwargs \n",
2218+
"# Use the method 'rbd_fast' which is recommend in pair with 'latin'. In addition, change one of the kwargs\n",
22482219
"# (M=15) of the salib sampling method.\n",
22492220
"output_imp2 = calc_imp2.sensitivity(output_imp2, sensitivity_method='rbd_fast', sensitivity_kwargs = {'M': 15})"
22502221
]
@@ -2431,7 +2402,7 @@
24312402
"from climada.hazard import Centroids, TCTracks, Hazard, TropCyclone\n",
24322403
"\n",
24332404
"def impf_func(G=1, v_half=84.7, vmin=25.7, k=3, _id=1):\n",
2434-
" \n",
2405+
"\n",
24352406
" def xhi(v, v_half, vmin):\n",
24362407
" return max([(v - vmin), 0]) / (v_half - vmin)\n",
24372408
"\n",
@@ -2488,7 +2459,7 @@
24882459
"exp_base = Exposures.from_hdf5(EXP_DEMO_H5)\n",
24892460
"#It is a good idea to assign the centroids to the base exposures in order to avoid repeating this\n",
24902461
"# potentially costly operation for each sample.\n",
2491-
"exp_base.assign_centroids(haz) \n",
2462+
"exp_base.assign_centroids(haz)\n",
24922463
"def exp_base_func(x_exp, exp_base):\n",
24932464
" exp = exp_base.copy()\n",
24942465
" exp.gdf.value *= x_exp\n",
@@ -2506,9 +2477,9 @@
25062477
"import scipy as sp\n",
25072478
"from climada.engine.unsequa import InputVar\n",
25082479
"\n",
2509-
"exp_distr = {\"x_exp\": sp.stats.beta(10, 1.1)} #This is not really a reasonable distribution but is used \n",
2480+
"exp_distr = {\"x_exp\": sp.stats.beta(10, 1.1)} #This is not really a reasonable distribution but is used\n",
25102481
" #here to show that you can use any scipy distribution.\n",
2511-
" \n",
2482+
"\n",
25122483
"exp_iv = InputVar(exp_func, exp_distr)\n",
25132484
"\n",
25142485
"impf_distr = {\n",
@@ -2602,7 +2573,7 @@
26022573
],
26032574
"source": [
26042575
"from climada.engine.unsequa import CalcDeltaImpact\n",
2605-
"calc_imp = CalcDeltaImpact(exp_iv, impf_iv, haz, \n",
2576+
"calc_imp = CalcDeltaImpact(exp_iv, impf_iv, haz,\n",
26062577
" exp_iv, impf_iv, haz_fut_iv)"
26072578
]
26082579
},
@@ -2822,8 +2793,8 @@
28222793
"# Entity today has an uncertainty in the total asset value\n",
28232794
"def ent_today_func(x_ent):\n",
28242795
" #In-function imports needed only for parallel computing on Windows\n",
2825-
" from climada.entity import Entity \n",
2826-
" from climada.util.constants import ENT_DEMO_TODAY \n",
2796+
" from climada.entity import Entity\n",
2797+
" from climada.util.constants import ENT_DEMO_TODAY\n",
28272798
" entity = Entity.from_excel(ENT_DEMO_TODAY)\n",
28282799
" entity.exposures.ref_year = 2018\n",
28292800
" entity.exposures.gdf.value *= x_ent\n",
@@ -2832,10 +2803,10 @@
28322803
"# Entity in the future has a +- 10% uncertainty in the cost of all the adapatation measures\n",
28332804
"def ent_fut_func(m_fut_cost):\n",
28342805
" #In-function imports needed only for parallel computing on Windows\n",
2835-
" from climada.entity import Entity \n",
2836-
" from climada.util.constants import ENT_DEMO_FUTURE \n",
2806+
" from climada.entity import Entity\n",
2807+
" from climada.util.constants import ENT_DEMO_FUTURE\n",
28372808
" entity = Entity.from_excel(ENT_DEMO_FUTURE)\n",
2838-
" entity.exposures.ref_year = 2040 \n",
2809+
" entity.exposures.ref_year = 2040\n",
28392810
" for meas in entity.measures.get_measure('TC'):\n",
28402811
" meas.cost *= m_fut_cost\n",
28412812
" return entity\n",
@@ -2844,9 +2815,9 @@
28442815
"# The hazard intensity in the future is also uncertainty by a multiplicative factor\n",
28452816
"def haz_fut(x_haz_fut, haz_base):\n",
28462817
" #In-function imports needed only for parallel computing on Windows\n",
2847-
" import copy \n",
2848-
" from climada.hazard import Hazard \n",
2849-
" from climada.util.constants import HAZ_DEMO_H5 \n",
2818+
" import copy\n",
2819+
" from climada.hazard import Hazard\n",
2820+
" from climada.util.constants import HAZ_DEMO_H5\n",
28502821
" haz = copy.deepcopy(haz_base)\n",
28512822
" haz.intensity = haz.intensity.multiply(x_haz_fut)\n",
28522823
" return haz\n",
@@ -5100,7 +5071,7 @@
51005071
}
51015072
],
51025073
"source": [
5103-
"# The impact_meas_present and impact_meas_future provide values of the cost_meas, risk_transf, risk, \n",
5074+
"# The impact_meas_present and impact_meas_future provide values of the cost_meas, risk_transf, risk,\n",
51045075
"# and cost_ins for each measure\n",
51055076
"output_cb.get_uncertainty(metric_list=['imp_meas_present']).tail()"
51065077
]
@@ -5286,7 +5257,7 @@
52865257
"metadata": {},
52875258
"outputs": [],
52885259
"source": [
5289-
"#Define the input variable \n",
5260+
"#Define the input variable\n",
52905261
"from climada.entity import ImpactFuncSet, Exposures\n",
52915262
"from climada.entity.impact_funcs.storm_europe import ImpfStormEurope\n",
52925263
"from climada.hazard import Hazard\n",
@@ -5306,7 +5277,7 @@
53065277
"\n",
53075278
"\n",
53085279
"def haz_func(cnt, i_haz, haz_list=haz_list):\n",
5309-
" haz = copy.deepcopy(haz_list[int(cnt)]) #use the same parameter name accross input variables \n",
5280+
" haz = copy.deepcopy(haz_list[int(cnt)]) #use the same parameter name accross input variables\n",
53105281
" haz.intensity *= i_haz\n",
53115282
" return haz\n",
53125283
"\n",
@@ -5588,16 +5559,16 @@
55885559
"\n",
55895560
"\n",
55905561
"def impf_func(G=1, v_half=84.7, vmin=25.7, k=3, _id=1):\n",
5591-
" \n",
5562+
"\n",
55925563
" def xhi(v, v_half, vmin):\n",
55935564
" return max([(v - vmin), 0]) / (v_half - vmin)\n",
55945565
"\n",
55955566
" def sigmoid_func(v, G, v_half, vmin, k):\n",
55965567
" return G * xhi(v, v_half, vmin)**k / (1 + xhi(v, v_half, vmin)**k)\n",
55975568
"\n",
55985569
" #In-function imports needed only for parallel computing on Windows\n",
5599-
" import numpy as np \n",
5600-
" from climada.entity import ImpactFunc, ImpactFuncSet \n",
5570+
" import numpy as np\n",
5571+
" from climada.entity import ImpactFunc, ImpactFuncSet\n",
56015572
" imp_fun = ImpactFunc()\n",
56025573
" imp_fun.haz_type = 'WS'\n",
56035574
" imp_fun.id = _id\n",
@@ -5715,7 +5686,7 @@
57155686
"name": "python",
57165687
"nbconvert_exporter": "python",
57175688
"pygments_lexer": "ipython3",
5718-
"version": "3.9.16"
5689+
"version": "3.9.18"
57195690
},
57205691
"latex_envs": {
57215692
"LaTeX_envs_menu_present": true,

doc/tutorial/climada_engine_unsequa_helper.ipynb

Lines changed: 18 additions & 32 deletions
Large diffs are not rendered by default.

doc/tutorial/climada_entity_Exposures.ipynb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@
77
"# Exposures class"
88
]
99
},
10-
{
11-
"attachments": {},
12-
"cell_type": "markdown",
13-
"metadata": {},
14-
"source": [
15-
"## Content\n",
16-
"\n",
17-
"- [Defining exposuresfrom your owndata](#Defining-exposures-from-your-own-data) \n",
18-
"- [Loading CLIMADA generated exposure files or generating new ones](#Loading-CLIMADA-generated-exposure-files-or-generating-new-ones)\n",
19-
"- [Visualize Exposures](#Visualize-Exposures)\n",
20-
"- [Write (Save) Exposures](#Write-(Save)-Exposures)\n",
21-
"- [Dask: improving performance for big exposure](#Dask---improving-performance-for-big-exposure)\n"
22-
]
23-
},
2410
{
2511
"attachments": {},
2612
"cell_type": "markdown",

0 commit comments

Comments
 (0)