Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hydrofabric 2.2 Conus is missing divide attributes for some divides #318

Open
hellkite500 opened this issue Jan 7, 2025 · 0 comments
Open

Comments

@hellkite500
Copy link
Member

From the v2.2 conus geopackage, there 1420 divides which don't have corresponding divide-attributes.

This can be found by looking set difference of the divide_id columns from the divides table and the divide-attributes table

hydrofab = Path("conus_nextgen.gpkg")

hf: gpd.GeoDataFrame = gpd.read_file(hydrofab, layer="divides").set_index('divide_id')
att: gpd.GeoDataFrame = gpd.read_file(hydrofab, layer="divide-attributes").set_index('divide_id')

missing = hf.loc[ list( set(hf.index) - set(att.index) ) ]

print(missing)

will give

                    toid     type  ds_id    areasqkm vpuid    id  lengthkm  tot_drainage_areasqkm  has_flowline                                           geometry
divide_id                                                                                                                                                         
cat-2985361  cnx-2985361  coastal    NaN    0.487799    17  None       NaN                    NaN         False  POLYGON ((-2171865.001 2773424.999, -2171865.0...
cat-2985363  cnx-2985363  coastal    NaN    7.199095    17  None       NaN                    NaN         False  POLYGON ((-2190525.003 2728994.997, -2190435 2...
cat-3299590  cnx-3299590  coastal    NaN  112.437899    18  None       NaN                    NaN         False  POLYGON ((-2030204.995 1427325.005, -2030205.0...
cat-477728    cnx-477728  coastal    NaN   35.446505   03W  None       NaN                    NaN         False  POLYGON ((859694.999 867734.995, 859845.001 86...
cat-2985193  cnx-2985193  coastal    NaN    1.916107    17  None       NaN                    NaN         False  POLYGON ((-2095634.999 3125265.001, -2095665.0...
...                  ...      ...    ...         ...   ...   ...       ...                    ...           ...                                                ...
cat-477773    cnx-477773  coastal    NaN   13.551301   03W  None       NaN                    NaN         False  POLYGON ((812055 842714.996, 812024.996 842745...
cat-2985282  cnx-2985282  coastal    NaN   28.762635    17  None       NaN                    NaN         False  POLYGON ((-2013855.002 2999624.998, -2014155.0...
cat-644523    cnx-644523  coastal    NaN    3.175196    04  None       NaN                    NaN         False  POLYGON ((659445 2651055.002, 659475 2650904.9...
cat-644708    cnx-644708  coastal    NaN   30.668848    04  None       NaN                    NaN         False  POLYGON ((659445 2651055.002, 659595.001 26512...
cat-1792595  cnx-1792595  coastal    NaN   29.728803   10U  None       NaN                    NaN         False  POLYGON ((-185024.997 2339774.996, -184964.997...

[1420 rows x 10 columns]

A little further investigation of these shows that they are all coastal catchments, but not every coastal catchment is missing attributes.

print( missing['type'].unique() )
['coastal']

Here are the affected vpu's

print(missing['vpuid'].unique())
['17' '18' '03W' '03S' '04' '10L' '12' '10U' '05' '13']

and for fun, I plotted the attributeless catchments, which you can see here

image

Complete script here if needed, note it requires a pip install geopandas matplotlib before running:

#!/usr/bin/env python

import geopandas as gpd
import matplotlib.pyplot as plt
from pathlib import Path

hydrofab = Path("conus_nextgen.gpkg")

hf: gpd.GeoDataFrame = gpd.read_file(hydrofab, layer="divides").set_index('divide_id')
att: gpd.GeoDataFrame = gpd.read_file(hydrofab, layer="divide-attributes").set_index('divide_id')

print(hf)
print(att)

missing = hf.loc[ list( set(hf.index) - set(att.index) ) ]

print(missing)
print(missing['type'].unique())
print(missing['vpuid'].unique())

missing.plot()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant