Skip to content

Commit b2d9aa8

Browse files
chahankChahan Kropf
andauthored
Remove explicit write example from measure tuto. (#1072)
* Remove explicit write example * Avoid title text with ; * Remove outdated cell output. --------- Co-authored-by: Chahan Kropf <[email protected]>
1 parent 0cb35ca commit b2d9aa8

File tree

1 file changed

+6
-74
lines changed

1 file changed

+6
-74
lines changed

doc/user-guide/climada_entity_MeasureSet.ipynb

Lines changed: 6 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
"# new impact functions\n",
149149
"new_exp, new_impfs, new_haz = meas.apply(exp, impf_all, haz)\n",
150150
"axes = new_impfs.plot()\n",
151-
"axes.set_title(\"TC: Modified impact function\")"
151+
"axes.set_title(\"TC: Modified impact function\");"
152152
]
153153
},
154154
{
@@ -553,103 +553,35 @@
553553
"cell_type": "markdown",
554554
"metadata": {},
555555
"source": [
556-
"## Read measures of an Excel file\n",
556+
"## Read/write measure sets to/from Excel files\n",
557557
"\n",
558-
"Measures defined in an excel file following the template provided in sheet `measures` of `climada_python/data/system/entity_template.xlsx` can be ingested directly using the method `from_excel()`."
558+
"Measures defined in an excel file following the template provided in sheet `measures` of `climada_python/data/system/entity_template.xlsx` can be ingested directly using the method `from_excel()`. Measure sets can be written to file with the method `write_excel()`."
559559
]
560560
},
561561
{
562562
"cell_type": "code",
563-
"execution_count": 7,
563+
"execution_count": null,
564564
"metadata": {
565565
"ExecuteTime": {
566566
"end_time": "2021-03-05T12:22:41.336852Z",
567567
"start_time": "2021-03-05T12:22:41.266438Z"
568568
}
569569
},
570-
"outputs": [
571-
{
572-
"data": {
573-
"text/plain": [
574-
"<climada.entity.measures.measure_set.MeasureSet at 0x1f30d913b80>"
575-
]
576-
},
577-
"execution_count": 1,
578-
"metadata": {},
579-
"output_type": "execute_result"
580-
}
581-
],
582-
"source": [
583-
"from climada.entity.measures import MeasureSet\n",
584-
"from climada.util import ENT_TEMPLATE_XLS\n",
585-
"\n",
586-
"# Fill DataFrame from Excel file\n",
587-
"file_name = ENT_TEMPLATE_XLS # provide absolute path of the excel file\n",
588-
"meas_set = MeasureSet.from_excel(file_name)\n",
589-
"meas_set"
590-
]
591-
},
592-
{
593-
"cell_type": "markdown",
594-
"metadata": {},
595-
"source": [
596-
"## Write measures\n",
597-
"\n",
598-
"Measures can be writen in Excel format using `write_excel()` method."
599-
]
600-
},
601-
{
602-
"cell_type": "code",
603-
"execution_count": 8,
604-
"metadata": {
605-
"ExecuteTime": {
606-
"end_time": "2021-03-05T11:44:20.460278Z",
607-
"start_time": "2021-03-05T11:44:16.581Z"
608-
}
609-
},
610570
"outputs": [],
611571
"source": [
612572
"from climada.entity.measures import MeasureSet\n",
613573
"from climada.util import ENT_TEMPLATE_XLS\n",
614574
"\n",
615575
"# Fill DataFrame from Excel file\n",
616576
"file_name = ENT_TEMPLATE_XLS # provide absolute path of the excel file\n",
617-
"meas_set = MeasureSet.from_excel(file_name)\n",
618-
"\n",
619-
"# write file\n",
620-
"meas_set.write_excel(\"results/tutorial_meas_set.xlsx\")"
621-
]
622-
},
623-
{
624-
"cell_type": "markdown",
625-
"id": "adb8d606",
626-
"metadata": {},
627-
"source": [
628-
"Pickle can be used as well, but note that pickle has a [transient format](saving-with-pickle) and should be avoided when possible:"
629-
]
630-
},
631-
{
632-
"cell_type": "code",
633-
"execution_count": 9,
634-
"metadata": {
635-
"ExecuteTime": {
636-
"end_time": "2021-03-05T11:44:20.462069Z",
637-
"start_time": "2021-03-05T11:44:16.599Z"
638-
}
639-
},
640-
"outputs": [],
641-
"source": [
642-
"from climada.util.save import save\n",
643-
"\n",
644-
"# this generates a results folder in the current path and stores the output there\n",
645-
"save(\"tutorial_meas_set.p\", meas_set)"
577+
"meas_set = MeasureSet.from_excel(file_name)"
646578
]
647579
}
648580
],
649581
"metadata": {
650582
"hide_input": false,
651583
"kernelspec": {
652-
"display_name": "Python 3.8.12 ('climada_core')",
584+
"display_name": "Python 3 (ipykernel)",
653585
"language": "python",
654586
"name": "python3"
655587
},

0 commit comments

Comments
 (0)