|
40 | 40 | "tags": [] |
41 | 41 | }, |
42 | 42 | "source": [ |
43 | | - "## Interpolation of risk can be... risky" |
| 43 | + "### Interpolation of risk can be... risky" |
44 | 44 | ] |
45 | 45 | }, |
46 | 46 | { |
|
77 | 77 | "tags": [] |
78 | 78 | }, |
79 | 79 | "source": [ |
80 | | - "## Memory and computation requirements\n", |
| 80 | + "### Memory and computation requirements\n", |
81 | 81 | "\n", |
82 | 82 | "This module adds a new dimension (time) to the risk, as such, it **multiplies** the memory and computation requirement along that dimension (although we avoid running a full-fledge impact computation for each \"interpolated\" point, we still have to define an impact matrix for each of those). \n", |
83 | 83 | "\n", |
|
95 | 95 | "tags": [] |
96 | 96 | }, |
97 | 97 | "source": [ |
98 | | - "# Using the `trajectories` module" |
| 98 | + "## Using the `trajectories` module" |
99 | 99 | ] |
100 | 100 | }, |
101 | 101 | { |
|
135 | 135 | "tags": [] |
136 | 136 | }, |
137 | 137 | "source": [ |
138 | | - "## `Snapshot`: A snapshot of risk at a specific year" |
| 138 | + "### `Snapshot`: A snapshot of risk at a specific year" |
139 | 139 | ] |
140 | 140 | }, |
141 | 141 | { |
|
195 | 195 | "name": "stdout", |
196 | 196 | "output_type": "stream", |
197 | 197 | "text": [ |
198 | | - "2026-02-26 10:26:18,953 - climada.entity.exposures.base - INFO - Reading /home/sjuhel/climada/data/exposures/litpop/LitPop_150arcsec_HTI/v3/LitPop_150arcsec_HTI.hdf5\n", |
199 | | - "2026-02-26 10:26:24,113 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_HTI_1980_2020/v2/tropical_cyclone_10synth_tracks_150arcsec_HTI_1980_2020.hdf5\n" |
| 198 | + "2026-02-26 10:48:49,071 - climada.entity.exposures.base - INFO - Reading /home/sjuhel/climada/data/exposures/litpop/LitPop_150arcsec_HTI/v3/LitPop_150arcsec_HTI.hdf5\n", |
| 199 | + "2026-02-26 10:48:54,125 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_HTI_1980_2020/v2/tropical_cyclone_10synth_tracks_150arcsec_HTI_1980_2020.hdf5\n" |
200 | 200 | ] |
201 | 201 | } |
202 | 202 | ], |
|
257 | 257 | "name": "stdout", |
258 | 258 | "output_type": "stream", |
259 | 259 | "text": [ |
260 | | - "2026-02-26 10:26:32,258 - climada.util.coordinates - INFO - Raster from resolution 0.04166665999999708 to 0.04166665999999708.\n" |
| 260 | + "2026-02-26 10:48:54,165 - climada.util.coordinates - INFO - Raster from resolution 0.04166665999999708 to 0.04166665999999708.\n" |
261 | 261 | ] |
262 | 262 | }, |
263 | 263 | { |
264 | 264 | "name": "stderr", |
265 | 265 | "output_type": "stream", |
266 | 266 | "text": [ |
267 | | - "/home/sjuhel/Repos/climada_python/climada/util/coordinates.py:3130: FutureWarning: The `drop` keyword argument is deprecated and in future the only supported behaviour will match drop=False. To silence this warning and adopt the future behaviour, stop providing `drop` as a keyword to `set_geometry`. To replicate the `drop=True` behaviour you should update your code to\n", |
| 267 | + "/home/sjuhel/Repos/climada_python/climada/util/coordinates.py:3134: FutureWarning: The `drop` keyword argument is deprecated and in future the only supported behaviour will match drop=False. To silence this warning and adopt the future behaviour, stop providing `drop` as a keyword to `set_geometry`. To replicate the `drop=True` behaviour you should update your code to\n", |
268 | 268 | "`geo_col_name = gdf.active_geometry_name; gdf.set_geometry(new_geo_col).drop(columns=geo_col_name).rename_geometry(geo_col_name)`.\n", |
269 | 269 | " df_poly.set_geometry(\n" |
270 | 270 | ] |
|
327 | 327 | "tags": [] |
328 | 328 | }, |
329 | 329 | "source": [ |
330 | | - "## Evaluating risk from multiple snapshots using trajectories" |
| 330 | + "### Evaluating risk from multiple snapshots using trajectories" |
331 | 331 | ] |
332 | 332 | }, |
333 | 333 | { |
|
366 | 366 | "name": "stdout", |
367 | 367 | "output_type": "stream", |
368 | 368 | "text": [ |
369 | | - "2026-02-26 10:26:45,358 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2040/v2/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2040.hdf5\n" |
| 369 | + "2026-02-26 10:49:01,309 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2040/v2/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2040.hdf5\n" |
370 | 370 | ] |
371 | 371 | } |
372 | 372 | ], |
|
402 | 402 | " exposure=exp_future, hazard=haz_future, impfset=impf_set, date=str(future_year)\n", |
403 | 403 | ")\n", |
404 | 404 | "\n", |
405 | | - "# Now we can define a list of two snapshots, present and future:\n", |
| 405 | + "### Now we can define a list of two snapshots, present and future:\n", |
406 | 406 | "snapcol = [snap1, snap2]" |
407 | 407 | ] |
408 | 408 | }, |
|
486 | 486 | "tags": [] |
487 | 487 | }, |
488 | 488 | "source": [ |
489 | | - "### Tidy format\n", |
| 489 | + "#### Tidy format\n", |
490 | 490 | "\n", |
491 | 491 | "We use the \"tidy\" format to output most of the results.\n", |
492 | 492 | "\n", |
|
526 | 526 | "tags": [] |
527 | 527 | }, |
528 | 528 | "source": [ |
529 | | - "### Static and Interpolated trajectories" |
| 529 | + "#### Static and Interpolated trajectories" |
530 | 530 | ] |
531 | 531 | }, |
532 | 532 | { |
|
559 | 559 | "name": "stdout", |
560 | 560 | "output_type": "stream", |
561 | 561 | "text": [ |
562 | | - "2026-02-26 10:26:48,575 - climada.trajectories.calc_risk_metrics - WARNING - No group id defined in the Exposures object. Per group aai will be empty.\n" |
| 562 | + "2026-02-26 10:49:01,429 - climada.trajectories.calc_risk_metrics - WARNING - No group id defined in the Exposures object. Per group aai will be empty.\n" |
563 | 563 | ] |
564 | 564 | }, |
565 | 565 | { |
|
730 | 730 | "name": "stdout", |
731 | 731 | "output_type": "stream", |
732 | 732 | "text": [ |
733 | | - "2026-02-26 10:26:50,530 - climada.trajectories.calc_risk_metrics - WARNING - No group id defined in at least one of the Exposures object. Per group aai will be empty.\n" |
| 733 | + "2026-02-26 10:49:01,923 - climada.trajectories.calc_risk_metrics - WARNING - No group id defined in at least one of the Exposures object. Per group aai will be empty.\n" |
734 | 734 | ] |
735 | 735 | }, |
736 | 736 | { |
|
850 | 850 | "name": "stdout", |
851 | 851 | "output_type": "stream", |
852 | 852 | "text": [ |
853 | | - "2026-02-26 10:26:51,731 - climada.trajectories.calc_risk_metrics - WARNING - No group id defined in at least one of the Exposures object. Per group aai will be empty.\n" |
| 853 | + "2026-02-26 10:49:01,941 - climada.trajectories.calc_risk_metrics - WARNING - No group id defined in at least one of the Exposures object. Per group aai will be empty.\n" |
854 | 854 | ] |
855 | 855 | }, |
856 | 856 | { |
|
1133 | 1133 | "tags": [] |
1134 | 1134 | }, |
1135 | 1135 | "source": [ |
1136 | | - "### DiscRates" |
| 1136 | + "#### DiscRates" |
1137 | 1137 | ] |
1138 | 1138 | }, |
1139 | 1139 | { |
|
1247 | 1247 | "tags": [] |
1248 | 1248 | }, |
1249 | 1249 | "source": [ |
1250 | | - "# Advanced usage\n", |
| 1250 | + "## Advanced usage\n", |
1251 | 1251 | "\n", |
1252 | 1252 | "In this section we present some more advanced features and use of this module." |
1253 | 1253 | ] |
|
1263 | 1263 | "tags": [] |
1264 | 1264 | }, |
1265 | 1265 | "source": [ |
1266 | | - "## Exposure sub groups" |
| 1266 | + "### Exposure sub groups" |
1267 | 1267 | ] |
1268 | 1268 | }, |
1269 | 1269 | { |
|
1545 | 1545 | "tags": [] |
1546 | 1546 | }, |
1547 | 1547 | "source": [ |
1548 | | - "## Results caching" |
| 1548 | + "### Results caching" |
1549 | 1549 | ] |
1550 | 1550 | }, |
1551 | 1551 | { |
|
1579 | 1579 | "tags": [] |
1580 | 1580 | }, |
1581 | 1581 | "source": [ |
1582 | | - "## Higher number of snapshots" |
| 1582 | + "### Higher number of snapshots" |
1583 | 1583 | ] |
1584 | 1584 | }, |
1585 | 1585 | { |
|
1616 | 1616 | "name": "stdout", |
1617 | 1617 | "output_type": "stream", |
1618 | 1618 | "text": [ |
1619 | | - "2026-02-26 10:27:03,971 - climada.entity.exposures.base - INFO - Reading /home/sjuhel/climada/data/exposures/litpop/LitPop_150arcsec_HTI/v3/LitPop_150arcsec_HTI.hdf5\n", |
1620 | | - "2026-02-26 10:27:09,060 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_HTI_1980_2020/v2/tropical_cyclone_10synth_tracks_150arcsec_HTI_1980_2020.hdf5\n", |
1621 | | - "2026-02-26 10:27:14,238 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2040/v2/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2040.hdf5\n", |
1622 | | - "2026-02-26 10:27:19,335 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2060/v2/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2060.hdf5\n", |
1623 | | - "2026-02-26 10:27:24,547 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2080/v2/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2080.hdf5\n" |
| 1619 | + "2026-02-26 10:49:04,288 - climada.entity.exposures.base - INFO - Reading /home/sjuhel/climada/data/exposures/litpop/LitPop_150arcsec_HTI/v3/LitPop_150arcsec_HTI.hdf5\n", |
| 1620 | + "2026-02-26 10:49:09,406 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_HTI_1980_2020/v2/tropical_cyclone_10synth_tracks_150arcsec_HTI_1980_2020.hdf5\n", |
| 1621 | + "2026-02-26 10:49:14,468 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2040/v2/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2040.hdf5\n", |
| 1622 | + "2026-02-26 10:49:19,501 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2060/v2/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2060.hdf5\n", |
| 1623 | + "2026-02-26 10:49:24,689 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2080/v2/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2080.hdf5\n" |
1624 | 1624 | ] |
1625 | 1625 | } |
1626 | 1626 | ], |
|
1802 | 1802 | "tags": [] |
1803 | 1803 | }, |
1804 | 1804 | "source": [ |
1805 | | - "## Non-default return periods" |
| 1805 | + "### Non-default return periods" |
1806 | 1806 | ] |
1807 | 1807 | }, |
1808 | 1808 | { |
|
2163 | 2163 | "tags": [] |
2164 | 2164 | }, |
2165 | 2165 | "source": [ |
2166 | | - "## Non-yearly date index" |
| 2166 | + "### Non-yearly date index" |
2167 | 2167 | ] |
2168 | 2168 | }, |
2169 | 2169 | { |
|
2472 | 2472 | } |
2473 | 2473 | ], |
2474 | 2474 | "source": [ |
2475 | | - "# snapcol = [snap, snap2]\n", |
| 2475 | + "## snapcol = [snap, snap2]\n", |
2476 | 2476 | "\n", |
2477 | | - "# Here we use \"1MS\" to get a monthly basis\n", |
| 2477 | + "## Here we use \"1MS\" to get a monthly basis\n", |
2478 | 2478 | "risk_traj.time_resolution = \"1M\"\n", |
2479 | 2479 | "\n", |
2480 | | - "# We would have to divide results by 12 to get \"average monthly impacts\"\n", |
| 2480 | + "## We would have to divide results by 12 to get \"average monthly impacts\"\n", |
2481 | 2481 | "risk_traj.per_date_risk_metrics()" |
2482 | 2482 | ] |
2483 | 2483 | }, |
|
2492 | 2492 | "tags": [] |
2493 | 2493 | }, |
2494 | 2494 | "source": [ |
2495 | | - "## Non-linear interpolation" |
| 2495 | + "### Non-linear interpolation" |
2496 | 2496 | ] |
2497 | 2497 | }, |
2498 | 2498 | { |
|
2530 | 2530 | "name": "stdout", |
2531 | 2531 | "output_type": "stream", |
2532 | 2532 | "text": [ |
2533 | | - "2026-02-26 10:27:39,361 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2080/v2/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2080.hdf5\n" |
| 2533 | + "2026-02-26 10:49:36,137 - climada.hazard.io - INFO - Reading /home/sjuhel/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2080/v2/tropical_cyclone_10synth_tracks_150arcsec_rcp60_HTI_2080.hdf5\n" |
2534 | 2534 | ] |
2535 | 2535 | }, |
2536 | 2536 | { |
|
2613 | 2613 | "tags": [] |
2614 | 2614 | }, |
2615 | 2615 | "source": [ |
2616 | | - "## Spatial mapping" |
| 2616 | + "### Spatial mapping" |
2617 | 2617 | ] |
2618 | 2618 | }, |
2619 | 2619 | { |
|
2887 | 2887 | "tags": [] |
2888 | 2888 | }, |
2889 | 2889 | "source": [ |
2890 | | - "## Custom Impact Computation strategy" |
| 2890 | + "### Custom Impact Computation strategy" |
2891 | 2891 | ] |
2892 | 2892 | }, |
2893 | 2893 | { |
2894 | 2894 | "cell_type": "markdown", |
2895 | 2895 | "id": "825b9b95-3343-4250-8e1c-e89120359482", |
2896 | | - "metadata": {}, |
| 2896 | + "metadata": { |
| 2897 | + "editable": true, |
| 2898 | + "slideshow": { |
| 2899 | + "slide_type": "" |
| 2900 | + }, |
| 2901 | + "tags": [] |
| 2902 | + }, |
2897 | 2903 | "source": [ |
2898 | 2904 | "By default, trajectory objects use `ImpactCalc().impact()` to compute the `Impact` object and the resulting metric, but you can customize this behaviour via the `impact_computation_strategy` argument.\n", |
2899 | 2905 | "\n", |
|
2906 | 2912 | "cell_type": "code", |
2907 | 2913 | "execution_count": 26, |
2908 | 2914 | "id": "f3b8d931-e4e5-40bf-b702-31183c6c7ec3", |
2909 | | - "metadata": {}, |
| 2915 | + "metadata": { |
| 2916 | + "editable": true, |
| 2917 | + "slideshow": { |
| 2918 | + "slide_type": "" |
| 2919 | + }, |
| 2920 | + "tags": [] |
| 2921 | + }, |
2910 | 2922 | "outputs": [], |
2911 | 2923 | "source": [ |
2912 | 2924 | "from climada.trajectories.impact_calc_strat import ImpactComputationStrategy\n", |
|
2927 | 2939 | { |
2928 | 2940 | "cell_type": "markdown", |
2929 | 2941 | "id": "998fa84d-12e7-4e18-aa96-41ca4bac3ed7", |
2930 | | - "metadata": {}, |
| 2942 | + "metadata": { |
| 2943 | + "editable": true, |
| 2944 | + "slideshow": { |
| 2945 | + "slide_type": "" |
| 2946 | + }, |
| 2947 | + "tags": [] |
| 2948 | + }, |
2931 | 2949 | "source": [ |
2932 | 2950 | "Note that you now have to assign the centroids before running the computations or else they will fail:" |
2933 | 2951 | ] |
|
2936 | 2954 | "cell_type": "code", |
2937 | 2955 | "execution_count": 27, |
2938 | 2956 | "id": "8d8d3b88-2c17-471e-acc3-afd8391a469d", |
2939 | | - "metadata": {}, |
| 2957 | + "metadata": { |
| 2958 | + "editable": true, |
| 2959 | + "slideshow": { |
| 2960 | + "slide_type": "" |
| 2961 | + }, |
| 2962 | + "tags": [] |
| 2963 | + }, |
2940 | 2964 | "outputs": [ |
2941 | 2965 | { |
2942 | 2966 | "name": "stdout", |
2943 | 2967 | "output_type": "stream", |
2944 | 2968 | "text": [ |
2945 | | - "2026-02-26 10:27:43,864 - climada.entity.exposures.base - INFO - Reading /home/sjuhel/climada/data/exposures/litpop/LitPop_150arcsec_HTI/v3/LitPop_150arcsec_HTI.hdf5\n", |
2946 | | - "2026-02-26 10:27:43,880 - climada.entity.exposures.base - INFO - Matching 1329 exposures with 1332 centroids.\n", |
2947 | | - "2026-02-26 10:27:43,883 - climada.util.coordinates - INFO - No exact centroid match found. Reprojecting coordinates to nearest neighbor closer than the threshold = 0.08333333333331439 degree\n", |
2948 | | - "2026-02-26 10:27:43,886 - climada.entity.exposures.base - INFO - Matching 1329 exposures with 1332 centroids.\n", |
2949 | | - "2026-02-26 10:27:43,889 - climada.util.coordinates - INFO - No exact centroid match found. Reprojecting coordinates to nearest neighbor closer than the threshold = 0.08333333333331439 degree\n" |
| 2969 | + "2026-02-26 10:49:39,233 - climada.entity.exposures.base - INFO - Reading /home/sjuhel/climada/data/exposures/litpop/LitPop_150arcsec_HTI/v3/LitPop_150arcsec_HTI.hdf5\n", |
| 2970 | + "2026-02-26 10:49:39,258 - climada.entity.exposures.base - INFO - Matching 1329 exposures with 1332 centroids.\n", |
| 2971 | + "2026-02-26 10:49:39,261 - climada.util.coordinates - INFO - No exact centroid match found. Reprojecting coordinates to nearest neighbor closer than the threshold = 0.08333333333331439 degree\n", |
| 2972 | + "2026-02-26 10:49:39,264 - climada.entity.exposures.base - INFO - Matching 1329 exposures with 1332 centroids.\n", |
| 2973 | + "2026-02-26 10:49:39,267 - climada.util.coordinates - INFO - No exact centroid match found. Reprojecting coordinates to nearest neighbor closer than the threshold = 0.08333333333331439 degree\n" |
2950 | 2974 | ] |
2951 | 2975 | } |
2952 | 2976 | ], |
|
2978 | 3002 | "cell_type": "code", |
2979 | 3003 | "execution_count": 28, |
2980 | 3004 | "id": "a94d99b5-2c7b-418e-88e9-a9dff39ab21e", |
2981 | | - "metadata": {}, |
| 3005 | + "metadata": { |
| 3006 | + "editable": true, |
| 3007 | + "slideshow": { |
| 3008 | + "slide_type": "" |
| 3009 | + }, |
| 3010 | + "tags": [] |
| 3011 | + }, |
2982 | 3012 | "outputs": [ |
2983 | 3013 | { |
2984 | 3014 | "name": "stdout", |
2985 | 3015 | "output_type": "stream", |
2986 | 3016 | "text": [ |
2987 | | - "2026-02-26 10:27:43,942 - climada.trajectories.calc_risk_metrics - WARNING - No group id defined in the Exposures object. Per group aai will be empty.\n" |
| 3017 | + "2026-02-26 10:49:39,321 - climada.trajectories.calc_risk_metrics - WARNING - No group id defined in the Exposures object. Per group aai will be empty.\n" |
2988 | 3018 | ] |
2989 | 3019 | }, |
2990 | 3020 | { |
|
0 commit comments