jupytext:
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.2
kernelspec:
display_name: Python 3
language: python
name: python3
Non-Floodplain Wetlands
Introduction
The datasets represent the extent and approximate location of Geographically Isolated Wetlands (GIWs), also known as non-floodplain wetlands (NFWs), in the conterminous United States. National Wetlands Inventory (NWI) lacustrine systems and palustrine wetlands were determined to be “isolated” based on their geographic location (i.e., unconnected, based on a distance measure, to specific classes of NHD aquatic systems). GIWs were here considered geographically isolated when they were outside of 10 meters from select NHD lines and polygons or were not adjacent to NWI Riverine or Estuarine wetlands and (where applicable) outside of 10 meters from a coastline (e.g., oceans or Great Lakes).
The datasets have two versions:
Version 1 (46.37 GB): The original Lane & D'Amico (2016) dataset with the original attributes. We call this dataset NFW .
Version 2 (90.18 GB): The original Lane & D'Amico (2016) dataset with additional attributes from the 10-m resolution depression dataset. We call this dataset Wetland Depressions .
Reference
Lane, C. R., & D'Amico, E. (2016). Identification of putative geographically isolated wetlands of the conterminous United States. JAWRA Journal of the American Water Resources Association , 52(3), 705-722. https://doi.org/10.1111/1752-1688.12421
Environment setup
First, create a conda environment with the required packages:
1 conda create -n gdal python= 3.11
2 conda activate gdal
3 conda install -c conda-forge mamba
4 mamba install -c conda-forge libgdal-arrow-parquet gdal leafmap lonboard
1 conda create -n gdal python= 3.11
2 conda activate gdal
3 conda install -c conda-forge mamba
4 mamba install -c conda-forge libgdal-arrow-parquet gdal leafmap lonboard
If you are using Google Colab, you can uncomment the following to install the packages and restart the runtime after installation.
1 # %pip install leafmap lonboard
1 # %pip install leafmap lonboard
Data download
Click on this link to download the data to your computer and unzip it.
Data conversion
The script below was used to convert the data from the original Geodatabase format to Parquet format. The script uses the leafmap Python package.
1 gdb = "Geographically_Isolated_Wetlands_of_ConterminousUnitedStates.gdb"
2 # leafmap.gdb_to_vector(gdb, ".", gdal_driver="Parquet")
1 gdb = "Geographically_Isolated_Wetlands_of_ConterminousUnitedStates.gdb"
2 # leafmap.gdb_to_vector(gdb, ".", gdal_driver="Parquet")
The total file size of the Geodatabase files is 4.4 GB. The total file size of the Parquet files is 46.37 GB.
Data access
The script below can be used to access the data using DuckDB . The script uses the duckdb Python package.
1 import duckdb
2
3 con = duckdb.connect()
4 con.install_extension("spatial")
5 con.load_extension("spatial")
6
7 state = "IA" # Change to the US State of your choice
8 url = f"https://data.source.coop/giswqs/giw/wetlands/{state}_IW.parquet"
9 # con.sql(f"SELECT * EXCLUDE geometry, ST_GeomFromWKB(geometry) as geometry FROM '{url}'")
1 import duckdb
2
3 con = duckdb.connect()
4 con.install_extension("spatial")
5 con.load_extension("spatial")
6
7 state = "IA" # Change to the US State of your choice
8 url = f"https://data.source.coop/giswqs/giw/wetlands/{state}_IW.parquet"
9 # con.sql(f"SELECT * EXCLUDE geometry, ST_GeomFromWKB(geometry) as geometry FROM '{url}'")
Find out the total number non-floodplain wetlands in the selected state:
1 con.sql(f"SELECT COUNT(*) FROM '{url}'")
1 con.sql(f"SELECT COUNT(*) FROM '{url}'")
Alternatively, you can use the aws cli to access the data directly from the S3 bucket:
1 aws s3 ls s3://us-west-2.opendata.source.coop/giswqs/giw/wetlands/
1 aws s3 ls s3://us-west-2.opendata.source.coop/giswqs/giw/wetlands/
Data visualization
To visualize the data, you can use the leafmap Python package with the lonboard backend. The script below shows how to visualize the data.
1 import leafmap
2
3 state = "DC" # Change to the US State of your choice
4 url = f"https://data.source.coop/giswqs/giw/wetlands/{state}_IW.parquet"
5 gdf = leafmap.read_parquet(
6 url, return_type="gdf", src_crs="EPSG:5070", dst_crs="EPSG:4326"
7 )
8 leafmap.view_vector(gdf, get_fill_color=[0, 0, 255, 128])
1 import leafmap
2
3 state = "DC" # Change to the US State of your choice
4 url = f"https://data.source.coop/giswqs/giw/wetlands/{state}_IW.parquet"
5 gdf = leafmap.read_parquet(
6 url, return_type="gdf", src_crs="EPSG:5070", dst_crs="EPSG:4326"
7 )
8 leafmap.view_vector(gdf, get_fill_color=[0, 0, 255, 128])
Data analysis
Find out the total number of NFWs in CONUS:
1 con.sql(
2 f"""
3 SELECT COUNT(*) AS Count
4 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands/*.parquet'
5 """
6 )
1 con.sql(
2 f"""
3 SELECT COUNT(*) AS Count
4 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands/*.parquet'
5 """
6 )
The total number of NFWs in CONUS is 8,380,620.
+++
Find out the number of NFWs in each state and order them by the number of NFWs:
1 giw_count_df = con.sql(
2 f"""
3 SELECT inState AS State, COUNT(*) AS Count
4 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands/*.parquet'
5 GROUP BY inState
6 ORDER BY COUNT(*) DESC;
7 """
8 ).df()
9 giw_count_df.head()
1 giw_count_df = con.sql(
2 f"""
3 SELECT inState AS State, COUNT(*) AS Count
4 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands/*.parquet'
5 GROUP BY inState
6 ORDER BY COUNT(*) DESC;
7 """
8 ).df()
9 giw_count_df.head()
Create a pie chart showing the number of NFWs in each state:
1 leafmap.pie_chart(
2 giw_count_df,
3 "State",
4 "Count",
5 height=700,
6 title="Number of Non-Floodplain Wetlands (NFWs) by State",
7 )
1 leafmap.pie_chart(
2 giw_count_df,
3 "State",
4 "Count",
5 height=700,
6 title="Number of Non-Floodplain Wetlands (NFWs) by State",
7 )
Create a bar chart showing the number of NFWs in each state:
1 leafmap.bar_chart(
2 giw_count_df, "State", "Count", title="Number of Non-Floodplain Wetlands (NFWs) by State"
3 )
1 leafmap.bar_chart(
2 giw_count_df, "State", "Count", title="Number of Non-Floodplain Wetlands (NFWs) by State"
3 )
Calculate the total area of NFWs in each state and order them by the area of wetlands:
1 sum_df = con.sql(
2 f"""
3 SELECT inState AS State, Sum(hectares) AS Hectares
4 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands/*.parquet'
5 GROUP BY inState
6 ORDER BY Sum(hectares) DESC;
7 """
8 ).df()
9 sum_df.head()
1 sum_df = con.sql(
2 f"""
3 SELECT inState AS State, Sum(hectares) AS Hectares
4 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands/*.parquet'
5 GROUP BY inState
6 ORDER BY Sum(hectares) DESC;
7 """
8 ).df()
9 sum_df.head()
Create a pie chart showing the total area of NFWs in each state:
1 leafmap.pie_chart(
2 sum_df,
3 "State",
4 "Hectares",
5 height=700,
6 title="Percentage Area of Non-Floodplain Wetlands (NFWs) by State",
7 )
1 leafmap.pie_chart(
2 sum_df,
3 "State",
4 "Hectares",
5 height=700,
6 title="Percentage Area of Non-Floodplain Wetlands (NFWs) by State",
7 )
Create a pie chart showing the total area of NFWs in each state:
1 leafmap.bar_chart(
2 sum_df, "State", "Hectares", title="Total Area of Non-Floodplain Wetlands (NFWs) by State"
3 )
1 leafmap.bar_chart(
2 sum_df, "State", "Hectares", title="Total Area of Non-Floodplain Wetlands (NFWs) by State"
3 )
1 median_df = con.sql(
2 f"""
3 SELECT inState AS State, median(hectares)*10000 AS Meters
4 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands/*.parquet'
5 GROUP BY inState
6 ORDER BY median(hectares) DESC;
7 """
8 ).df()
9 median_df.head(10)
1 median_df = con.sql(
2 f"""
3 SELECT inState AS State, median(hectares)*10000 AS Meters
4 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands/*.parquet'
5 GROUP BY inState
6 ORDER BY median(hectares) DESC;
7 """
8 ).df()
9 median_df.head(10)
Create a bar chart showing the median area of NFWs in each state:
1 leafmap.bar_chart(
2 median_df,
3 "State",
4 "Meters",
5 title="Median Area of Non-Floodplain Wetlands (NFWs) by State",
6 )
1 leafmap.bar_chart(
2 median_df,
3 "State",
4 "Meters",
5 title="Median Area of Non-Floodplain Wetlands (NFWs) by State",
6 )
+++
Calculate the number of NFWs intersecting surface depressions (i.e., wetland depressions) in each state:
1 giw_dep_count_stat = con.sql(
2 f"""
3 SELECT inState AS State, COUNT(DISTINCT Final_ID) AS Count
4 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands_v2/*.parquet'
5 WHERE area IS NOT NULL
6 GROUP BY inState
7 ORDER BY COUNT(*) DESC;
8 """
9 ).df()
10 giw_dep_count_stat.head()
1 giw_dep_count_stat = con.sql(
2 f"""
3 SELECT inState AS State, COUNT(DISTINCT Final_ID) AS Count
4 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands_v2/*.parquet'
5 WHERE area IS NOT NULL
6 GROUP BY inState
7 ORDER BY COUNT(*) DESC;
8 """
9 ).df()
10 giw_dep_count_stat.head()
Merge the NFW table with the wetland depressions table:
1 merged_df = giw_count_df.merge(giw_dep_count_stat, on="State")
2 merged_df.columns = ["State", "GIW_Count", "DEP_Count"]
3 merged_df["Percent"] = merged_df["DEP_Count"] / merged_df["GIW_Count"] * 100
4 merged_df.head()
1 merged_df = giw_count_df.merge(giw_dep_count_stat, on="State")
2 merged_df.columns = ["State", "GIW_Count", "DEP_Count"]
3 merged_df["Percent"] = merged_df["DEP_Count"] / merged_df["GIW_Count"] * 100
4 merged_df.head()
Compare the number of NFWs and wetland depressions in each state:
1 leafmap.bar_chart(
2 merged_df,
3 "State",
4 ["GIW_Count", "DEP_Count"],
5 title="Number of NFWs and Wetland Depressions by State",
6 )
1 leafmap.bar_chart(
2 merged_df,
3 "State",
4 ["GIW_Count", "DEP_Count"],
5 title="Number of NFWs and Wetland Depressions by State",
6 )
+++
Compute the statistics of the area of NFWs and wetland depressions in each state:
1 giw_dep_count_stat = con.sql(
2 f"""
3 SELECT inState AS State, COUNT(DISTINCT Final_ID) AS Count,
4 SUM(area) / 1e6 AS Total_Area_km2,
5 SUM(volume) / 1e9 AS Total_Volume_km3,
6 Median(area) AS Median_Area_m2,
7 Median(volume) AS Median_Volume_m3
8 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands_v2/*.parquet'
9 WHERE area IS NOT NULL
10 GROUP BY inState
11 ORDER BY COUNT(*) DESC;
12 """
13 ).df()
14 giw_dep_count_stat.head(10)
1 giw_dep_count_stat = con.sql(
2 f"""
3 SELECT inState AS State, COUNT(DISTINCT Final_ID) AS Count,
4 SUM(area) / 1e6 AS Total_Area_km2,
5 SUM(volume) / 1e9 AS Total_Volume_km3,
6 Median(area) AS Median_Area_m2,
7 Median(volume) AS Median_Volume_m3
8 FROM 's3://us-west-2.opendata.source.coop/giswqs/giw/wetlands_v2/*.parquet'
9 WHERE area IS NOT NULL
10 GROUP BY inState
11 ORDER BY COUNT(*) DESC;
12 """
13 ).df()
14 giw_dep_count_stat.head(10)
The median size of wetland depressions in each state:
1 leafmap.bar_chart(
2 giw_dep_count_stat[giw_dep_count_stat['State'] != "NV"],
3 "State",
4 "Median_Area_m2",
5 title="The Median Size of Maximum Depression Area by State",
6 )
1 leafmap.bar_chart(
2 giw_dep_count_stat[giw_dep_count_stat['State'] != "NV"],
3 "State",
4 "Median_Area_m2",
5 title="The Median Size of Maximum Depression Area by State",
6 )
+++
The median maximum storage volume of wetland depressions in each state:
1 leafmap.bar_chart(
2 giw_dep_count_stat,
3 "State",
4 "Median_Volume_m3",
5 title="The Median Maximum Storage Volume of Wetlands Depressions by State",
6 )
1 leafmap.bar_chart(
2 giw_dep_count_stat,
3 "State",
4 "Median_Volume_m3",
5 title="The Median Maximum Storage Volume of Wetlands Depressions by State",
6 )