Skip to content

Commit 2d96cd0

Browse files
authored
Documentation updates (#470)
* Updated geospatial demo * Update copyright year * Updated docs * updated version for upload-pages-artifact
1 parent d84ac38 commit 2d96cd0

File tree

6 files changed

+19
-179
lines changed

6 files changed

+19
-179
lines changed

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Copyright Notice
22
=================
33

4-
Copyright 2023 National Technology & Engineering Solutions of Sandia, LLC
4+
Copyright 2024 National Technology & Engineering Solutions of Sandia, LLC
55
(NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
66
Government retains certain rights in this software.
77

documentation/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108

109109
# General information about the project.
110110
project = u'WNTR'
111-
copyright = u'2023 National Technology & Engineering Solutions of Sandia, LLC (NTESS)'
111+
copyright = u'2024 National Technology & Engineering Solutions of Sandia, LLC (NTESS)'
112112
author = u'WNTR Developers'
113113

114114
bibtex_bibfiles = ['references.bib', 'citations.bib']

documentation/gis.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ WNTR to add attributes to the water network model and analysis. Examples of thes
243243
These geometries can be associated with points and lines in a water network model by snapping the point to the nearest component.
244244
* **LineString or MultiLineString geometries** that could contain street layout or earthquake fault lines.
245245
These geometries can be associated with points and lines in a water network model by finding the intersection.
246-
* **Polygon geometries** that could contain elevation, building footprints, zoning, land cover, hazard maps, census data, demographics, or social vulnerability.
246+
* **Polygon geometries** that could contain elevation, building footprints, zoning, land cover, hazard maps, census data, or demographics.
247247
These geometries can be associated with points and lines in a water network model by finding the intersection.
248248

249249
The snap and intersect examples below used additional GIS data stored in the
@@ -537,7 +537,7 @@ Find the intersect between geometries
537537

538538
The :class:`~wntr.gis.geospatial.intersect` function is used to find the intersection between geometries.
539539
This functionality can be used to identify faults, landslides, or other hazards that intersect pipes,
540-
or assign community resilience indicators (e.g., population characteristics, economic), future climate projections, hazards/risks, or other data to network components.
540+
or assign community resilience indicators (e.g., population characteristics, economic), hazards/risks, or other data to network components.
541541

542542
When finding the intersection of GeoDataFrame A with GeoDataFrame B (where A and B can contain points, lines, or polygons),
543543
the function returns the following information (one entry for each geometry in A):
@@ -740,7 +740,7 @@ Assign demographic data to pipes and junctions
740740
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
741741

742742
GIS data that includes community resilience indicators (e.g., population characteristics, economic data),
743-
future climate projections, hazards/risks, or other data can be used to identify
743+
hazards/risks, or other data can be used to identify
744744
the effects of disasters to different portions of the community, which can help utilities to improve equitable resilience.
745745
The following example highlights the process to assign demographic data to pipes and junctions. The demographic example dataset
746746
is a GeoDataFrame with a `geometry` column that contains ``shapely.geometry.Polygon`` geometries along with
@@ -835,7 +835,7 @@ Sample raster at points geometries
835835

836836
The :class:`~wntr.gis.sample_raster` function can be used to sample a raster file at point geometries,
837837
such as the nodes of a water network. A common use case for this function is to assign elevation to the
838-
nodes of a water network model, however other geospatial information such as climate or hazard data could be sampled
838+
nodes of a water network model, however other geospatial information such as hazard data could be sampled
839839
using this function.
840840

841841
The network file, Net1.inp, in EPSG:4326 CRS is used in the example below.

documentation/license.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Copyright
1717
------------
1818
.. code-block:: none
1919
20-
Copyright 2023 National Technology & Engineering Solutions of Sandia,
20+
Copyright 2024 National Technology & Engineering Solutions of Sandia,
2121
LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
2222
Government retains certain rights in this software.
2323

examples/data/ky10_svi_data.geojson

-27
This file was deleted.

examples/demos/geospatial_demo.ipynb

+12-145
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
},
99
"source": [
1010
"# 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",
1212
"\n",
1313
"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."
1615
]
1716
},
1817
{
@@ -233,7 +232,7 @@
233232
"metadata": {},
234233
"source": [
235234
"# 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."
237236
]
238237
},
239238
{
@@ -303,73 +302,6 @@
303302
"tmp = ax.set_ylim(zoom_coords[1])"
304303
]
305304
},
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-
},
373305
{
374306
"attachments": {},
375307
"cell_type": "markdown",
@@ -428,7 +360,7 @@
428360
"metadata": {},
429361
"source": [
430362
"# 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`."
432364
]
433365
},
434366
{
@@ -556,73 +488,6 @@
556488
"tmp = ax.set_ylim(zoom_coords[1])"
557489
]
558490
},
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-
},
626491
{
627492
"cell_type": "markdown",
628493
"metadata": {
@@ -774,7 +639,7 @@
774639
},
775640
"source": [
776641
"# 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."
778643
]
779644
},
780645
{
@@ -921,7 +786,7 @@
921786
"cell_type": "markdown",
922787
"metadata": {},
923788
"source": [
924-
"## SVI of impacted junctions\n",
789+
"## WSA of impacted junctions\n",
925790
"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."
926791
]
927792
},
@@ -943,19 +808,21 @@
943808
{
944809
"cell_type": "code",
945810
"execution_count": null,
946-
"metadata": {},
811+
"metadata": {
812+
"scrolled": true
813+
},
947814
"outputs": [],
948815
"source": [
949-
"# Plot SVI of impacted junctions for each scenario\n",
816+
"# Plot WSA of impacted junctions for each scenario\n",
950817
"fig, axes = plt.subplots(2,3, figsize=(15,10))\n",
951818
"axes = axes.flatten()\n",
952819
"\n",
953820
"for i, scenario in enumerate(wsa_results.columns):\n",
954821
" j = impacted_junctions[scenario]\n",
955822
" wn_gis.pipes.plot(color='gray', linewidth=1, alpha=0.5, ax=axes[i]) # pipes\n",
956823
" 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",
959826
" tmp = axes[i].axis('off')\n",
960827
" if i >= 6: # axes is defined to have 6 subplots\n",
961828
" break"

0 commit comments

Comments
 (0)