ngiab-data-preprocess 4.2.0__py3-none-any.whl → 4.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -290,6 +290,7 @@ def update_geopackage_metadata(gpkg: Path) -> None:
290
290
 
291
291
  con.close()
292
292
 
293
+
293
294
  def subset_table_by_vpu(table: str, vpu: str, hydrofabric: Path, subset_gpkg_name: Path) -> None:
294
295
  """
295
296
  Subset the specified table from the hydrofabric database by vpuid and save it to the subset geopackage.
@@ -306,9 +307,9 @@ def subset_table_by_vpu(table: str, vpu: str, hydrofabric: Path, subset_gpkg_nam
306
307
  dest_db = sqlite3.connect(subset_gpkg_name)
307
308
 
308
309
  if vpu == "03":
309
- vpus = ["03N","03S","03W"]
310
+ vpus = ["03N", "03S", "03W"]
310
311
  elif vpu == "10":
311
- vpus = ["10L","10U"]
312
+ vpus = ["10L", "10U"]
312
313
  else:
313
314
  vpus = [vpu]
314
315
 
@@ -335,7 +336,6 @@ def subset_table_by_vpu(table: str, vpu: str, hydrofabric: Path, subset_gpkg_nam
335
336
 
336
337
  insert_data(dest_db, table, contents)
337
338
 
338
-
339
339
  if table in get_feature_tables(file_paths.conus_hydrofabric):
340
340
  fids = [str(x[0]) for x in contents]
341
341
  copy_rTree_tables(table, fids, source_db, dest_db)
@@ -372,6 +372,14 @@ def subset_table(table: str, ids: List[str], hydrofabric: Path, subset_gpkg_name
372
372
  sql_query = "SELECT divide_id FROM 'divides'"
373
373
  contents = dest_db.execute(sql_query).fetchall()
374
374
  ids = [str(x[0]) for x in contents]
375
+
376
+ if table == "nexus":
377
+ # add the nexuses in the toid column from the flowpaths table
378
+ sql_query = "SELECT toid FROM 'flowpaths'"
379
+ contents = dest_db.execute(sql_query).fetchall()
380
+ new_ids = [str(x[0]) for x in contents]
381
+ ids.extend(new_ids)
382
+
375
383
  ids = [f"'{x}'" for x in ids]
376
384
  key_name = "id"
377
385
  if table in table_keys:
@@ -409,6 +417,7 @@ def get_table_crs_short(gpkg: str, table: str) -> str:
409
417
  crs = con.execute(sql_query).fetchone()[0]
410
418
  return crs
411
419
 
420
+
412
421
  def get_table_crs(gpkg: str, table: str) -> str:
413
422
  """
414
423
  Get the CRS of the specified table in the specified geopackage.
@@ -510,7 +519,6 @@ def get_available_tables(gpkg: Path) -> List[str]:
510
519
 
511
520
 
512
521
  def get_cat_to_nhd_feature_id(gpkg: Path = file_paths.conus_hydrofabric) -> dict:
513
-
514
522
  available_tables = get_available_tables(gpkg)
515
523
  possible_tables = ["flowpath_edge_list", "network"]
516
524
 
