|
8 | 8 | },
|
9 | 9 | "source": [
|
10 | 10 | "# WNTR Geospatial Tutorial\n",
|
11 |
| - "The following tutorial illustrates the use of the `wntr.gis` module to use geospatial data in resilience analysis. The objective of this tutorial is to 1) quantify water service disruptions that could occur from pipes damaged in landslides and 2) identify the social vulnerability of populations impacted by the service disruptions.\n", |
| 11 | + "The following tutorial illustrates the use of the `wntr.gis` module to use geospatial data in resilience analysis. The objective of this tutorial is to 1) quantify water service disruptions that could occur from pipes damaged in landslides and 2) identify population impacted by the service disruptions.\n", |
12 | 12 | "\n",
|
13 | 13 | "To simplify the tutorials, it is assumed that pipes within a 1000 ft buffer of each landslide susceptible region are damaged in that landslide.\n",
|
14 |
| - "This assumption could be replaced with detailed landslide analysis that includes slope, soil type, weather conditions, and pipe material.\n", |
15 |
| - "Social vulnerability data could also be replaced by datasets that describe other attributes of the population and critical services." |
| 14 | + "This assumption could be replaced with detailed landslide analysis that includes slope, soil type, weather conditions, and pipe material." |
16 | 15 | ]
|
17 | 16 | },
|
18 | 17 | {
|
|
233 | 232 | "metadata": {},
|
234 | 233 | "source": [
|
235 | 234 | "# External GIS Data\n",
|
236 |
| - "The external data used in this tutorial includes landslide inventory and social vulnerability data." |
| 235 | + "External landslide inventory data is used in this tutorial." |
237 | 236 | ]
|
238 | 237 | },
|
239 | 238 | {
|
|
303 | 302 | "tmp = ax.set_ylim(zoom_coords[1])"
|
304 | 303 | ]
|
305 | 304 | },
|
306 |
| - { |
307 |
| - "cell_type": "markdown", |
308 |
| - "metadata": {}, |
309 |
| - "source": [ |
310 |
| - "## Load Social Vulnerability Index (SVI) GIS data\n", |
311 |
| - "The social vulnerability data used in this tutorial was downloaded from the [Centers for Disease Control and Prevention/Agency for Toxic Substances and Disease Registry](https://www.atsdr.cdc.gov/placeandhealth/svi/index.html). The data contains census and social vulnerability metrics for each census tract. \n", |
312 |
| - "\n", |
313 |
| - "The quantity of interest used in this analysis is `RPL_THEMES` which ranks vulnerability across socioeconomic status, household characteristics, racial and ethnic minority status, and housing type and transportation. The value ranges between 0 and 1, where higher values are associated with higher vulnerability.\n", |
314 |
| - "\n", |
315 |
| - "*Citation: Centers for Disease Control and Prevention/Agency for Toxic Substances and Disease Registry/Geospatial Research, Analysis, and Services Program. CDC/ATSDR Social Vulnerability Index 2020 Database Kentucky. https://www.atsdr.cdc.gov/placeandhealth/svi/data_documentation_download.html. Accessed on 4/4/2024.*" |
316 |
| - ] |
317 |
| - }, |
318 |
| - { |
319 |
| - "cell_type": "code", |
320 |
| - "execution_count": null, |
321 |
| - "metadata": { |
322 |
| - "tags": [] |
323 |
| - }, |
324 |
| - "outputs": [], |
325 |
| - "source": [ |
326 |
| - "# To reduce the file size checked into the WNTR repository, the following code was run on the raw data file. \n", |
327 |
| - "# The region of interest (ROI) was defined above.\n", |
328 |
| - "\"\"\"\n", |
329 |
| - "svi_file = '../data/SVI2020_KENTUCKY_tract.gdb'\n", |
330 |
| - "svi_data = gpd.read_file(svi_file, driver=\"FileGDB\", layer='SVI2020_KENTUCKY_tract')\n", |
331 |
| - "print(svi_data.crs)\n", |
332 |
| - "svi_data.to_crs(crs, inplace=True)\n", |
333 |
| - "svi_data = svi_data.clip(ROI)\n", |
334 |
| - "svi_data.to_file(\"../data/ky10_svi_data.geojson\", index=True, driver='GeoJSON')\n", |
335 |
| - "\"\"\"" |
336 |
| - ] |
337 |
| - }, |
338 |
| - { |
339 |
| - "cell_type": "code", |
340 |
| - "execution_count": null, |
341 |
| - "metadata": { |
342 |
| - "tags": [] |
343 |
| - }, |
344 |
| - "outputs": [], |
345 |
| - "source": [ |
346 |
| - "# Load the SVI data from file and print the CRS to ensure it is in EPSG:3089. \n", |
347 |
| - "# The methods `to_crs` and `set_crs` can be used to change coordinate reference systems if needed.\n", |
348 |
| - "svi_file = '../data/ky10_svi_data.geojson'\n", |
349 |
| - "svi_data = gpd.read_file(svi_file).set_index('index') \n", |
350 |
| - "print(svi_data.crs)\n", |
351 |
| - "\n", |
352 |
| - "svi_data.head()" |
353 |
| - ] |
354 |
| - }, |
355 |
| - { |
356 |
| - "cell_type": "code", |
357 |
| - "execution_count": null, |
358 |
| - "metadata": { |
359 |
| - "tags": [] |
360 |
| - }, |
361 |
| - "outputs": [], |
362 |
| - "source": [ |
363 |
| - "# Plot SVI data and pipes (higher values of SVI are associated with higher vulnerability)\n", |
364 |
| - "ax = svi_data.plot(column='RPL_THEMES', label='SVI data', cmap='RdYlGn_r', vmin=0, vmax=1, legend=True)\n", |
365 |
| - "ax = wn_gis.pipes.plot(color='black', linewidth=1, ax=ax)\n", |
366 |
| - "ax.set_title('SVI and pipe data')\n", |
367 |
| - "tmp = ax.axis('off')\n", |
368 |
| - "# Comment/uncomment the following 2 lines to change the zoom on the network graphic\n", |
369 |
| - "tmp = ax.set_xlim(zoom_coords[0])\n", |
370 |
| - "tmp = ax.set_ylim(zoom_coords[1])" |
371 |
| - ] |
372 |
| - }, |
373 | 305 | {
|
374 | 306 | "attachments": {},
|
375 | 307 | "cell_type": "markdown",
|
|
428 | 360 | "metadata": {},
|
429 | 361 | "source": [
|
430 | 362 | "# Geospatial Intersects\n",
|
431 |
| - "In this section, landslide scenario and SVI data are interested with pipes and junctions in the `WaterNetworkModel`." |
| 363 | + "In this section, landslide scenario data are interested with pipes and junctions in the `WaterNetworkModel`." |
432 | 364 | ]
|
433 | 365 | },
|
434 | 366 | {
|
|
556 | 488 | "tmp = ax.set_ylim(zoom_coords[1])"
|
557 | 489 | ]
|
558 | 490 | },
|
559 |
| - { |
560 |
| - "cell_type": "markdown", |
561 |
| - "metadata": {}, |
562 |
| - "source": [ |
563 |
| - "## Assign social vulnerability to each junction\n", |
564 |
| - "Junctions are intersected with SVI to determine the social vulnerability of the population at each junction. The SVI data attribute `RPL_THEMES` is included in the intersection. <font color='red'>This information is used to determine the social vulnerability of individuals that experience water service disruptions.</font>\n", |
565 |
| - "\n", |
566 |
| - "The SVI data column `RPL_THEMES` ranks vulnerability across socioeconomic status, household characteristics, racial and ethnic minority status, and housing type and transportation. The value ranges between 0 and 1, where higher values are associated with higher vulnerability.\n", |
567 |
| - "\n", |
568 |
| - "**Note that since each junction only intersects one census tract, the SVI sum, min, max, and mean are all the same value.**" |
569 |
| - ] |
570 |
| - }, |
571 |
| - { |
572 |
| - "cell_type": "code", |
573 |
| - "execution_count": null, |
574 |
| - "metadata": { |
575 |
| - "tags": [] |
576 |
| - }, |
577 |
| - "outputs": [], |
578 |
| - "source": [ |
579 |
| - "# Use the intersect function to determine SVI of each junction. \n", |
580 |
| - "A = wn_gis.junctions\n", |
581 |
| - "B = svi_data\n", |
582 |
| - "B_value = 'RPL_THEMES'\n", |
583 |
| - "junction_svi = wntr.gis.intersect(A, B, B_value)\n", |
584 |
| - "\n", |
585 |
| - "junction_svi.head()" |
586 |
| - ] |
587 |
| - }, |
588 |
| - { |
589 |
| - "cell_type": "code", |
590 |
| - "execution_count": null, |
591 |
| - "metadata": {}, |
592 |
| - "outputs": [], |
593 |
| - "source": [ |
594 |
| - "# Add the intersection results (SVI value) to the GIS junction data\n", |
595 |
| - "wn_gis.junctions['RPL_THEMES'] = junction_svi['mean']" |
596 |
| - ] |
597 |
| - }, |
598 |
| - { |
599 |
| - "cell_type": "code", |
600 |
| - "execution_count": null, |
601 |
| - "metadata": { |
602 |
| - "tags": [] |
603 |
| - }, |
604 |
| - "outputs": [], |
605 |
| - "source": [ |
606 |
| - "# Plot SVI for each census tract and SVI assigned to each junction\n", |
607 |
| - "fig, axes = plt.subplots(1,2, figsize=(15,5))\n", |
608 |
| - "\n", |
609 |
| - "svi_data.plot(column='RPL_THEMES', label='SVI data', vmin=0, vmax=1, legend=True, ax=axes[0])\n", |
610 |
| - "wn_gis.pipes.plot(color='black', linewidth=1, ax=axes[0])\n", |
611 |
| - "tmp = axes[0].set_title('Census tract SVI and pipe data')\n", |
612 |
| - "tmp = axes[0].axis('off')\n", |
613 |
| - "# Comment/uncomment the following 2 lines to change the zoom on the network graphic\n", |
614 |
| - "tmp = axes[0].set_xlim(zoom_coords[0])\n", |
615 |
| - "tmp = axes[0].set_ylim(zoom_coords[1])\n", |
616 |
| - "\n", |
617 |
| - "wn_gis.pipes.plot(color='gray', linewidth=1, ax=axes[1])\n", |
618 |
| - "wn_gis.junctions.plot(column='RPL_THEMES', vmin=0, vmax=1, legend=True, ax=axes[1])\n", |
619 |
| - "tmp = axes[1].set_title('SVI value at each junction')\n", |
620 |
| - "tmp = axes[1].axis('off')\n", |
621 |
| - "# Comment/uncomment the following 2 lines to change the zoom on the network graphic\n", |
622 |
| - "tmp = axes[1].set_xlim(zoom_coords[0])\n", |
623 |
| - "tmp = axes[1].set_ylim(zoom_coords[1])" |
624 |
| - ] |
625 |
| - }, |
626 | 491 | {
|
627 | 492 | "cell_type": "markdown",
|
628 | 493 | "metadata": {
|
|
774 | 639 | },
|
775 | 640 | "source": [
|
776 | 641 | "# Analysis Results\n",
|
777 |
| - "The following section computes and plots analysis results, including water service availability (WSA) and the social vulnerability index (SVI) of impacted junctions for each scenario." |
| 642 | + "The following section computes and plots analysis results, including water service availability (WSA) of impacted junctions for each scenario." |
778 | 643 | ]
|
779 | 644 | },
|
780 | 645 | {
|
|
921 | 786 | "cell_type": "markdown",
|
922 | 787 | "metadata": {},
|
923 | 788 | "source": [
|
924 |
| - "## SVI of impacted junctions\n", |
| 789 | + "## WSA of impacted junctions\n", |
925 | 790 | "In this analysis, impacted junctions are defined as junctions where WSA falls below 0.5 (50% of the expected water was received) at any time during the simulation. Other criteria could also be used to defined impact."
|
926 | 791 | ]
|
927 | 792 | },
|
|
943 | 808 | {
|
944 | 809 | "cell_type": "code",
|
945 | 810 | "execution_count": null,
|
946 |
| - "metadata": {}, |
| 811 | + "metadata": { |
| 812 | + "scrolled": true |
| 813 | + }, |
947 | 814 | "outputs": [],
|
948 | 815 | "source": [
|
949 |
| - "# Plot SVI of impacted junctions for each scenario\n", |
| 816 | + "# Plot WSA of impacted junctions for each scenario\n", |
950 | 817 | "fig, axes = plt.subplots(2,3, figsize=(15,10))\n",
|
951 | 818 | "axes = axes.flatten()\n",
|
952 | 819 | "\n",
|
953 | 820 | "for i, scenario in enumerate(wsa_results.columns):\n",
|
954 | 821 | " j = impacted_junctions[scenario]\n",
|
955 | 822 | " wn_gis.pipes.plot(color='gray', linewidth=1, alpha=0.5, ax=axes[i]) # pipes\n",
|
956 | 823 | " if len(j) > 0:\n",
|
957 |
| - " wn_gis.junctions.loc[j,:].plot(column='RPL_THEMES', cmap='RdYlGn_r', vmin=0, vmax=1, legend=True, ax=axes[i]) # junction wsa\n", |
958 |
| - " tmp = axes[i].set_title('SVI '+scenario)\n", |
| 824 | + " wn_gis.junctions.loc[j,:].plot(column=scenario, cmap='RdYlGn', vmin=0, vmax=1, legend=True, ax=axes[i]) # junction wsa\n", |
| 825 | + " tmp = axes[i].set_title('WSA '+scenario)\n", |
959 | 826 | " tmp = axes[i].axis('off')\n",
|
960 | 827 | " if i >= 6: # axes is defined to have 6 subplots\n",
|
961 | 828 | " break"
|
|
0 commit comments