data_processing/subset.py CHANGED
@@ -22,7 +22,7 @@ subset_tables = [
22
22
  "flowpath-attributes-ml",
23
23
  "flowpaths",
24
24
  "hydrolocations",
25
- "nexus",
25
+ "nexus", # depends on flowpaths in some cases e.g. gage delineation
26
26
  "pois", # requires flowpaths
27
27
  "lakes", # requires pois
28
28
  "network",
@@ -52,8 +52,9 @@ def create_subset_gpkg(
52
52
  update_geopackage_metadata(output_gpkg_path)
53
53
 
54
54
 
55
- def subset_vpu(vpu_id: str, output_gpkg_path: Path, hydrofabric: Path = file_paths.conus_hydrofabric):
56
-
55
+ def subset_vpu(
56
+ vpu_id: str, output_gpkg_path: Path, hydrofabric: Path = file_paths.conus_hydrofabric
57
+ ):
57
58
  if output_gpkg_path.exists():
58
59
  os.remove(output_gpkg_path)
59
60
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngiab_data_preprocess
3
- Version: 4.2.0
3
+ Version: 4.2.1
4
4
  Summary: Graphical Tools for creating Next Gen Water model input data.
5
5
  Author-email: Josh Cunningham <jcunningham8@ua.edu>
6
6
  Project-URL: Homepage, https://github.com/CIROH-UA/NGIAB_data_preprocess
@@ -3,10 +3,10 @@ data_processing/dataset_utils.py,sha256=4qmRmK3qMWPkiWZHXhXv3c-ISbtOwr7QhciEl2ok
3
3
  data_processing/datasets.py,sha256=BB_X0IvGnUrjBmj-wryn6-Nv5cd0Lje3zly3p896eU4,4822
4
4
  data_processing/file_paths.py,sha256=Cp3BxbO6sD50464ciTshjb3Z0vTvL0ZeSbOJgNdOqQ0,4698
5
5
  data_processing/forcings.py,sha256=6Q9fSXa67OrXg_r9li0K9widsclN2DQUp1-oUH2tZwo,19208
6
- data_processing/gpkg_utils.py,sha256=j-j6TkCwlkOzM5ATMHi44raYS-xrJMzk5V0XQZ_0dzQ,20220
6
+ data_processing/gpkg_utils.py,sha256=edyPR1ps4pkdtntGNcyXmXZUuzYPYBGsXsnmcndCWjE,20504
7
7
  data_processing/graph_utils.py,sha256=I9IFkU08SkXb8pfVASTvkm7T8BYt-92CaNj7TV6wJFE,8244
8
8
  data_processing/s3fs_utils.py,sha256=WoqqwxkHpv0Qq4I5f5-gUZBCFtVQ68ehXbdOjWRKTDQ,2752
9
- data_processing/subset.py,sha256=GbvfAaSJTfEvYOAZ6K0OgFA81xG_Y5UxiGDxukxO9gE,2558
9
+ data_processing/subset.py,sha256=Dh_JK4u0tf99N-oV2PW6qm9pLtGY0rjAaKZ8F5Z6ggk,2623
10
10
  data_sources/cfe-nowpm-realization-template.json,sha256=8an6q1drWD8wU1ocvdPab-GvZDvlQ-0di_-NommH3QI,3528
11
11
  data_sources/cfe-template.ini,sha256=6e5-usqjWtm3MWVvtm8CTeZTJJMxO1ZswkOXq0L9mnc,2033
12
12
  data_sources/em-catchment-template.yml,sha256=M08ixazEUHYI2PNavtI0xPZeSzcQ9bg2g0XzNT-8_u4,292
@@ -36,9 +36,9 @@ ngiab_data_cli/__main__.py,sha256=V-g0dwa000e5Qye7PBMTtHTK7Cl7as3JS0UoAR0QrZ4,10
36
36
  ngiab_data_cli/arguments.py,sha256=7ptImy8tLM1XvjfDr13tZszkjGVtenXo0KqllJeE3Mw,4372
37
37
  ngiab_data_cli/custom_logging.py,sha256=iS2XozaxudcxQj17qAsrCgbVK9LJAYAPmarJuVWJo1k,1280
38
38
  ngiab_data_cli/forcing_cli.py,sha256=lkcqWDk5H8IPyGv0DwLIZMQldqTUXpfwSX0C_RIuIJ8,3890
39
- ngiab_data_preprocess-4.2.0.dist-info/licenses/LICENSE,sha256=6dMSprwwnsRzEm02mEDbKHD9dUbL8bPIt9Vhrhb0Ulk,1081
40
- ngiab_data_preprocess-4.2.0.dist-info/METADATA,sha256=Y2NVmd92S38QMwKXEkLvLKyWQ2IGy25okHV8sDy6c2c,10310
41
- ngiab_data_preprocess-4.2.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
42
- ngiab_data_preprocess-4.2.0.dist-info/entry_points.txt,sha256=spwlhKEJ3ZnNETQsJGeTjD7Vwy8O_zGHb9GdX8ACCtw,128
43
- ngiab_data_preprocess-4.2.0.dist-info/top_level.txt,sha256=CjhYAUZrdveR2fOK6rxffU09VIN2IuPD7hk4V3l3pV0,52
44
- ngiab_data_preprocess-4.2.0.dist-info/RECORD,,
39
+ ngiab_data_preprocess-4.2.1.dist-info/licenses/LICENSE,sha256=6dMSprwwnsRzEm02mEDbKHD9dUbL8bPIt9Vhrhb0Ulk,1081
40
+ ngiab_data_preprocess-4.2.1.dist-info/METADATA,sha256=x6orDRcSZMvfbo_G8r9AhhgzFXOuQ8A4_lVyam5TYtg,10310
41
+ ngiab_data_preprocess-4.2.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
42
+ ngiab_data_preprocess-4.2.1.dist-info/entry_points.txt,sha256=spwlhKEJ3ZnNETQsJGeTjD7Vwy8O_zGHb9GdX8ACCtw,128
43
+ ngiab_data_preprocess-4.2.1.dist-info/top_level.txt,sha256=CjhYAUZrdveR2fOK6rxffU09VIN2IuPD7hk4V3l3pV0,52
44
+ ngiab_data_preprocess-4.2.1.dist-info/RECORD,,